Commit 6e04dc39 authored by Iustin Pop's avatar Iustin Pop

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent a1d8344b
......@@ -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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment