mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
conf: add caps to virDomainDefFormat*
And use the newly added caps->host.netprefix (if it exists) for interface names that match the autogenerated target names. Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
This commit is contained in:
parent
481e9bd0f6
commit
d239a5427f
@ -488,7 +488,9 @@ bhyveDomainGetOSType(virDomainPtr dom)
|
||||
static char *
|
||||
bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
bhyveConnPtr privconn = conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
virCapsPtr caps = NULL;
|
||||
char *ret = NULL;
|
||||
|
||||
if (!(vm = bhyveDomObjFromDomain(domain)))
|
||||
@ -497,9 +499,14 @@ bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
if (virDomainGetXMLDescEnsureACL(domain->conn, vm->def, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
caps = bhyveDriverGetCapabilities(privconn);
|
||||
if (!caps)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat(vm->def, caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
virObjectUnref(caps);
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
|
@ -18201,8 +18201,8 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
|
||||
error:
|
||||
err = virSaveLastError();
|
||||
|
||||
strSrc = virDomainDefFormat(src, 0);
|
||||
strDst = virDomainDefFormat(dst, 0);
|
||||
strSrc = virDomainDefFormat(src, NULL, 0);
|
||||
strDst = virDomainDefFormat(dst, NULL, 0);
|
||||
VIR_DEBUG("XMLs that failed stability check were: src=\"%s\", dst=\"%s\"",
|
||||
NULLSTR(strSrc), NULLSTR(strDst));
|
||||
VIR_FREE(strSrc);
|
||||
@ -19890,6 +19890,7 @@ virDomainVirtioNetDriverFormat(char **outstr,
|
||||
int
|
||||
virDomainNetDefFormat(virBufferPtr buf,
|
||||
virDomainNetDefPtr def,
|
||||
char *prefix,
|
||||
unsigned int flags)
|
||||
{
|
||||
unsigned int actualType = virDomainNetGetActualType(def);
|
||||
@ -20067,7 +20068,8 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, "<backenddomain name='%s'/>\n", def->domain_name);
|
||||
if (def->ifname &&
|
||||
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
||||
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX)))) {
|
||||
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) ||
|
||||
(prefix && STRPREFIX(def->ifname, prefix))))) {
|
||||
/* Skip auto-generated target names for inactive config. */
|
||||
virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
|
||||
}
|
||||
@ -21617,6 +21619,7 @@ virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def)
|
||||
* Return -1 on failure. */
|
||||
int
|
||||
virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
unsigned int flags,
|
||||
virBufferPtr buf)
|
||||
{
|
||||
@ -21627,6 +21630,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
size_t i;
|
||||
virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
|
||||
int indent;
|
||||
char *netprefix = NULL;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS |
|
||||
VIR_DOMAIN_DEF_FORMAT_STATUS |
|
||||
@ -22324,8 +22328,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0)
|
||||
goto error;
|
||||
|
||||
if (caps)
|
||||
netprefix = caps->host.netprefix;
|
||||
for (n = 0; n < def->nnets; n++)
|
||||
if (virDomainNetDefFormat(buf, def->nets[n], flags) < 0)
|
||||
if (virDomainNetDefFormat(buf, def->nets[n], netprefix, flags) < 0)
|
||||
goto error;
|
||||
|
||||
for (n = 0; n < def->nsmartcards; n++)
|
||||
@ -22495,12 +22501,12 @@ unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags)
|
||||
|
||||
|
||||
char *
|
||||
virDomainDefFormat(virDomainDefPtr def, unsigned int flags)
|
||||
virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
||||
if (virDomainDefFormatInternal(def, flags, &buf) < 0)
|
||||
if (virDomainDefFormatInternal(def, caps, flags, &buf) < 0)
|
||||
return NULL;
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
@ -22534,7 +22540,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
|
||||
xmlopt->privateData.format(&buf, obj) < 0)
|
||||
goto error;
|
||||
|
||||
if (virDomainDefFormatInternal(obj->def, flags, &buf) < 0)
|
||||
if (virDomainDefFormatInternal(obj->def, NULL, flags, &buf) < 0)
|
||||
goto error;
|
||||
|
||||
virBufferAdjustIndent(&buf, -2);
|
||||
@ -22724,7 +22730,7 @@ virDomainSaveConfig(const char *configDir,
|
||||
int ret = -1;
|
||||
char *xml;
|
||||
|
||||
if (!(xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
if (!(xml = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainSaveXML(configDir, def, xml))
|
||||
@ -23024,7 +23030,7 @@ virDomainDefCopy(virDomainDefPtr src,
|
||||
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
||||
|
||||
/* Easiest to clone via a round-trip through XML. */
|
||||
if (!(xml = virDomainDefFormat(src, format_flags)))
|
||||
if (!(xml = virDomainDefFormat(src, caps, format_flags)))
|
||||
return NULL;
|
||||
|
||||
ret = virDomainDefParseString(xml, caps, xmlopt, parse_flags);
|
||||
@ -23511,6 +23517,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||
int flags = VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||
char *xmlStr = NULL;
|
||||
int rc = -1;
|
||||
char *netprefix;
|
||||
|
||||
switch ((virDomainDeviceType) src->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
@ -23523,7 +23530,8 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||
rc = virDomainFSDefFormat(&buf, src->data.fs, flags);
|
||||
break;
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
rc = virDomainNetDefFormat(&buf, src->data.net, flags);
|
||||
netprefix = caps->host.netprefix;
|
||||
rc = virDomainNetDefFormat(&buf, src->data.net, netprefix, flags);
|
||||
break;
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
rc = virDomainInputDefFormat(&buf, src->data.input, flags);
|
||||
|
@ -2734,11 +2734,13 @@ void virDomainIOThreadSchedDelId(virDomainDefPtr def, unsigned int iothread_id);
|
||||
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
|
||||
|
||||
char *virDomainDefFormat(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
unsigned int flags);
|
||||
char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
|
||||
virDomainObjPtr obj,
|
||||
unsigned int flags);
|
||||
int virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
unsigned int flags,
|
||||
virBufferPtr buf);
|
||||
|
||||
@ -2749,6 +2751,7 @@ int virDomainDiskSourceFormat(virBufferPtr buf,
|
||||
|
||||
int virDomainNetDefFormat(virBufferPtr buf,
|
||||
virDomainNetDefPtr def,
|
||||
char *prefix,
|
||||
unsigned int flags);
|
||||
|
||||
typedef enum {
|
||||
|
@ -702,7 +702,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
|
||||
virBufferAddLit(&buf, "</disks>\n");
|
||||
}
|
||||
if (def->dom) {
|
||||
if (virDomainDefFormatInternal(def->dom, flags, &buf) < 0) {
|
||||
if (virDomainDefFormatInternal(def->dom, NULL, flags, &buf) < 0) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2749,7 +2749,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff)
|
||||
def->id = id;
|
||||
|
||||
xml = virDomainDefFormat(def,
|
||||
xml = virDomainDefFormat(def, priv->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
}
|
||||
|
||||
@ -2805,7 +2805,8 @@ esxConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
||||
def = virVMXParseConfig(&ctx, priv->xmlopt, priv->caps, nativeConfig);
|
||||
|
||||
if (def)
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
xml = virDomainDefFormat(def, priv->caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
virDomainDefFree(def);
|
||||
|
||||
|
@ -885,7 +885,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
|
||||
/* FIXME: devices section is totally missing */
|
||||
|
||||
xml = virDomainDefFormat(def,
|
||||
xml = virDomainDefFormat(def, NULL,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
|
@ -1066,7 +1066,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
||||
goto cleanup_dom;
|
||||
|
||||
|
||||
if ((dom_xml = virDomainDefFormat(vm->def, 0)) == NULL)
|
||||
if ((dom_xml = virDomainDefFormat(vm->def, cfg->caps, 0)) == NULL)
|
||||
goto cleanup_dom;
|
||||
|
||||
if (libxl_userdata_store(cfg->ctx, domid, "libvirt-xml",
|
||||
|
@ -1674,7 +1674,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((xml = virDomainDefFormat(vm->def, 0)) == NULL)
|
||||
if ((xml = virDomainDefFormat(vm->def, cfg->caps, 0)) == NULL)
|
||||
goto cleanup;
|
||||
xml_len = strlen(xml) + 1;
|
||||
|
||||
@ -2555,6 +2555,8 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo,
|
||||
static char *
|
||||
libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
||||
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
|
||||
virDomainObjPtr vm;
|
||||
virDomainDefPtr def;
|
||||
char *ret = NULL;
|
||||
@ -2572,12 +2574,13 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
else
|
||||
def = vm->def;
|
||||
|
||||
ret = virDomainDefFormat(def,
|
||||
ret = virDomainDefFormat(def, cfg->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
virObjectUnlock(vm);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2630,7 +2633,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
xml = virDomainDefFormat(def, cfg->caps, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
|
@ -254,7 +254,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
|
||||
if (!libxlDomainMigrationIsAllowed(def))
|
||||
goto endjob;
|
||||
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
xml = virDomainDefFormat(def, cfg->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
endjob:
|
||||
if (!libxlDomainObjEndJob(driver, vm))
|
||||
|
@ -1027,6 +1027,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
|
||||
static char *lxcDomainGetXMLDesc(virDomainPtr dom,
|
||||
unsigned int flags)
|
||||
{
|
||||
virLXCDriverPtr driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
char *ret = NULL;
|
||||
|
||||
@ -1040,6 +1041,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
|
||||
|
||||
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
vm->newDef ? vm->newDef : vm->def,
|
||||
driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
@ -1072,7 +1074,7 @@ static char *lxcConnectDomainXMLFromNative(virConnectPtr conn,
|
||||
if (!(def = lxcParseConfigString(nativeConfig, caps, driver->xmlopt)))
|
||||
goto cleanup;
|
||||
|
||||
xml = virDomainDefFormat(def, 0);
|
||||
xml = virDomainDefFormat(def, caps, 0);
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(caps);
|
||||
|
@ -177,7 +177,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
||||
|
||||
/* now that we know it's stopped call the hook if present */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
|
||||
/* we can't stop the operation even if the script raised an error */
|
||||
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||
@ -238,7 +238,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
||||
|
||||
/* The "release" hook cleans up additional resources */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
|
||||
/* we can't stop the operation even if the script raised an error */
|
||||
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||
@ -1278,7 +1278,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
|
||||
/* Run an early hook to set-up missing devices */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
int hookret;
|
||||
|
||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||
@ -1390,7 +1390,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
|
||||
/* now that we know it is about to start call the hook if present */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
int hookret;
|
||||
|
||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||
@ -1532,7 +1532,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
||||
|
||||
/* finally we can call the 'started' hook script if any */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
int hookret;
|
||||
|
||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||
@ -1697,7 +1697,7 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
|
||||
|
||||
/* now that we know it's reconnected call the hook if present */
|
||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||
char *xml = virDomainDefFormat(vm->def, 0);
|
||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
||||
int hookret;
|
||||
|
||||
/* we can't stop the operation even if the script raised an error */
|
||||
|
@ -200,11 +200,11 @@ networkRunHook(virNetworkObjPtr network,
|
||||
|
||||
virBufferAddLit(&buf, "<hookData>\n");
|
||||
virBufferAdjustIndent(&buf, 2);
|
||||
if (iface && virDomainNetDefFormat(&buf, iface, 0) < 0)
|
||||
if (iface && virDomainNetDefFormat(&buf, iface, NULL, 0) < 0)
|
||||
goto cleanup;
|
||||
if (virNetworkDefFormatBuf(&buf, network->def, 0) < 0)
|
||||
goto cleanup;
|
||||
if (dom && virDomainDefFormatInternal(dom, 0, &buf) < 0)
|
||||
if (dom && virDomainDefFormatInternal(dom, NULL, 0, &buf) < 0)
|
||||
goto cleanup;
|
||||
|
||||
virBufferAdjustIndent(&buf, -2);
|
||||
|
@ -573,7 +573,7 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
ret = virDomainDefFormat(vm->def, driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
@ -2274,7 +2274,8 @@ openvzDomainMigrateBegin3Params(virDomainPtr domain,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
xml = virDomainDefFormat(vm->def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
xml = virDomainDefFormat(vm->def, driver->caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
|
@ -3303,7 +3303,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
if (virDomainDefSetVcpus(&def, vcpus) < 0)
|
||||
goto err;
|
||||
|
||||
return virDomainDefFormat(&def,
|
||||
return virDomainDefFormat(&def, phyp_driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
err:
|
||||
|
@ -2160,7 +2160,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
||||
|
||||
}
|
||||
|
||||
ret = virDomainDefFormatInternal(def,
|
||||
ret = virDomainDefFormatInternal(def, driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
buf);
|
||||
|
||||
|
@ -1982,7 +1982,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
|
||||
if (!(privdom = testDomObjFromDomain(domain)))
|
||||
goto cleanup;
|
||||
|
||||
xml = virDomainDefFormat(privdom->def,
|
||||
xml = virDomainDefFormat(privdom->def, privconn->caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
if (xml == NULL) {
|
||||
@ -2591,6 +2591,7 @@ testDomainGetVcpuPinInfo(virDomainPtr dom,
|
||||
|
||||
static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
testDriverPtr privconn = domain->conn->privateData;
|
||||
virDomainDefPtr def;
|
||||
virDomainObjPtr privdom;
|
||||
char *ret = NULL;
|
||||
@ -2603,7 +2604,8 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
privdom->newDef ? privdom->newDef : privdom->def;
|
||||
|
||||
ret = virDomainDefFormat(def, virDomainDefFormatConvertXMLFlags(flags));
|
||||
ret = virDomainDefFormat(def, privconn->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
|
@ -1986,7 +1986,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef ?
|
||||
vm->newDef : vm->def,
|
||||
vm->newDef : vm->def, driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
|
@ -3996,7 +3996,8 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
/* dump USB devices/filters if active */
|
||||
vboxHostDeviceGetXMLDesc(data, def, machine);
|
||||
|
||||
ret = virDomainDefFormat(def, virDomainDefFormatConvertXMLFlags(flags));
|
||||
ret = virDomainDefFormat(def, data->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
VBOX_RELEASE(machine);
|
||||
|
@ -1005,7 +1005,7 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
ret = virDomainDefFormat(vm->def, driver->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
@ -1040,7 +1040,8 @@ vmwareConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
||||
def = virVMXParseConfig(&ctx, driver->xmlopt, driver->caps, nativeConfig);
|
||||
|
||||
if (def != NULL)
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
xml = virDomainDefFormat(def, driver->caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
virDomainDefFree(def);
|
||||
|
||||
|
@ -642,6 +642,7 @@ vzDomainGetState(virDomainPtr domain,
|
||||
static char *
|
||||
vzDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
vzConnPtr privconn = domain->conn->privateData;
|
||||
virDomainDefPtr def;
|
||||
virDomainObjPtr privdom;
|
||||
char *ret = NULL;
|
||||
@ -654,7 +655,7 @@ vzDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
privdom->newDef ? privdom->newDef : privdom->def;
|
||||
|
||||
ret = virDomainDefFormat(def, flags);
|
||||
ret = virDomainDefFormat(def, privconn->caps, flags);
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
|
@ -1530,7 +1530,7 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
def = xenDaemonDomainGetXMLDesc(dom->conn, minidef, cpus);
|
||||
|
||||
if (def)
|
||||
ret = virDomainDefFormat(def,
|
||||
ret = virDomainDefFormat(def, priv->caps,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
@ -1586,7 +1586,7 @@ xenUnifiedConnectDomainXMLFromNative(virConnectPtr conn,
|
||||
if (!def)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat(def, 0);
|
||||
ret = virDomainDefFormat(def, priv->caps, 0);
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
|
@ -1402,7 +1402,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
xen_vm vm = NULL;
|
||||
xen_vm_set *vms;
|
||||
xen_string_string_map *result = NULL;
|
||||
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
|
||||
struct _xenapiPrivate *priv = conn->privateData;
|
||||
xen_session *session = priv->session;
|
||||
virDomainDefPtr defPtr = NULL;
|
||||
char *boot_policy = NULL;
|
||||
unsigned long memory = 0;
|
||||
@ -1580,7 +1581,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
xen_vif_set_free(vif_set);
|
||||
}
|
||||
xen_vm_set_free(vms);
|
||||
xml = virDomainDefFormat(defPtr, flags);
|
||||
xml = virDomainDefFormat(defPtr, priv->caps, flags);
|
||||
virDomainDefFree(defPtr);
|
||||
return xml;
|
||||
|
||||
|
@ -40,7 +40,7 @@ testCompareXMLToConfigFiles(const char *xml,
|
||||
goto fail;
|
||||
|
||||
if (vmdef) {
|
||||
if (!(actualxml = virDomainDefFormat(vmdef, 0)))
|
||||
if (!(actualxml = virDomainDefFormat(vmdef, caps, 0)))
|
||||
goto fail;
|
||||
|
||||
if (virtTestLoadFile(xml, &expectxml) < 0)
|
||||
|
@ -115,7 +115,7 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
actual = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
if (actual == NULL) {
|
||||
err = virGetLastError();
|
||||
|
@ -87,7 +87,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(actualxml = virDomainDefFormat(vmdef, 0)))
|
||||
if (!(actualxml = virDomainDefFormat(vmdef, driver.caps, 0)))
|
||||
goto fail;
|
||||
|
||||
if (blankProblemElements(expectxml) < 0 ||
|
||||
|
@ -182,7 +182,8 @@ testQemuHotplugCheckResult(virDomainObjPtr vm,
|
||||
int ret;
|
||||
|
||||
vm->def->id = -1;
|
||||
actual = virDomainDefFormat(vm->def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
actual = virDomainDefFormat(vm->def, driver.caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
if (!actual)
|
||||
return -1;
|
||||
vm->def->id = QEMU_HOTPLUG_TEST_DOMAIN_ID;
|
||||
|
@ -62,7 +62,7 @@ testCompareFiles(const char *xml, const char *sexpr)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(gotxml = virDomainDefFormat(def, 0)))
|
||||
if (!(gotxml = virDomainDefFormat(def, caps, 0)))
|
||||
goto fail;
|
||||
|
||||
if (virtTestCompareToFile(gotxml, xml) < 0)
|
||||
|
@ -1091,7 +1091,7 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(actual = virDomainDefFormat(def, format_flags)))
|
||||
if (!(actual = virDomainDefFormat(def, caps, format_flags)))
|
||||
goto fail;
|
||||
|
||||
if (virtTestCompareToFile(actual, outfile) < 0)
|
||||
|
@ -86,7 +86,8 @@ testCompareFiles(const char *vmx, const char *xml)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(formatted = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
if (!(formatted = virDomainDefFormat(def, caps,
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virtTestCompareToFile(formatted, xml) < 0)
|
||||
|
@ -116,7 +116,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
|
||||
if (!(def = xenParseXL(conf, caps, xmlopt)))
|
||||
goto fail;
|
||||
|
||||
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE |
|
||||
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_XML_INACTIVE |
|
||||
VIR_DOMAIN_XML_SECURE)))
|
||||
goto fail;
|
||||
|
||||
|
@ -121,7 +121,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
|
||||
if (!(def = xenParseXM(conf, caps, xmlopt)))
|
||||
goto fail;
|
||||
|
||||
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto fail;
|
||||
|
||||
if (virtTestCompareToFile(gotxml, xml) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user