Commit c396af83 authored by Christos Stavrakakis's avatar Christos Stavrakakis Committed by Helga Velroyen
Browse files

Preserve device names during instance move

Fix 'move-instance' tool to preserve the instance disk and NIC names
when moving instances from one cluster to another. Also, fix value error
since an instance NIC is an 8-tuple, containing also name and UUID.
Signed-off-by: default avatarChristos Stavrakakis <>
Reviewed-by: default avatarHelga Velroyen <>
parent 12f126b2
...@@ -489,6 +489,7 @@ class MoveDestExecutor(object): ...@@ -489,6 +489,7 @@ class MoveDestExecutor(object):
disks = [{ disks = [{
constants.IDISK_SIZE: i["size"], constants.IDISK_SIZE: i["size"],
constants.IDISK_MODE: i["mode"], constants.IDISK_MODE: i["mode"],
constants.IDISK_NAME: str(i.get("name")),
} for i in instance["disks"]] } for i in instance["disks"]]
nics = [{ nics = [{
...@@ -496,8 +497,9 @@ class MoveDestExecutor(object): ...@@ -496,8 +497,9 @@ class MoveDestExecutor(object):
constants.INIC_MAC: mac, constants.INIC_MAC: mac,
constants.INIC_MODE: mode, constants.INIC_MODE: mode,
constants.INIC_LINK: link, constants.INIC_LINK: link,
constants.INIC_NETWORK: network constants.INIC_NETWORK: network,
} for ip, mac, mode, link, network, _ in instance["nics"]] constants.INIC_NAME: nic_name
} for nic_name, _, ip, mac, mode, link, network, _ in instance["nics"]]
if len(override_nics) > len(nics): if len(override_nics) > len(nics):
raise Error("Can not create new NICs") raise Error("Can not create new NICs")
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