[virt-tools-list] [PATCH virt-manager] virtinst, clone: use the specified MAC address for the new VM

Giuseppe Scrivano gscrivan at redhat.com
Mon Jul 21 12:53:02 UTC 2014


Prevent setup_clone from changing the self._clone_macs list so that
further calls will access the same data.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1027576

Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 virtinst/cloner.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 9ac0ee1..e1bb782 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -379,11 +379,12 @@ class Cloner(object):
                 logging.warn(_("Setting the graphics device port to autoport, "
                                "in order to avoid conflicting."))
                 dev.port = -1
+        clone_macs = self._clone_macs[:]
         for iface in self._guest.get_devices("interface"):
             iface.target_dev = None
 
-            if self._clone_macs:
-                mac = self._clone_macs.pop()
+            if clone_macs:
+                mac = clone_macs.pop()
             else:
                 mac = VirtualNetworkInterface.generate_mac(self.conn)
             iface.macaddr = mac
-- 
1.9.3




More information about the virt-tools-list mailing list