From fbf14e8294bc3f3127719daeaaca0b18fdf2d03e Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 13 Mar 2014 15:10:45 -0400 Subject: [PATCH] XMLToNative: Parse XML as INACTIVE Right now we are parsing the XML as though it's live, which for example will choke on hardcoded XML like: Erroring with: $ sudo virsh domxml-to-native qemu-argv f error: XML error: security label is missing All drivers are fixed, but only qemu was tested. --- src/esx/esx_driver.c | 3 ++- src/libxl/libxl_driver.c | 3 ++- src/qemu/qemu_driver.c | 3 ++- src/xen/xen_driver.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 886d984216..6a2efe31b2 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2836,7 +2836,8 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char *nativeFormat, } def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt, - 1 << VIR_DOMAIN_VIRT_VMWARE, 0); + 1 << VIR_DOMAIN_VIRT_VMWARE, + VIR_DOMAIN_XML_INACTIVE); if (!def) { return NULL; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index ae7342a9ba..09ae0755a2 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2979,7 +2979,8 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat, if (!(def = virDomainDefParseString(domainXml, cfg->caps, driver->xmlopt, - 1 << VIR_DOMAIN_VIRT_XEN, 0))) + 1 << VIR_DOMAIN_VIRT_XEN, + VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if (!(conf = xenFormatXM(conn, def, cfg->verInfo->xen_version_major))) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a01739c815..89f443f5fe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5812,7 +5812,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, goto cleanup; def = virDomainDefParseString(xmlData, caps, driver->xmlopt, - QEMU_EXPECTED_VIRT_TYPES, 0); + QEMU_EXPECTED_VIRT_TYPES, + VIR_DOMAIN_XML_INACTIVE); if (!def) goto cleanup; diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 1880b22cb0..9204f888a3 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1657,7 +1657,8 @@ xenUnifiedConnectDomainXMLToNative(virConnectPtr conn, } if (!(def = virDomainDefParseString(xmlData, priv->caps, priv->xmlopt, - 1 << VIR_DOMAIN_VIRT_XEN, 0))) + 1 << VIR_DOMAIN_VIRT_XEN, + VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if (STREQ(format, XEN_CONFIG_FORMAT_XM)) {