Commit 0973f9ed authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Michele Tartara

Fix backup import in case NIC is inside a network

Network UUID is written in .ini file during backup export
but is not used by _ReadExportParams(). This patch fixes it.

Please note that in case a network is given, link and mode should
not be included in NIC options.

This fixes issue 716.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 523170de
......@@ -757,9 +757,19 @@ class LUInstanceCreate(LogicalUnit):
for idx in range(constants.MAX_NICS):
if einfo.has_option(constants.INISECT_INS, "nic%d_mac" % idx):
ndict = {}
for name in list(constants.NICS_PARAMETERS) + ["ip", "mac"]:
for name in [constants.INIC_IP, constants.INIC_MAC]:
v = einfo.get(constants.INISECT_INS, "nic%d_%s" % (idx, name))
ndict[name] = v
network = einfo.get(constants.INISECT_INS,
"nic%d_%s" % (idx, constants.INIC_NETWORK))
# in case network is given link and mode are inherited
# from nodegroup's netparams and thus should not be passed here
if network:
ndict[constants.INIC_NETWORK] = network
else:
for name in list(constants.NICS_PARAMETERS):
v = einfo.get(constants.INISECT_INS, "nic%d_%s" % (idx, name))
ndict[name] = v
nics.append(ndict)
else:
break
......
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