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

Cole Robinson crobinso at redhat.com
Fri Jul 25 16:58:23 UTC 2014


On 07/21/2014 08:53 AM, Giuseppe Scrivano wrote:
> 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[:]

please preserve whitespace and add a newline before this statement

>          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
> 

ACK with that

Thanks,
Cole




More information about the virt-tools-list mailing list