[PATCH 2/3] qemu: move qemuDomainRemoveNetDevice to avoid forward reference

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

 



pure code movement to setup for next patch.
---
 src/qemu/qemu_hotplug.c | 122 ++++++++++++++++++++++++------------------------
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a6a1591..ddc80a1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2454,67 +2454,6 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver,
 
 
 static void
-qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
-                          virDomainObjPtr vm,
-                          virDomainNetDefPtr net)
-{
-    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
-    virNetDevVPortProfilePtr vport;
-    virDomainEventPtr event;
-    size_t i;
-
-    VIR_DEBUG("Removing network interface %s from domain %p %s",
-              net->info.alias, vm, vm->def->name);
-
-    virDomainAuditNet(vm, net, NULL, "detach", true);
-
-    event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
-    if (event)
-        qemuDomainEventQueue(driver, event);
-
-    for (i = 0; i < vm->def->nnets; i++) {
-        if (vm->def->nets[i] == net) {
-            virDomainNetRemove(vm->def, i);
-            break;
-        }
-    }
-
-    qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
-    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);
-    }
-
-    if (cfg->macFilter && (net->ifname != NULL)) {
-        if ((errno = networkDisallowMacOnPort(driver,
-                                              net->ifname,
-                                              &net->mac))) {
-            virReportSystemError(errno,
-             _("failed to remove ebtables rule on '%s'"),
-                                 net->ifname);
-        }
-    }
-
-    vport = virDomainNetGetActualVirtPortProfile(net);
-    if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
-        ignore_value(virNetDevOpenvswitchRemovePort(
-                        virDomainNetGetActualBridgeName(net),
-                        net->ifname));
-
-    networkReleaseActualDevice(net);
-    virDomainNetDefFree(net);
-    virObjectUnref(cfg);
-}
-
-
-static void
 qemuDomainRemovePCIHostDevice(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
                               virDomainHostdevDefPtr hostdev)
@@ -2645,6 +2584,67 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
 
 
 static void
+qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
+                          virDomainObjPtr vm,
+                          virDomainNetDefPtr net)
+{
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    virNetDevVPortProfilePtr vport;
+    virDomainEventPtr event;
+    size_t i;
+
+    VIR_DEBUG("Removing network interface %s from domain %p %s",
+              net->info.alias, vm, vm->def->name);
+
+    virDomainAuditNet(vm, net, NULL, "detach", true);
+
+    event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
+    if (event)
+        qemuDomainEventQueue(driver, event);
+
+    for (i = 0; i < vm->def->nnets; i++) {
+        if (vm->def->nets[i] == net) {
+            virDomainNetRemove(vm->def, i);
+            break;
+        }
+    }
+
+    qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
+    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);
+    }
+
+    if (cfg->macFilter && (net->ifname != NULL)) {
+        if ((errno = networkDisallowMacOnPort(driver,
+                                              net->ifname,
+                                              &net->mac))) {
+            virReportSystemError(errno,
+             _("failed to remove ebtables rule on '%s'"),
+                                 net->ifname);
+        }
+    }
+
+    vport = virDomainNetGetActualVirtPortProfile(net);
+    if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
+        ignore_value(virNetDevOpenvswitchRemovePort(
+                        virDomainNetGetActualBridgeName(net),
+                        net->ifname));
+
+    networkReleaseActualDevice(net);
+    virDomainNetDefFree(net);
+    virObjectUnref(cfg);
+}
+
+
+static void
 qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           virDomainChrDefPtr chr)
-- 
1.8.3.1

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