On Tue, Nov 02, 2010 at 11:35:44AM -0400, Stefan Berger wrote:
During a shutdown/restart cycle libvirtd forgot the macvtap device
name
that it had created on behalf of a VM so that a stale macvtap device
remained on the host when the VM terminated. Libvirtd has to actively
tear down a macvtap device and it uses its name for identifying which
device to tear down.
The solution is to not blank out the <target dev='...'/> completely, but
only blank it out on VMs that are not active. So, if a VM is active, the
device name makes it into the XML and is also being parsed. If a VM is
not active, the device name is discarded.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
src/conf/domain_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: libvirt-acl/src/conf/domain_conf.c
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.c
+++ libvirt-acl/src/conf/domain_conf.c
@@ -2343,7 +2343,8 @@ virDomainNetDefParseXML(virCapsPtr caps,
def->data.direct.linkdev = dev;
dev = NULL;
- VIR_FREE(ifname);
+ if ((flags & VIR_DOMAIN_XML_INACTIVE))
+ VIR_FREE(ifname);
The conditional isn't required here - it is already dealt
with earlier on in the file. Just remove the VIR_FREE
completely.
@@ -5801,6 +5802,8 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "/>\n");
virVirtualPortProfileFormat(buf,
&def->data.direct.virtPortProfile,
" ");
+ if ((flags & VIR_DOMAIN_XML_INACTIVE))
+ VIR_FREE(def->ifname);
This seems dubious. Formatting XML should never require
changing 'def' at all.
Daniel.
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|