From 95268cc342b15aab3fe623e5eb0122b3875abe17 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sun, 14 Dec 2008 12:02:45 +0000 Subject: [PATCH] cleanup: fix export NIC count the same way as disk For safety, we use the same algorithm as in disk count. Reviewed-by: amishchenko --- lib/backend.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 994d8e0d8..2d7f63a48 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1637,15 +1637,16 @@ def FinalizeExport(instance, snap_disks): instance.beparams[constants.BE_VCPUS]) config.set(constants.INISECT_INS, 'disk_template', instance.disk_template) - nic_count = 0 + nic_total = 0 for nic_count, nic in enumerate(instance.nics): + nic_total += 1 config.set(constants.INISECT_INS, 'nic%d_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_bridge' % nic_count, '%s' % nic.bridge) # 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 for disk_count, disk in enumerate(snap_disks): -- GitLab