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:

  <seclabel type='dynamic' model='selinux' relabel='yes'/>

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.
This commit is contained in:
Cole Robinson 2014-03-13 15:10:45 -04:00
parent 3b79321ad0
commit fbf14e8294
4 changed files with 8 additions and 4 deletions

View File

@ -2836,7 +2836,8 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
} }
def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt, def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt,
1 << VIR_DOMAIN_VIRT_VMWARE, 0); 1 << VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_XML_INACTIVE);
if (!def) { if (!def) {
return NULL; return NULL;

View File

@ -2979,7 +2979,8 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
if (!(def = virDomainDefParseString(domainXml, if (!(def = virDomainDefParseString(domainXml,
cfg->caps, driver->xmlopt, cfg->caps, driver->xmlopt,
1 << VIR_DOMAIN_VIRT_XEN, 0))) 1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
if (!(conf = xenFormatXM(conn, def, cfg->verInfo->xen_version_major))) if (!(conf = xenFormatXM(conn, def, cfg->verInfo->xen_version_major)))

View File

@ -5812,7 +5812,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
goto cleanup; goto cleanup;
def = virDomainDefParseString(xmlData, caps, driver->xmlopt, def = virDomainDefParseString(xmlData, caps, driver->xmlopt,
QEMU_EXPECTED_VIRT_TYPES, 0); QEMU_EXPECTED_VIRT_TYPES,
VIR_DOMAIN_XML_INACTIVE);
if (!def) if (!def)
goto cleanup; goto cleanup;

View File

@ -1657,7 +1657,8 @@ xenUnifiedConnectDomainXMLToNative(virConnectPtr conn,
} }
if (!(def = virDomainDefParseString(xmlData, priv->caps, priv->xmlopt, 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; goto cleanup;
if (STREQ(format, XEN_CONFIG_FORMAT_XM)) { if (STREQ(format, XEN_CONFIG_FORMAT_XM)) {