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@xxxxxxxxxx> --- src/bhyve/bhyve_driver.c | 9 ++++++++- src/conf/domain_conf.c | 28 ++++++++++++++++++---------- src/conf/domain_conf.h | 3 +++ src/conf/snapshot_conf.c | 2 +- src/esx/esx_driver.c | 5 +++-- src/libxl/libxl_domain.c | 2 +- src/libxl/libxl_driver.c | 9 ++++++--- src/libxl/libxl_migration.c | 2 +- src/lxc/lxc_driver.c | 4 +++- src/lxc/lxc_process.c | 12 ++++++------ src/network/bridge_driver.c | 4 ++-- src/openvz/openvz_driver.c | 5 +++-- src/phyp/phyp_driver.c | 2 +- src/qemu/qemu_domain.c | 2 +- src/test/test_driver.c | 6 ++++-- src/uml/uml_driver.c | 2 +- src/vbox/vbox_common.c | 3 ++- src/vmware/vmware_driver.c | 5 +++-- src/vz/vz_driver.c | 3 ++- src/xen/xen_driver.c | 4 ++-- src/xenapi/xenapi_driver.c | 5 +++-- tests/lxcconf2xmltest.c | 2 +- tests/openvzutilstest.c | 2 +- tests/qemuargv2xmltest.c | 2 +- tests/qemuhotplugtest.c | 3 ++- tests/sexpr2xmltest.c | 2 +- tests/testutils.c | 2 +- tests/vmx2xmltest.c | 3 ++- tests/xlconfigtest.c | 2 +- tests/xmconfigtest.c | 2 +- 30 files changed, 85 insertions(+), 52 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index a164b24..c23c310 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -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); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 76cb399..4ecf700 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18170,8 +18170,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); @@ -19859,6 +19859,7 @@ virDomainVirtioNetDriverFormat(char **outstr, int virDomainNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, + char *prefix, unsigned int flags) { unsigned int actualType = virDomainNetGetActualType(def); @@ -20036,7 +20037,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); } @@ -21586,6 +21588,7 @@ virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def) * Return -1 on failure. */ int virDomainDefFormatInternal(virDomainDefPtr def, + virCapsPtr caps, unsigned int flags, virBufferPtr buf) { @@ -21596,6 +21599,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 | @@ -22293,8 +22297,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++) @@ -22464,12 +22470,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); @@ -22503,7 +22509,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); @@ -22693,7 +22699,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)) @@ -22993,7 +22999,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); @@ -23480,6 +23486,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: @@ -23492,7 +23499,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); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0141009..6ae2e1b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2733,11 +2733,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); @@ -2748,6 +2750,7 @@ int virDomainDiskSourceFormat(virBufferPtr buf, int virDomainNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, + char *prefix, unsigned int flags); typedef enum { diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index ea511ec..ffa1bf2 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -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; } diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 8d4b3fd..ce5f799 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -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); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index c74c55c..cf27ec4 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -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", diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4a9134e..dfaf3a0 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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); diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 0d23e5f..93eaa87 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -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)) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 67088c8..7be92c7 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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); diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index f7e2b81..3ee3b13 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -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 */ diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 362e294..c19696c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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); diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index c14834b..a6834b3 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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) diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 760e132..d1c40da 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1df1b74..22a8ff9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2160,7 +2160,7 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver, } - ret = virDomainDefFormatInternal(def, + ret = virDomainDefFormatInternal(def, driver->caps, virDomainDefFormatConvertXMLFlags(flags), buf); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 37108ab..89973f6 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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; diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index bccdc69..4469426 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -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: diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 110990f..cf38d2a 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -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); diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index fa66c21..e4e470a 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -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); diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index f73f8ef..1642894 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -642,6 +642,7 @@ vzDomainGetState(virDomainPtr domain, static char * vzDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) { + vzConnPtr privconn = 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) diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 4da2d6d..7628c94 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -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); diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index 629495c..c4f33b9 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -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; diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c index fd5bc03..fc071f7 100644 --- a/tests/lxcconf2xmltest.c +++ b/tests/lxcconf2xmltest.c @@ -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) diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 1414d70..ccde636 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -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(); diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 7759a09..946a4e5 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -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 || diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 61ade25..1f711dd 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -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; diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index de537ed..a4b0452 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -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) diff --git a/tests/testutils.c b/tests/testutils.c index b587f83..61c5b72 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -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) diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index a22af75..efd6325 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -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) diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index bad69ca..4b2f28f 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -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; diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 3d47693..a5c718b 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -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) -- 2.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list