Commit 1c573fb4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix QA import of existing instances

Commit f346a7d9

 broke the TestInstanceImport test in QA, since it
dropped the "always generate" parameter for backup import. We add an
override mac parameter so that, no matter what is defined in the
config file, imported instances (can) have a different MAC.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 656db618
......@@ -42,7 +42,7 @@ def _GetDiskStatePath(disk):
return "/sys/block/%s/device/state" % disk
def _GetGenericAddParameters(inst):
def _GetGenericAddParameters(inst, force_mac=None):
params = ["-B"]
params.append("%s=%s,%s=%s" % (constants.BE_MINMEM,
qa_config.get(constants.BE_MINMEM),
......@@ -52,7 +52,10 @@ def _GetGenericAddParameters(inst):
params.extend(["--disk", "%s:size=%s" % (idx, size)])
# Set static MAC address if configured
nic0_mac = qa_config.GetInstanceNicMac(inst)
if force_mac:
nic0_mac = force_mac
else:
nic0_mac = qa_config.GetInstanceNicMac(inst)
if nic0_mac:
params.extend(["--net", "0:mac=%s" % nic0_mac])
......@@ -421,7 +424,7 @@ def TestInstanceImport(newinst, node, expnode, name):
"--src-node=%s" % expnode["primary"],
"--src-dir=%s/%s" % (constants.EXPORT_DIR, name),
"--node=%s" % node["primary"]] +
_GetGenericAddParameters(newinst))
_GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE))
cmd.append(newinst["name"])
AssertCommand(cmd)
......
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