qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 01/14] KVM-test: Add a new macaddress pool a


From: Amos Kong
Subject: Re: [Qemu-devel] [RFC PATCH 01/14] KVM-test: Add a new macaddress pool algorithm
Date: Tue, 3 Aug 2010 09:34:33 +0800
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Jul 20, 2010 at 06:53:27PM +0300, Michael Goldish wrote:
> On 07/20/2010 04:44 PM, Amos Kong wrote:
> > On Tue, Jul 20, 2010 at 01:19:39PM +0300, Michael Goldish wrote:
> >>
> > 
> > Michael,
> > 
> > Thanks for your comments. Let's simplify this method together.

I would produce a v2 later basing on our discussion.


> >>> +    def get_ifname(self, nic_index=0):
> >>> +        """
> >>> +        Return the ifname of tap device for the guest nic.
> >>> +
> >>> +        @param nic_index: Index of the NIC
> >>> +        """
> >>> +
> >>> +        nics = kvm_utils.get_sub_dict_names(self.params, "nics")
> >>> +        nic_name = nics[nic_index]
> >>> +        nic_params = kvm_utils.get_sub_dict(self.params, nic_name)
> >>> +        if nic_params.get("nic_ifname"):
> >>> +            return nic_params.get("nic_ifname")
> >>> +        else:
> >>> +            return "%s_%s_%s" % (nic_params.get("nic_model"),
> >>> +                                 nic_index, self.vnc_port)
> >>
> >> What's the purpose of this string?
> > 
> > Just avoid repeated ifname.  The vnc_port is unique for each VM, nic_index 
> > is unique for each nic of one VM.
> 
> self.instance should also be unique, though it's quite long.

qemu can only receive 15 chars as ifname, instance is too long.
if the prefix of two instance are same, the actual ifnames will not be unique.


linux-user/syscall.c:
#define IFNAMSIZ        16

net/tap-linux.c:
int tap_open(...
...
    if (ifname[0] != '\0')
        pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname);
    else
        pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]