Commit b32d0ba5 authored by Aaron Karper's avatar Aaron Karper Committed by Michele Tartara
Browse files

Remove check for "complex disk layout" from LUMoveInstance



The check is unnecessary because earlier the disk template is checked in
a more restrictive way. Newly the check works on disk types, but gets
rid of the redundancy.
Signed-off-by: default avatarAaron Karper <akarper@google.com>
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent e3e5edf2
......@@ -2111,10 +2111,12 @@ class LUInstanceMove(LogicalUnit):
assert self.instance is not None, \
"Cannot retrieve locked instance %s" % self.op.instance_name
if self.instance.disk_template not in constants.DTS_COPYABLE:
raise errors.OpPrereqError("Disk template %s not suitable for copying" %
self.instance.disk_template,
errors.ECODE_STATE)
disks = self.cfg.GetInstanceDisks(self.instance.uuid)
for idx, dsk in enumerate(disks):
if dsk.dev_type not in constants.DTS_COPYABLE:
raise errors.OpPrereqError("Instance disk %d has disk type %s and is"
" not suitable for copying"
% (idx, dsk.dev_type), errors.ECODE_STATE)
target_node = self.cfg.GetNodeInfo(self.op.target_node_uuid)
assert target_node is not None, \
......@@ -2129,13 +2131,6 @@ class LUInstanceMove(LogicalUnit):
cluster = self.cfg.GetClusterInfo()
bep = cluster.FillBE(self.instance)
disks = self.cfg.GetInstanceDisks(self.instance.uuid)
for idx, dsk in enumerate(disks):
if dsk.dev_type not in (constants.DT_PLAIN, constants.DT_FILE,
constants.DT_SHARED_FILE, constants.DT_GLUSTER):
raise errors.OpPrereqError("Instance disk %d has a complex layout,"
" cannot copy" % idx, errors.ECODE_STATE)
CheckNodeOnline(self, target_node.uuid)
CheckNodeNotDrained(self, target_node.uuid)
CheckNodeVmCapable(self, target_node.uuid)
......
......@@ -1566,7 +1566,8 @@ class TestLUInstanceMove(CmdlibTestCase):
op = opcodes.OpInstanceMove(instance_name=inst.name,
target_node=self.node.name)
self.ExecOpCodeExpectOpPrereqError(
op, "Disk template sharedfile not suitable for copying")
op, "Instance disk 0 has disk type sharedfile and is not suitable"
" for copying")
def testAlreadyOnTargetNode(self):
inst = self.cfg.AddNewInstance()
......
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