Revision 3016bc1f lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
11806 | 11806 |
def CheckArguments(self): |
11807 | 11807 |
if not (self.op.nics or self.op.disks or self.op.disk_template or |
11808 | 11808 |
self.op.hvparams or self.op.beparams or self.op.os_name or |
11809 |
self.op.online_inst or self.op.offline_inst or |
|
11810 |
self.op.runtime_mem): |
|
11809 |
self.op.offline is not None or self.op.runtime_mem): |
|
11811 | 11810 |
raise errors.OpPrereqError("No changes submitted", errors.ECODE_INVAL) |
11812 | 11811 |
|
11813 | 11812 |
if self.op.hvparams: |
... | ... | |
12327 | 12326 |
(disk_op, len(instance.disks)), |
12328 | 12327 |
errors.ECODE_INVAL) |
12329 | 12328 |
|
12330 |
# disabling the instance |
|
12331 |
if self.op.offline_inst: |
|
12329 |
if self.op.offline is None: |
|
12330 |
# Ignore |
|
12331 |
pass |
|
12332 |
elif self.op.offline: |
|
12333 |
# Mark instance as offline |
|
12332 | 12334 |
_CheckInstanceState(self, instance, INSTANCE_DOWN, |
12333 | 12335 |
msg="cannot change instance state to offline") |
12334 |
|
|
12335 |
# enabling the instance |
|
12336 |
if self.op.online_inst: |
|
12336 |
else: |
|
12337 |
# Mark instance as online, but stopped |
|
12337 | 12338 |
_CheckInstanceState(self, instance, INSTANCE_OFFLINE, |
12338 | 12339 |
msg="cannot make instance go online") |
12339 | 12340 |
|
... | ... | |
12619 | 12620 |
for key, val in self.op.osparams.iteritems(): |
12620 | 12621 |
result.append(("os/%s" % key, val)) |
12621 | 12622 |
|
12622 |
# online/offline instance
|
|
12623 |
if self.op.online_inst:
|
|
12624 |
self.cfg.MarkInstanceDown(instance.name)
|
|
12625 |
result.append(("admin_state", constants.ADMINST_DOWN))
|
|
12626 |
if self.op.offline_inst:
|
|
12623 |
if self.op.offline is None:
|
|
12624 |
# Ignore
|
|
12625 |
pass
|
|
12626 |
elif self.op.offline:
|
|
12627 |
# Mark instance as offline
|
|
12627 | 12628 |
self.cfg.MarkInstanceOffline(instance.name) |
12628 | 12629 |
result.append(("admin_state", constants.ADMINST_OFFLINE)) |
12630 |
else: |
|
12631 |
# Mark instance as online, but stopped |
|
12632 |
self.cfg.MarkInstanceDown(instance.name) |
|
12633 |
result.append(("admin_state", constants.ADMINST_DOWN)) |
|
12629 | 12634 |
|
12630 | 12635 |
self.cfg.Update(instance, feedback_fn) |
12631 | 12636 |
|
Also available in: Unified diff