Re: [PATCH] qemu: cleanup tap devices on FreeBSD

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

 



  Daniel P. Berrange wrote:

> On Mon, Feb 24, 2014 at 11:12:33PM +0400, Roman Bogorodskiy wrote:
> > We have to explicitly destroy TAP devices on FreeBSD because
> > they're not freed after being closed, otherwise we end up with
> > orphaned TAP devices after destroying a domain.
> > ---
> >  src/qemu/qemu_process.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> > index ffa939a..9181423 100644
> > --- a/src/qemu/qemu_process.c
> > +++ b/src/qemu/qemu_process.c
> > @@ -61,6 +61,7 @@
> >  #include "viruuid.h"
> >  #include "virprocess.h"
> >  #include "virtime.h"
> > +#include "virnetdevbridge.h"
> >  #include "virnetdevtap.h"
> >  #include "virbitmap.h"
> >  #include "viratomic.h"
> > @@ -4381,6 +4382,12 @@ void qemuProcessStop(virQEMUDriverPtr driver,
> >                               virDomainNetGetActualVirtPortProfile(net),
> >                               cfg->stateDir));
> >              VIR_FREE(net->ifname);
> > +        } else if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_BRIDGE) {
> > +            /* On some OSes, e.g. FreeBSD, tap devices are not cleaned up when released,
> > +             * so we have to handle that manually */
> > +            ignore_value(virNetDevBridgeRemovePort(virDomainNetGetActualBridgeName(net),
> > +                         net->ifname));
> > +            ignore_value(virNetDevTapDelete(net->ifname));
> >          }
> >          /* release the physical device (or any other resources used by
> >           * this interface in the network driver
> 
> Conceptually ok, but I fear this impl will result in the logs getting
> polluted with "cannot delete tap device" or similar log messages on OS
> where TAP device deletion is automatic.

Do you have an idea about better way to do that?

Maybe we could create something opposite to
virNetDevTapCreateInBridgePort(), e.g.
virNetDevTapReleaseInBridgePort() which would destroy tap device on
FreeBSD and do nothing on Linux?

But that will still require platform specific #ifdef's because checking
tap releasing feels like a little out of scope of configure checks.

Roman Bogorodskiy

Attachment: pgpfJxdodjD29.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]