From 229853143d90fdf6178a3039a640a4508493f07a Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Sun, 15 Jun 2008 10:55:37 +0000 Subject: [PATCH] Activate down instances' disks on replace-disks When replacing disks or evacuating nodes with instances administratively down ganeti fails because the instance disks are not active. This patch activates them, performs the replacement, and shuts them down again. Changing this also fixes the same issue on gnt-node evacuate. Reviewed-by: iustinp --- lib/cmdlib.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index dd185f983..810cf0cbc 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): -- GitLab