Commit 95268cc3 authored by Iustin Pop's avatar Iustin Pop
Browse files

cleanup: fix export NIC count the same way as disk

For safety, we use the same algorithm as in disk count.

Reviewed-by: amishchenko
parent bca2e7f4
...@@ -1637,15 +1637,16 @@ def FinalizeExport(instance, snap_disks): ...@@ -1637,15 +1637,16 @@ def FinalizeExport(instance, snap_disks):
instance.beparams[constants.BE_VCPUS]) instance.beparams[constants.BE_VCPUS])
config.set(constants.INISECT_INS, 'disk_template', instance.disk_template) config.set(constants.INISECT_INS, 'disk_template', instance.disk_template)
nic_count = 0 nic_total = 0
for nic_count, nic in enumerate(instance.nics): for nic_count, nic in enumerate(instance.nics):
nic_total += 1
config.set(constants.INISECT_INS, 'nic%d_mac' % config.set(constants.INISECT_INS, 'nic%d_mac' %
nic_count, '%s' % nic.mac) nic_count, '%s' % nic.mac)
config.set(constants.INISECT_INS, 'nic%d_ip' % nic_count, '%s' % nic.ip) config.set(constants.INISECT_INS, 'nic%d_ip' % nic_count, '%s' % nic.ip)
config.set(constants.INISECT_INS, 'nic%d_bridge' % nic_count, config.set(constants.INISECT_INS, 'nic%d_bridge' % nic_count,
'%s' % nic.bridge) '%s' % nic.bridge)
# TODO: redundant: on load can read nics until it doesn't exist # TODO: redundant: on load can read nics until it doesn't exist
config.set(constants.INISECT_INS, 'nic_count' , '%d' % nic_count) config.set(constants.INISECT_INS, 'nic_count' , '%d' % nic_total)
disk_total = 0 disk_total = 0
for disk_count, disk in enumerate(snap_disks): for disk_count, disk in enumerate(snap_disks):
......
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