diff --git a/lib/cmdlib.py b/lib/cmdlib.py index dd185f983c9c5d68dc3c963158e873cacb8535a8..810cf0cbc4a475c3f853e9a2d728fca3330c3279 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3907,6 +3907,12 @@ class LUReplaceDisks(LogicalUnit): """ instance = self.instance + + # Activate the instance disks if we're replacing them on a down instance + if instance.status == "down": + op = opcodes.OpActivateInstanceDisks(instance_name=instance.name) + self.proc.ChainOpCode(op) + if instance.disk_template == constants.DT_DRBD8: if self.op.remote_node is None: fn = self._ExecD8DiskOnly @@ -3914,7 +3920,15 @@ class LUReplaceDisks(LogicalUnit): fn = self._ExecD8Secondary else: raise errors.ProgrammerError("Unhandled disk replacement case") - return fn(feedback_fn) + + ret = fn(feedback_fn) + + # Deactivate the instance disks if we're replacing them on a down instance + if instance.status == "down": + op = opcodes.OpDeactivateInstanceDisks(instance_name=instance.name) + self.proc.ChainOpCode(op) + + return ret class LUQueryInstanceData(NoHooksLU):