diff --git a/lib/cmdlib.py b/lib/cmdlib.py index aa3740f12603cfb6c057c7d9885a0846b7ce6da2..8360b83dd6acb568acb7a00e65c9a98d1ba01350 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -13419,12 +13419,9 @@ class LUInstanceSetParams(LogicalUnit): ispec[constants.ISPEC_DISK_COUNT] = len(disk_sizes) ispec[constants.ISPEC_DISK_SIZE] = disk_sizes - if self.op.offline is not None: - if self.op.offline: - msg = "can't change to offline" - else: - msg = "can't change to online" - _CheckInstanceState(self, instance, CAN_CHANGE_INSTANCE_OFFLINE, msg=msg) + if self.op.offline is not None and self.op.offline: + _CheckInstanceState(self, instance, CAN_CHANGE_INSTANCE_OFFLINE, + msg="can't change to offline") # Pre-compute NIC changes (necessary to use result in hooks) self._nic_chgdesc = []