<br><tt><font size=2>Ed Swierk <eswierk@aristanetworks.com> wrote
on 02/15/2010 11:15:11 PM:</font></tt>
<br><tt><font size=2>> <br>
> On Mon, Feb 15, 2010 at 4:39 PM, Stefan Berger <stefanb@us.ibm.com>
wrote:<br>
> > This patch fixes the problem with the tear down of the macvtap
device<br>
> > when issuing a 'virsh destroy' by moving the tear down block
past the<br>
> > point of killing the Qemu process. It seems necessary to loop
at least<br>
> > once in the case of 'virsh destory' since the device seems to
be busy<br>
> > for a while after the Qemu process has been killed. This also
still<br>
> > properly tears down the macvtap device when the VM is 'virsh
shutdown'ed<br>
> > or halted from inside.<br>
> <br>
> I think it's fine to check just once, before replacing an existing<br>
> macvtap interface with a new one, that the existing interface's fd
can<br>
> be opened, to avoid stomping on an interface owned by someone else.</font></tt>
<br>
<br><tt><font size=2>This is for the case when the device gets created.
In that case I do </font></tt>
<br><tt><font size=2>check for someone else 'accidentally' having the same
MAC address.</font></tt>
<br><tt><font size=2><br>
> <br>
> On shutdown, I think it's safe to assume that an interface whose name,<br>
> macaddr and type matches is in fact the interface it created. I think<br>
> it should just go ahead and delete it without again trying to open
the<br>
> fd. Otherwise we end up with such annoying races, e.g. if qemu hangs<br>
> or takes a long time to shut down, you end up leaving the orphaned<br>
> interfaces sitting around as well as the hung qemu process.</font></tt>
<br>
<br><tt><font size=2>This would be for the case that the SIGKILL on the
Qemu process didn't actually</font></tt>
<br><tt><font size=2>tear down the process. I was hoping that that would
not happen. I guess the </font></tt>
<br><tt><font size=2>solution is to introduce another function like 'delMacvtapByAddressNoBusyCheck'</font></tt>
<br><tt><font size=2>that skips the test that tries to open the tap device.
Does this sound</font></tt>
<br><tt><font size=2>right ?</font></tt>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br>
<br><tt><font size=2><br>
> <br>
> --Ed<br>
</font></tt>