tech-net archive

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

Re: Specifying names for tap interfaces



On Thursday 21 June 2012 09:10:24 Manuel Bouyer wrote:
> On Thu, Jun 21, 2012 at 12:16:17PM +0100, Roger Pau Monne wrote:
> > Martin Husemann wrote:
> > >On Thu, Jun 21, 2012 at 11:24:37AM +0100, Roger Pau Monne wrote:
> > >>Then we end up with the same problem, since xl needs to know the name
> > >>of the created device (to launch the appropriate hotplug scripts), and
> > >>there's not way to fetch that from Qemu.
> > >
> > >I thought I saw command line options to invoke qemu that pass the tap
> > >ifname, or even open a fd and just pass the number?
> > >
> > >Something like:
> > >    qemu -net tap,ifname=tap14
> > >
> > >or
> > >
> > >    qemu -net tap,fd=4
> > >
> > >and you could pass the name to the script vie environment vars.
> > 
> > As I said on a previous email, how can you guarantee that the name
> > you chose and pass to Qemu will not be taken by someone else while
> > you are calling Qemu?
> > 
> > You might even be launching several guests at the same time, which
> > will lead you to a race.
> 
> This is a problem with name, but not if you use the fd-type setup:
> - xl opens /dev/tap, which creates the tap device (so xl knows the name)
> and a file descriptor (which I'll call n)
> - fork and exec qemu with: -net tap,vlan=0,fd=n
> - the xl parent process closes n.
> 
> in this setup, qemu reuses the already-existing tape device and doesn't
> create a new one, so no race condition possible here.
> This should fix the problem.

Could you not specify the ethernet address, pass it to qemu and use it to 
identify the interface? In other words, use the ethernet address as an 
interface alias/label.

Apologies if this has already been suggested and rejected.

Regards,
Sverre


Home | Main Index | Thread Index | Old Index