Commit 1a1296c8 authored by Guido Trotter's avatar Guido Trotter
Browse files

Fix check in gnt-instance modify -t



Currently when changing the instance disks the instance status (which
must be down) is only checked if the target status is among the mirrored
ones. This is incorrect: the instance must be down either way, even if
the desired final status is non-mirrored.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b447ab51
......@@ -8407,13 +8407,13 @@ class LUSetInstanceParams(LogicalUnit):
" %s to %s" % (instance.disk_template,
self.op.disk_template),
errors.ECODE_INVAL)
_CheckInstanceDown(self, instance, "cannot change disk template")
if self.op.disk_template in constants.DTS_NET_MIRROR:
_CheckNodeOnline(self, self.op.remote_node)
_CheckNodeNotDrained(self, self.op.remote_node)
disks = [{"size": d.size} for d in instance.disks]
required = _ComputeDiskSize(self.op.disk_template, disks)
_CheckNodesFreeDisk(self, [self.op.remote_node], required)
_CheckInstanceDown(self, instance, "cannot change disk template")
# hvparams processing
if self.op.hvparams:
......
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