|
|
43fe83 |
From 0294bbbfa178f4328c4f95c2686210f1dd08b93d Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <0294bbbfa178f4328c4f95c2686210f1dd08b93d.1382534061.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Laine Stump <laine@laine.org>
|
|
|
43fe83 |
Date: Mon, 21 Oct 2013 10:12:59 -0600
|
|
|
43fe83 |
Subject: [PATCH] qemu: move qemuDomainRemoveNetDevice to avoid forward
|
|
|
43fe83 |
reference
|
|
|
43fe83 |
|
|
|
43fe83 |
This is a prerequisite for the fix to
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1005682
|
|
|
43fe83 |
|
|
|
43fe83 |
pure code movement to setup for next patch.
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit c5561644d8551d80d94b648b9ab828c9859e1667)
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/qemu/qemu_hotplug.c | 122 ++++++++++++++++++++++++------------------------
|
|
|
43fe83 |
1 file changed, 61 insertions(+), 61 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
index dcee86c..4d29e18 100644
|
|
|
43fe83 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
@@ -2332,67 +2332,6 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
- virDomainObjPtr vm,
|
|
|
43fe83 |
- virDomainNetDefPtr net)
|
|
|
43fe83 |
-{
|
|
|
43fe83 |
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
|
|
43fe83 |
- virNetDevVPortProfilePtr vport;
|
|
|
43fe83 |
- virDomainEventPtr event;
|
|
|
43fe83 |
- size_t i;
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- VIR_DEBUG("Removing network interface %s from domain %p %s",
|
|
|
43fe83 |
- net->info.alias, vm, vm->def->name);
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- virDomainAuditNet(vm, net, NULL, "detach", true);
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
|
|
|
43fe83 |
- if (event)
|
|
|
43fe83 |
- qemuDomainEventQueue(driver, event);
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- for (i = 0; i < vm->def->nnets; i++) {
|
|
|
43fe83 |
- if (vm->def->nets[i] == net) {
|
|
|
43fe83 |
- virDomainNetRemove(vm->def, i);
|
|
|
43fe83 |
- break;
|
|
|
43fe83 |
- }
|
|
|
43fe83 |
- }
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
|
|
|
43fe83 |
- virDomainConfNWFilterTeardown(net);
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
|
|
|
43fe83 |
- ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
|
|
|
43fe83 |
- net->ifname, &net->mac,
|
|
|
43fe83 |
- virDomainNetGetActualDirectDev(net),
|
|
|
43fe83 |
- virDomainNetGetActualDirectMode(net),
|
|
|
43fe83 |
- virDomainNetGetActualVirtPortProfile(net),
|
|
|
43fe83 |
- cfg->stateDir));
|
|
|
43fe83 |
- VIR_FREE(net->ifname);
|
|
|
43fe83 |
- }
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- if (cfg->macFilter && (net->ifname != NULL)) {
|
|
|
43fe83 |
- if ((errno = networkDisallowMacOnPort(driver,
|
|
|
43fe83 |
- net->ifname,
|
|
|
43fe83 |
- &net->mac))) {
|
|
|
43fe83 |
- virReportSystemError(errno,
|
|
|
43fe83 |
- _("failed to remove ebtables rule on '%s'"),
|
|
|
43fe83 |
- net->ifname);
|
|
|
43fe83 |
- }
|
|
|
43fe83 |
- }
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- vport = virDomainNetGetActualVirtPortProfile(net);
|
|
|
43fe83 |
- if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
|
|
|
43fe83 |
- ignore_value(virNetDevOpenvswitchRemovePort(
|
|
|
43fe83 |
- virDomainNetGetActualBridgeName(net),
|
|
|
43fe83 |
- net->ifname));
|
|
|
43fe83 |
-
|
|
|
43fe83 |
- networkReleaseActualDevice(net);
|
|
|
43fe83 |
- virDomainNetDefFree(net);
|
|
|
43fe83 |
- virObjectUnref(cfg);
|
|
|
43fe83 |
-}
|
|
|
43fe83 |
-
|
|
|
43fe83 |
-
|
|
|
43fe83 |
-static void
|
|
|
43fe83 |
qemuDomainRemovePCIHostDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
virDomainObjPtr vm,
|
|
|
43fe83 |
virDomainHostdevDefPtr hostdev)
|
|
|
43fe83 |
@@ -2523,6 +2462,67 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
+qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
+ virDomainObjPtr vm,
|
|
|
43fe83 |
+ virDomainNetDefPtr net)
|
|
|
43fe83 |
+{
|
|
|
43fe83 |
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
|
|
43fe83 |
+ virNetDevVPortProfilePtr vport;
|
|
|
43fe83 |
+ virDomainEventPtr event;
|
|
|
43fe83 |
+ size_t i;
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ VIR_DEBUG("Removing network interface %s from domain %p %s",
|
|
|
43fe83 |
+ net->info.alias, vm, vm->def->name);
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ virDomainAuditNet(vm, net, NULL, "detach", true);
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
|
|
|
43fe83 |
+ if (event)
|
|
|
43fe83 |
+ qemuDomainEventQueue(driver, event);
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ for (i = 0; i < vm->def->nnets; i++) {
|
|
|
43fe83 |
+ if (vm->def->nets[i] == net) {
|
|
|
43fe83 |
+ virDomainNetRemove(vm->def, i);
|
|
|
43fe83 |
+ break;
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
|
|
|
43fe83 |
+ virDomainConfNWFilterTeardown(net);
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
|
|
|
43fe83 |
+ ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
|
|
|
43fe83 |
+ net->ifname, &net->mac,
|
|
|
43fe83 |
+ virDomainNetGetActualDirectDev(net),
|
|
|
43fe83 |
+ virDomainNetGetActualDirectMode(net),
|
|
|
43fe83 |
+ virDomainNetGetActualVirtPortProfile(net),
|
|
|
43fe83 |
+ cfg->stateDir));
|
|
|
43fe83 |
+ VIR_FREE(net->ifname);
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ if (cfg->macFilter && (net->ifname != NULL)) {
|
|
|
43fe83 |
+ if ((errno = networkDisallowMacOnPort(driver,
|
|
|
43fe83 |
+ net->ifname,
|
|
|
43fe83 |
+ &net->mac))) {
|
|
|
43fe83 |
+ virReportSystemError(errno,
|
|
|
43fe83 |
+ _("failed to remove ebtables rule on '%s'"),
|
|
|
43fe83 |
+ net->ifname);
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ vport = virDomainNetGetActualVirtPortProfile(net);
|
|
|
43fe83 |
+ if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
|
|
|
43fe83 |
+ ignore_value(virNetDevOpenvswitchRemovePort(
|
|
|
43fe83 |
+ virDomainNetGetActualBridgeName(net),
|
|
|
43fe83 |
+ net->ifname));
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ networkReleaseActualDevice(net);
|
|
|
43fe83 |
+ virDomainNetDefFree(net);
|
|
|
43fe83 |
+ virObjectUnref(cfg);
|
|
|
43fe83 |
+}
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+static void
|
|
|
43fe83 |
qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
virDomainObjPtr vm,
|
|
|
43fe83 |
virDomainChrDefPtr chr)
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.4
|
|
|
43fe83 |
|