Commit 0f68f7fa authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Michele Tartara
Browse files

Export and import Disk/NIC name



Name of Disk/NIC were not exported during backup until now.
Use the exported info during gnt-backup import.
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 0973f9ed
......@@ -2743,6 +2743,8 @@ def FinalizeExport(instance, snap_disks):
config.set(constants.INISECT_INS, "nic%d_ip" % nic_count, "%s" % nic.ip)
config.set(constants.INISECT_INS, "nic%d_network" % nic_count,
"%s" % nic.network)
config.set(constants.INISECT_INS, "nic%d_name" % nic_count,
"%s" % nic.name)
for param in constants.NICS_PARAMETER_TYPES:
config.set(constants.INISECT_INS, "nic%d_%s" % (nic_count, param),
"%s" % nic.nicparams.get(param, None))
......@@ -2759,6 +2761,8 @@ def FinalizeExport(instance, snap_disks):
("%s" % disk.physical_id[1]))
config.set(constants.INISECT_INS, "disk%d_size" % disk_count,
("%d" % disk.size))
config.set(constants.INISECT_INS, "disk%d_name" % disk_count,
"%s" % disk.name)
config.set(constants.INISECT_INS, "disk_count", "%d" % disk_total)
......
......@@ -745,7 +745,12 @@ class LUInstanceCreate(LogicalUnit):
for idx in range(constants.MAX_DISKS):
if einfo.has_option(constants.INISECT_INS, "disk%d_size" % idx):
disk_sz = einfo.getint(constants.INISECT_INS, "disk%d_size" % idx)
disks.append({constants.IDISK_SIZE: disk_sz})
disk_name = einfo.get(constants.INISECT_INS, "disk%d_name" % idx)
disk = {
constants.IDISK_SIZE: disk_sz,
constants.IDISK_NAME: disk_name
}
disks.append(disk)
self.op.disks = disks
if not disks and self.op.disk_template != constants.DT_DISKLESS:
raise errors.OpPrereqError("No disk info specified and the export"
......@@ -757,7 +762,8 @@ 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 [constants.INIC_IP, constants.INIC_MAC]:
for name in [constants.INIC_IP,
constants.INIC_MAC, constants.INIC_NAME]:
v = einfo.get(constants.INISECT_INS, "nic%d_%s" % (idx, name))
ndict[name] = v
network = einfo.get(constants.INISECT_INS,
......
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