On 14/06/12 04:54, Chris Evich wrote:
> Signed-off-by: Chris Evich<[email protected]>
> ---
>   client/virt/kvm_vm.py     |    8 ++++++--
>   client/virt/virt_utils.py |    8 +++-----
>   2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
> index 64a5400..9c67dda 100644
> --- a/client/virt/kvm_vm.py
> +++ b/client/virt/kvm_vm.py
> @@ -936,7 +936,7 @@ class VM(virt_vm.BaseVM):
>
>           for nic in vm.virtnet:
>               # setup nic parameters as needed
> -            nic = vm.add_nic(**dict(nic)) # implied add_netdev
> +            nic = vm.add_nic(**dict(nic)) # add_netdev if netdev_id not set
>               # gather set values or None if unset
>               vlan = int(nic.get('vlan'))
>               netdev_id = nic.get('netdev_id')
> @@ -1316,6 +1316,9 @@ class VM(virt_vm.BaseVM):
>                           nic.tapfd = str(virt_utils.open_tap("/dev/net/tun",
>                                                               nic.ifname,
>                                                               vnet_hdr=False))
> +                        logging.debug("Adding VM %s NIC ifname %s"
> +                                      " to bridge %s" % (self.name,
> +                                            nic.ifname, nic.netdst))
>                           if nic.nettype == 'bridge':
>                               virt_utils.add_to_bridge(nic.ifname, nic.netdst)
>                           virt_utils.bring_up_ifname(nic.ifname)
> @@ -1864,7 +1867,8 @@ class VM(virt_vm.BaseVM):
>           nic_index = self.virtnet.nic_name_index(nic.nic_name)
>           nic.set_if_none('vlan', str(nic_index))
>           nic.set_if_none('device_id', virt_utils.generate_random_id())

> -        nic.set_if_none('netdev_id', self.add_netdev(**params))
> +        if not nic.has_key('netdev_id'):
> +            nic.netdev_id = self.add_netdev(**nic)

Looks good for me.

It's a upstream:next bug,  CC [email protected]

Acked-by: Amos Kong <[email protected]>


>           nic.set_if_none('nic_model', params['nic_model'])
>           return nic
>
> diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
> index 56f4a3f..1c4d90d 100644
> --- a/client/virt/virt_utils.py
> +++ b/client/virt/virt_utils.py
> @@ -1181,11 +1181,9 @@ class VirtNet(DbNet, ParamsNet):
>           """
>           nic_index = self.nic_name_index(self[nic_index_or_name].nic_name)
>           prefix = "t%d-" % nic_index
> -        # Preserving previous naming, not sure if this is required:
> -        # assume db_key is at least one character
> -        # Ensure postfix is always exactly 11 characters
> -        postfix = (self.db_key + generate_random_string(10))[-11:]
> -        self[nic_index_or_name].ifname = prefix + postfix
> +        postfix = generate_random_string(6)
> +        # Ensure interface name doesn't excede 11 characters
> +        self[nic_index_or_name].ifname = (prefix + postfix)[-11:]
>           return self[nic_index_or_name].ifname # forces update_db
>
>   def verify_ip_address_ownership(ip, macs, timeout=10.0):

-- 
                        Amos.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to