From 6e04dc39bed2ae868bb400d28b411381ca77a40e Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 22 Jul 2010 13:00:15 -0400 Subject: [PATCH] Fix issue when changing the disk template to drbd If we pass the current primary node, the conversion will fail horribly with LVM creation errors. Instead, we catch and check for this condition in CheckPrereq. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cmdlib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 05f26497d..3a434f774 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -8409,6 +8409,10 @@ class LUSetInstanceParams(LogicalUnit): errors.ECODE_INVAL) _CheckInstanceDown(self, instance, "cannot change disk template") if self.op.disk_template in constants.DTS_NET_MIRROR: + if self.op.remote_node == pnode: + raise errors.OpPrereqError("Given new secondary node %s is the same" + " as the primary node of the instance" % + self.op.remote_node, errors.ECODE_STATE) _CheckNodeOnline(self, self.op.remote_node) _CheckNodeNotDrained(self, self.op.remote_node) disks = [{"size": d.size} for d in instance.disks] -- GitLab