[libvirt] [PATCH] remove port filter on detachment of a network device

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

 



This patch removes the port filter if the network device is detached 
via virDomainDetachDevice.

Signed-off-by: Gerhard Stenzel <gerhard.stenzel@xxxxxxxxxx>
Index: libvirt/src/qemu/qemu_driver.c
===================================================================
--- libvirt.orig/src/qemu/qemu_driver.c
+++ libvirt/src/qemu/qemu_driver.c
@@ -4829,6 +4829,7 @@ qemudDomainDetachNetDevice(virConnectPtr
 {
     int i, ret = -1;
     virDomainNetDefPtr detach = NULL;
+    struct qemud_driver *driver = qemu_driver;
 
     for (i = 0 ; i < vm->def->nnets ; i++) {
         virDomainNetDefPtr net = vm->def->nets[i];
@@ -4863,6 +4864,15 @@ qemudDomainDetachNetDevice(virConnectPtr
     if (qemuMonitorRemoveHostNetwork(vm, detach->vlan,
detach->hostnet_name) < 0)
         goto cleanup;
 
+    if ((driver->macFilter) && (detach->ifname != NULL)) {
+        if ((errno = networkDisallowMacOnPort(conn, driver,
detach->ifname,
+                                              detach->mac))) {
+            virReportSystemError(conn, errno,
+             _("failed to remove ebtables rule on '%s'"),
+                                 detach->ifname);
+        }
+    }
+
     if (vm->def->nnets > 1) {
         memmove(vm->def->nets + i,
                 vm->def->nets + i + 1,


-- 
Best regards, 

Gerhard Stenzel, 
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

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