[libvirt] [PATCH v2] qemu: clean up network interfaces before qemuProcessKill is called in qemuProcessStop

Daniel P. Berrange berrange at redhat.com
Mon May 8 08:38:45 UTC 2017

On Mon, May 08, 2017 at 03:03:30PM +0800, ZhiPeng Lu wrote:
> In qemuProcessStop we explicitly remove the port from the openvswitch bridge after
> qemuProcessKill is called. But there is a certain interval of time between
> deleting tap device and removing it from bridge. The problem occurs when two vms
> start and shutdown with the same name's network interface attached to the same
> openvswitch bridge. When one vm with the nic named "vnet0" stopping, it deleted
> tap device without timely removing the port from bridge.
> At this time, another vm created the tap device named "vnet0" and added port to the
> same bridge. Then, the first vm removed the port from the same bridge.
> Finally, the tap device of the second vm did not attached to the bridge.
> We need to delete the bridge port before deleting the tap device instead of after.
> So what's needed is to move the loop in qemuProcessStop that cleans up
> network interfaces so that it happens before qemuProcessKill is called.

This fix won't work correctly either. You cannot assume that libvirt has
control over when the QEMU process exits. It may exit itself *before*
libvirt runs any of its cleanup code.

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

More information about the libvir-list mailing list