virtinst, clone: use the specified MAC address for the new VM

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@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2014-07-21 13:54:38 +02:00
parent 312b349fce
commit 148576d69e
1 changed files with 4 additions and 2 deletions

View File

@ -379,11 +379,13 @@ 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