[PATCH] qemu: add macvlan delete to qemuDomainAttachNetDevice cleanup

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

 



From: Matthew Rosato <mjrosato@xxxxxxxxxxxxxxxxxx>

If an error occurs during qemuDomainAttachNetDevice after the macvtap
was created in qemuPhysIfaceConnect, the macvtap device gets left behind.
This patch adds code to the cleanup routine to delete the macvtap.

Signed-off-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 46875ad..c6045a0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -965,6 +965,16 @@ cleanup:
         if (iface_connected) {
             virDomainConfNWFilterTeardown(net);
 
+            if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
+                ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
+                                 net->ifname, &net->mac,
+                                 virDomainNetGetActualDirectDev(net),
+                                 virDomainNetGetActualDirectMode(net),
+                                 virDomainNetGetActualVirtPortProfile(net),
+                                 cfg->stateDir));
+                VIR_FREE(net->ifname);
+            }
+
             vport = virDomainNetGetActualVirtPortProfile(net);
             if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
                ignore_value(virNetDevOpenvswitchRemovePort(
-- 
1.7.9.5

--
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]