From: Laine Stump Date: Tue, 28 Feb 2012 03:43:23 +0000 (-0500) Subject: qemu: fix cleanup of bridge during failure of qemuDomainAttachNetDevice X-Git-Tag: v0.9.11-rc1~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cc4b62e305b1b02838a94f35830737b98444323;p=thirdparty%2Flibvirt.git qemu: fix cleanup of bridge during failure of qemuDomainAttachNetDevice In qemuDomainAttachNetDevice, the guest's tap interface has only been attached to the bridge if iface_connected is true. It's possible for an error to occur prior to that happening, and previously we would attempt to remove the tap interface from the bridge even if it hadn't been attached. --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3dd7c0a9b9..ef8ec86a31 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -837,13 +837,14 @@ cleanup: net->info.addr.pci.slot) < 0) VIR_WARN("Unable to release PCI address on NIC"); - if (iface_connected) + if (iface_connected) { virDomainConfNWFilterTeardown(net); - vport = virDomainNetGetActualVirtPortProfile(net); - if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) - ignore_value(virNetDevOpenvswitchRemovePort( - virDomainNetGetActualBridgeName(net), net->ifname)); + vport = virDomainNetGetActualVirtPortProfile(net); + if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) + ignore_value(virNetDevOpenvswitchRemovePort( + virDomainNetGetActualBridgeName(net), net->ifname)); + } networkReleaseActualDevice(net); }