mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 04:25:19 +00:00
conf: sanitize virDomainObjFormat & virDomainDefFormat* APIs
Moving their instance parameter to be the first one, and give consistent ordering of other parameters across all functions. Ensure that the xml options are passed into both functions in prep for future work. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
908701c64a
commit
92d412149c
@ -495,7 +495,7 @@ bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
if (!caps)
|
if (!caps)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainDefFormat(vm->def, caps,
|
ret = virDomainDefFormat(vm->def, privconn->xmlopt, caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
@ -1583,7 +1583,7 @@ bhyveConnectDomainXMLFromNative(virConnectPtr conn,
|
|||||||
if (def == NULL)
|
if (def == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, capabilities, 0);
|
xml = virDomainDefFormat(def, privconn->xmlopt, capabilities, 0);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(capabilities);
|
virObjectUnref(capabilities);
|
||||||
|
@ -489,8 +489,8 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN) &&
|
if (!(flags & VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN) &&
|
||||||
virDomainDefFormatInternal(def->parent.dom, caps, domainflags, buf,
|
virDomainDefFormatInternal(def->parent.dom, xmlopt,
|
||||||
xmlopt) < 0)
|
caps, buf, domainflags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
|
@ -23648,8 +23648,8 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
|
|||||||
error:
|
error:
|
||||||
virErrorPreserveLast(&err);
|
virErrorPreserveLast(&err);
|
||||||
|
|
||||||
strSrc = virDomainDefFormat(src, NULL, 0);
|
strSrc = virDomainDefFormat(src, xmlopt, NULL, 0);
|
||||||
strDst = virDomainDefFormat(dst, NULL, 0);
|
strDst = virDomainDefFormat(dst, xmlopt, NULL, 0);
|
||||||
VIR_DEBUG("XMLs that failed stability check were: src=\"%s\", dst=\"%s\"",
|
VIR_DEBUG("XMLs that failed stability check were: src=\"%s\", dst=\"%s\"",
|
||||||
NULLSTR(strSrc), NULLSTR(strDst));
|
NULLSTR(strSrc), NULLSTR(strDst));
|
||||||
|
|
||||||
@ -28334,13 +28334,13 @@ virDomainDefFormatFeatures(virBufferPtr buf,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainDefFormatInternal(virDomainDefPtr def,
|
virDomainDefFormatInternal(virDomainDefPtr def,
|
||||||
|
virDomainXMLOptionPtr xmlopt,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
unsigned int flags,
|
|
||||||
virBufferPtr buf,
|
virBufferPtr buf,
|
||||||
virDomainXMLOptionPtr xmlopt)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
return virDomainDefFormatInternalSetRootName(def, caps, flags, buf,
|
return virDomainDefFormatInternalSetRootName(def, xmlopt, caps, buf,
|
||||||
xmlopt, "domain");
|
"domain", flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28350,11 +28350,11 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
* Return -1 on failure. */
|
* Return -1 on failure. */
|
||||||
int
|
int
|
||||||
virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
|
virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
|
||||||
virCapsPtr caps,
|
|
||||||
unsigned int flags,
|
|
||||||
virBufferPtr buf,
|
|
||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
const char *rootname)
|
virCapsPtr caps,
|
||||||
|
virBufferPtr buf,
|
||||||
|
const char *rootname,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
unsigned char *uuid;
|
unsigned char *uuid;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
@ -28891,12 +28891,15 @@ unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags)
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags)
|
virDomainDefFormat(virDomainDefPtr def,
|
||||||
|
virDomainXMLOptionPtr xmlopt,
|
||||||
|
virCapsPtr caps,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
||||||
if (virDomainDefFormatInternal(def, caps, flags, &buf, NULL) < 0)
|
if (virDomainDefFormatInternal(def, xmlopt, caps, &buf, flags) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
@ -28904,8 +28907,8 @@ virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags)
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
|
virDomainObjFormat(virDomainObjPtr obj,
|
||||||
virDomainObjPtr obj,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
@ -28931,7 +28934,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
|
|||||||
xmlopt->privateData.format(&buf, obj) < 0)
|
xmlopt->privateData.format(&buf, obj) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (virDomainDefFormatInternal(obj->def, caps, flags, &buf, xmlopt) < 0)
|
if (virDomainDefFormatInternal(obj->def, xmlopt, caps, &buf, flags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
virBufferAdjustIndent(&buf, -2);
|
virBufferAdjustIndent(&buf, -2);
|
||||||
@ -29091,13 +29094,13 @@ virDomainDefSaveXML(virDomainDefPtr def,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainDefSave(virDomainDefPtr def,
|
virDomainDefSave(virDomainDefPtr def,
|
||||||
virDomainXMLOptionPtr xmlopt G_GNUC_UNUSED,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
const char *configDir)
|
const char *configDir)
|
||||||
{
|
{
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
if (!(xml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
if (!(xml = virDomainDefFormat(def, xmlopt, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return virDomainDefSaveXML(def, configDir, xml);
|
return virDomainDefSaveXML(def, configDir, xml);
|
||||||
@ -29117,7 +29120,7 @@ virDomainObjSave(virDomainObjPtr obj,
|
|||||||
|
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
if (!(xml = virDomainObjFormat(xmlopt, obj, caps, flags)))
|
if (!(xml = virDomainObjFormat(obj, xmlopt, caps, flags)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return virDomainDefSaveXML(obj->def, statusDir, xml);
|
return virDomainDefSaveXML(obj->def, statusDir, xml);
|
||||||
@ -29421,7 +29424,7 @@ virDomainDefCopy(virDomainDefPtr src,
|
|||||||
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
||||||
|
|
||||||
/* Easiest to clone via a round-trip through XML. */
|
/* Easiest to clone via a round-trip through XML. */
|
||||||
if (!(xml = virDomainDefFormat(src, caps, format_flags)))
|
if (!(xml = virDomainDefFormat(src, xmlopt, caps, format_flags)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return virDomainDefParseString(xml, caps, xmlopt, parseOpaque, parse_flags);
|
return virDomainDefParseString(xml, caps, xmlopt, parseOpaque, parse_flags);
|
||||||
|
@ -3104,23 +3104,33 @@ void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id);
|
|||||||
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
|
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
|
||||||
|
|
||||||
char *virDomainDefFormat(virDomainDefPtr def,
|
char *virDomainDefFormat(virDomainDefPtr def,
|
||||||
virCapsPtr caps,
|
|
||||||
unsigned int flags);
|
|
||||||
char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
|
|
||||||
virDomainObjPtr obj,
|
|
||||||
virCapsPtr caps,
|
|
||||||
unsigned int flags);
|
|
||||||
int virDomainDefFormatInternal(virDomainDefPtr def,
|
|
||||||
virCapsPtr caps,
|
|
||||||
unsigned int flags,
|
|
||||||
virBufferPtr buf,
|
|
||||||
virDomainXMLOptionPtr xmlopt);
|
|
||||||
int virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
|
|
||||||
virCapsPtr caps,
|
|
||||||
unsigned int flags,
|
|
||||||
virBufferPtr buf,
|
|
||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
const char *rootname);
|
virCapsPtr caps,
|
||||||
|
unsigned int flags)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
||||||
|
ATTRIBUTE_NONNULL(3);
|
||||||
|
char *virDomainObjFormat(virDomainObjPtr obj,
|
||||||
|
virDomainXMLOptionPtr xmlopt,
|
||||||
|
virCapsPtr caps,
|
||||||
|
unsigned int flags)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
||||||
|
ATTRIBUTE_NONNULL(3);
|
||||||
|
int virDomainDefFormatInternal(virDomainDefPtr def,
|
||||||
|
virDomainXMLOptionPtr xmlopt,
|
||||||
|
virCapsPtr caps,
|
||||||
|
virBufferPtr buf,
|
||||||
|
unsigned int flags)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
||||||
|
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||||
|
int virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
|
||||||
|
virDomainXMLOptionPtr xmlopt,
|
||||||
|
virCapsPtr caps,
|
||||||
|
virBufferPtr buf,
|
||||||
|
const char *rootname,
|
||||||
|
unsigned int flags)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
||||||
|
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
|
||||||
|
ATTRIBUTE_NONNULL(5);
|
||||||
|
|
||||||
int virDomainDiskSourceFormat(virBufferPtr buf,
|
int virDomainDiskSourceFormat(virBufferPtr buf,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
|
@ -891,8 +891,8 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->parent.dom) {
|
if (def->parent.dom) {
|
||||||
if (virDomainDefFormatInternal(def->parent.dom, caps, domainflags, buf,
|
if (virDomainDefFormatInternal(def->parent.dom, xmlopt,
|
||||||
xmlopt) < 0)
|
caps, buf, domainflags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else if (uuidstr) {
|
} else if (uuidstr) {
|
||||||
virBufferAddLit(buf, "<domain>\n");
|
virBufferAddLit(buf, "<domain>\n");
|
||||||
@ -903,9 +903,9 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->parent.inactiveDom) {
|
if (def->parent.inactiveDom) {
|
||||||
if (virDomainDefFormatInternalSetRootName(def->parent.inactiveDom, caps,
|
if (virDomainDefFormatInternalSetRootName(def->parent.inactiveDom, xmlopt,
|
||||||
domainflags, buf, xmlopt,
|
caps, buf, "inactiveDomain",
|
||||||
"inactiveDomain") < 0)
|
domainflags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2648,7 +2648,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff)
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff)
|
||||||
def->id = id;
|
def->id = id;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, priv->caps,
|
xml = virDomainDefFormat(def, priv->xmlopt, priv->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2706,7 +2706,7 @@ esxConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
|||||||
def = virVMXParseConfig(&ctx, priv->xmlopt, priv->caps, nativeConfig);
|
def = virVMXParseConfig(&ctx, priv->xmlopt, priv->caps, nativeConfig);
|
||||||
|
|
||||||
if (def)
|
if (def)
|
||||||
xml = virDomainDefFormat(def, priv->caps,
|
xml = virDomainDefFormat(def, priv->xmlopt, priv->caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||||
|
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
@ -886,7 +886,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
/* FIXME: devices section is totally missing */
|
/* FIXME: devices section is totally missing */
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, NULL,
|
/* XXX xmlopts must be non-NULL */
|
||||||
|
xml = virDomainDefFormat(def, NULL, NULL,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -844,7 +844,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
|
|||||||
|
|
||||||
/* now that we know it's stopped call the hook if present */
|
/* now that we know it's stopped call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
ignore_value(virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
ignore_value(virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
||||||
@ -913,7 +913,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
|
|||||||
|
|
||||||
/* The "release" hook cleans up additional resources */
|
/* The "release" hook cleans up additional resources */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
ignore_value(virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
ignore_value(virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
||||||
@ -1320,7 +1320,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
|
|||||||
|
|
||||||
/* Run an early hook to set-up missing devices */
|
/* Run an early hook to set-up missing devices */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
||||||
@ -1358,7 +1358,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
|
|||||||
|
|
||||||
/* now that we know it is about to start call the hook if present */
|
/* now that we know it is about to start call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
||||||
@ -1443,7 +1443,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
|
|||||||
libxlDomainCreateChannelPTY(vm->def, cfg->ctx);
|
libxlDomainCreateChannelPTY(vm->def, cfg->ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((dom_xml = virDomainDefFormat(vm->def, cfg->caps, 0)) == NULL)
|
if ((dom_xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0)) == NULL)
|
||||||
goto destroy_dom;
|
goto destroy_dom;
|
||||||
|
|
||||||
if (libxl_userdata_store(cfg->ctx, domid, "libvirt-xml",
|
if (libxl_userdata_store(cfg->ctx, domid, "libvirt-xml",
|
||||||
@ -1471,7 +1471,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
|
|||||||
|
|
||||||
/* finally we can call the 'started' hook script if any */
|
/* finally we can call the 'started' hook script if any */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name,
|
||||||
|
@ -459,7 +459,7 @@ libxlReconnectDomain(virDomainObjPtr vm,
|
|||||||
/* now that we know it's reconnected call the hook if present */
|
/* now that we know it's reconnected call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL) &&
|
if (virHookPresent(VIR_HOOK_DRIVER_LIBXL) &&
|
||||||
STRNEQ("Domain-0", vm->def->name)) {
|
STRNEQ("Domain-0", vm->def->name)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, cfg->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
@ -1828,7 +1828,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xml = virDomainDefFormat(vm->def, cfg->caps, 0)) == NULL)
|
if ((xml = virDomainDefFormat(vm->def, driver->xmlopt, cfg->caps, 0)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
xml_len = strlen(xml) + 1;
|
xml_len = strlen(xml) + 1;
|
||||||
|
|
||||||
@ -2652,7 +2652,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
else
|
else
|
||||||
def = vm->def;
|
def = vm->def;
|
||||||
|
|
||||||
ret = virDomainDefFormat(def, cfg->caps,
|
ret = virDomainDefFormat(def, driver->xmlopt, cfg->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -2703,7 +2703,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, cfg->caps, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
xml = virDomainDefFormat(def, driver->xmlopt, cfg->caps, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
@ -420,7 +420,7 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn,
|
|||||||
if (!libxlDomainMigrationIsAllowed(def))
|
if (!libxlDomainMigrationIsAllowed(def))
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, cfg->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
xml = virDomainDefFormat(def, driver->xmlopt, cfg->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
/* Valid xml means success! EndJob in the confirm phase */
|
/* Valid xml means success! EndJob in the confirm phase */
|
||||||
if (xml)
|
if (xml)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -494,7 +494,7 @@ libxlDomainMigrationPrepareAny(virConnectPtr dconn,
|
|||||||
char *xml;
|
char *xml;
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
if (!(xml = virDomainDefFormat(*def, cfg->caps,
|
if (!(xml = virDomainDefFormat(*def, driver->xmlopt, cfg->caps,
|
||||||
VIR_DOMAIN_XML_SECURE |
|
VIR_DOMAIN_XML_SECURE |
|
||||||
VIR_DOMAIN_XML_MIGRATABLE)))
|
VIR_DOMAIN_XML_MIGRATABLE)))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -987,7 +987,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
|
|||||||
|
|
||||||
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) &&
|
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||||
vm->newDef ? vm->newDef : vm->def,
|
vm->newDef ? vm->newDef : vm->def,
|
||||||
driver->caps,
|
driver->xmlopt, driver->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -1019,7 +1019,7 @@ static char *lxcConnectDomainXMLFromNative(virConnectPtr conn,
|
|||||||
if (!(def = lxcParseConfigString(nativeConfig, caps, driver->xmlopt)))
|
if (!(def = lxcParseConfigString(nativeConfig, caps, driver->xmlopt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, caps, 0);
|
xml = virDomainDefFormat(def, driver->xmlopt, caps, 0);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
|
@ -171,7 +171,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
|||||||
|
|
||||||
/* now that we know it's stopped call the hook if present */
|
/* now that we know it's stopped call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||||
@ -248,7 +248,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
|||||||
|
|
||||||
/* The "release" hook cleans up additional resources */
|
/* The "release" hook cleans up additional resources */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||||
@ -1271,7 +1271,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
|||||||
|
|
||||||
/* Run an early hook to set-up missing devices */
|
/* Run an early hook to set-up missing devices */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||||
@ -1379,7 +1379,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
|||||||
|
|
||||||
/* now that we know it is about to start call the hook if present */
|
/* now that we know it is about to start call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||||
@ -1521,7 +1521,7 @@ int virLXCProcessStart(virConnectPtr conn,
|
|||||||
|
|
||||||
/* finally we can call the 'started' hook script if any */
|
/* finally we can call the 'started' hook script if any */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
hookret = virHookCall(VIR_HOOK_DRIVER_LXC, vm->def->name,
|
||||||
@ -1701,7 +1701,7 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
|
|||||||
|
|
||||||
/* now that we know it's reconnected call the hook if present */
|
/* now that we know it's reconnected call the hook if present */
|
||||||
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
|
||||||
char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
|
char *xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps, 0);
|
||||||
int hookret;
|
int hookret;
|
||||||
|
|
||||||
/* we can't stop the operation even if the script raised an error */
|
/* we can't stop the operation even if the script raised an error */
|
||||||
|
@ -1078,3 +1078,58 @@ int openvzGetVEID(const char *name)
|
|||||||
_("Failed to parse vzlist output"));
|
_("Failed to parse vzlist output"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
openvzDomainDefPostParse(virDomainDefPtr def,
|
||||||
|
virCapsPtr caps G_GNUC_UNUSED,
|
||||||
|
unsigned int parseFlags G_GNUC_UNUSED,
|
||||||
|
void *opaque G_GNUC_UNUSED,
|
||||||
|
void *parseOpaque G_GNUC_UNUSED)
|
||||||
|
{
|
||||||
|
/* fill the init path */
|
||||||
|
if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init)
|
||||||
|
def->os.init = g_strdup("/sbin/init");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||||
|
const virDomainDef *def G_GNUC_UNUSED,
|
||||||
|
virCapsPtr caps G_GNUC_UNUSED,
|
||||||
|
unsigned int parseFlags G_GNUC_UNUSED,
|
||||||
|
void *opaque G_GNUC_UNUSED,
|
||||||
|
void *parseOpaque G_GNUC_UNUSED)
|
||||||
|
{
|
||||||
|
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
|
||||||
|
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||||
|
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
|
||||||
|
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
|
||||||
|
|
||||||
|
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
||||||
|
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
||||||
|
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("hostdev mode 'capabilities' is not "
|
||||||
|
"supported in %s"),
|
||||||
|
virDomainVirtTypeToString(def->virtType));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virDomainDefParserConfig openvzDomainDefParserConfig = {
|
||||||
|
.domainPostParseCallback = openvzDomainDefPostParse,
|
||||||
|
.devicesPostParseCallback = openvzDomainDeviceDefPostParse,
|
||||||
|
.features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH,
|
||||||
|
};
|
||||||
|
|
||||||
|
virDomainXMLOptionPtr openvzXMLOption(void)
|
||||||
|
{
|
||||||
|
return virDomainXMLOptionNew(&openvzDomainDefParserConfig,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
@ -63,3 +63,4 @@ int strtoI(const char *str);
|
|||||||
int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
|
int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
|
||||||
int openvzGetVEID(const char *name);
|
int openvzGetVEID(const char *name);
|
||||||
int openvzReadNetworkConf(virDomainDefPtr def, int veid);
|
int openvzReadNetworkConf(virDomainDefPtr def, int veid);
|
||||||
|
virDomainXMLOptionPtr openvzXMLOption(void);
|
||||||
|
@ -110,55 +110,6 @@ openvzDomObjFromDomain(struct openvz_driver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
openvzDomainDefPostParse(virDomainDefPtr def,
|
|
||||||
virCapsPtr caps G_GNUC_UNUSED,
|
|
||||||
unsigned int parseFlags G_GNUC_UNUSED,
|
|
||||||
void *opaque G_GNUC_UNUSED,
|
|
||||||
void *parseOpaque G_GNUC_UNUSED)
|
|
||||||
{
|
|
||||||
/* fill the init path */
|
|
||||||
if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init)
|
|
||||||
def->os.init = g_strdup("/sbin/init");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
||||||
const virDomainDef *def G_GNUC_UNUSED,
|
|
||||||
virCapsPtr caps G_GNUC_UNUSED,
|
|
||||||
unsigned int parseFlags G_GNUC_UNUSED,
|
|
||||||
void *opaque G_GNUC_UNUSED,
|
|
||||||
void *parseOpaque G_GNUC_UNUSED)
|
|
||||||
{
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
|
|
||||||
dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
|
||||||
dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
|
|
||||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ;
|
|
||||||
|
|
||||||
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
|
||||||
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("hostdev mode 'capabilities' is not "
|
|
||||||
"supported in %s"),
|
|
||||||
virDomainVirtTypeToString(def->virtType));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virDomainDefParserConfig openvzDomainDefParserConfig = {
|
|
||||||
.domainPostParseCallback = openvzDomainDefPostParse,
|
|
||||||
.devicesPostParseCallback = openvzDomainDeviceDefPostParse,
|
|
||||||
.features = VIR_DOMAIN_DEF_FEATURE_NAME_SLASH,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* generate arguments to create OpenVZ container
|
/* generate arguments to create OpenVZ container
|
||||||
return -1 - error
|
return -1 - error
|
||||||
0 - OK
|
0 - OK
|
||||||
@ -522,7 +473,7 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
|||||||
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
|
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = virDomainDefFormat(vm->def, driver->caps,
|
ret = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -1360,8 +1311,7 @@ static virDrvOpenStatus openvzConnectOpen(virConnectPtr conn,
|
|||||||
if (!(driver->caps = openvzCapsInit()))
|
if (!(driver->caps = openvzCapsInit()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(driver->xmlopt = virDomainXMLOptionNew(&openvzDomainDefParserConfig,
|
if (!(driver->xmlopt = openvzXMLOption()))
|
||||||
NULL, NULL, NULL, NULL)))
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (openvzLoadDomains(driver) < 0)
|
if (openvzLoadDomains(driver) < 0)
|
||||||
@ -2117,7 +2067,7 @@ openvzDomainMigrateBegin3Params(virDomainPtr domain,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml = virDomainDefFormat(vm->def, driver->caps,
|
xml = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -3247,7 +3247,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
if (virDomainDefSetVcpus(&def, vcpus) < 0)
|
if (virDomainDefSetVcpus(&def, vcpus) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
return virDomainDefFormat(&def, phyp_driver->caps,
|
return virDomainDefFormat(&def, phyp_driver->xmlopt, phyp_driver->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
@ -9197,9 +9197,8 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
format:
|
format:
|
||||||
ret = virDomainDefFormatInternal(def, caps,
|
ret = virDomainDefFormatInternal(def, driver->xmlopt, caps, buf,
|
||||||
virDomainDefFormatConvertXMLFlags(flags),
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
buf, driver->xmlopt);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDefFree(copy);
|
virDomainDefFree(copy);
|
||||||
|
@ -168,7 +168,7 @@ load_profile(virSecurityManagerPtr mgr G_GNUC_UNUSED,
|
|||||||
char *xml = NULL;
|
char *xml = NULL;
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
xml = virDomainDefFormat(def, NULL, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
if (!xml)
|
if (!xml)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -2177,7 +2177,8 @@ testDomainSaveImageWrite(testDriverPtr driver,
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, driver->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
xml = virDomainDefFormat(def, driver->xmlopt, driver->caps,
|
||||||
|
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
|
|
||||||
if (xml == NULL) {
|
if (xml == NULL) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
@ -2466,7 +2467,8 @@ testDomainSaveImageGetXMLDesc(virConnectPtr conn,
|
|||||||
if ((fd = testDomainSaveImageOpen(privconn, path, &def)) < 0)
|
if ((fd = testDomainSaveImageOpen(privconn, path, &def)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainDefFormat(def, privconn->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
ret = virDomainDefFormat(def, privconn->xmlopt, privconn->caps,
|
||||||
|
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
@ -3177,7 +3179,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||||
privdom->newDef ? privdom->newDef : privdom->def;
|
privdom->newDef ? privdom->newDef : privdom->def;
|
||||||
|
|
||||||
ret = virDomainDefFormat(def, privconn->caps,
|
ret = virDomainDefFormat(def, privconn->xmlopt, privconn->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
virDomainObjEndAPI(&privdom);
|
virDomainObjEndAPI(&privdom);
|
||||||
|
@ -4126,7 +4126,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
/* dump USB devices/filters if active */
|
/* dump USB devices/filters if active */
|
||||||
vboxHostDeviceGetXMLDesc(data, def, machine);
|
vboxHostDeviceGetXMLDesc(data, def, machine);
|
||||||
|
|
||||||
ret = virDomainDefFormat(def, data->caps,
|
ret = virDomainDefFormat(def, data->xmlopt, data->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -935,7 +935,7 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
if (!(vm = vmwareDomObjFromDomain(driver, dom->uuid)))
|
if (!(vm = vmwareDomObjFromDomain(driver, dom->uuid)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = virDomainDefFormat(vm->def, driver->caps,
|
ret = virDomainDefFormat(vm->def, driver->xmlopt, driver->caps,
|
||||||
virDomainDefFormatConvertXMLFlags(flags));
|
virDomainDefFormatConvertXMLFlags(flags));
|
||||||
|
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
@ -968,7 +968,7 @@ vmwareConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
|||||||
def = virVMXParseConfig(&ctx, driver->xmlopt, driver->caps, nativeConfig);
|
def = virVMXParseConfig(&ctx, driver->xmlopt, driver->caps, nativeConfig);
|
||||||
|
|
||||||
if (def != NULL)
|
if (def != NULL)
|
||||||
xml = virDomainDefFormat(def, driver->caps,
|
xml = virDomainDefFormat(def, driver->xmlopt, driver->caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||||
|
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
@ -728,7 +728,7 @@ vzDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
def = (flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||||
dom->newDef ? dom->newDef : dom->def;
|
dom->newDef ? dom->newDef : dom->def;
|
||||||
|
|
||||||
ret = virDomainDefFormat(def, privconn->driver->caps, flags);
|
ret = virDomainDefFormat(def, driver->xmlopt, privconn->driver->caps, flags);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&dom);
|
virDomainObjEndAPI(&dom);
|
||||||
@ -2872,7 +2872,7 @@ vzDomainMigrateBeginStep(virDomainObjPtr dom,
|
|||||||
| VZ_MIGRATION_COOKIE_DOMAIN_NAME) < 0)
|
| VZ_MIGRATION_COOKIE_DOMAIN_NAME) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return virDomainDefFormat(dom->def, driver->caps,
|
return virDomainDefFormat(dom->def, driver->xmlopt, driver->caps,
|
||||||
VIR_DOMAIN_XML_MIGRATABLE);
|
VIR_DOMAIN_XML_MIGRATABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,7 +749,8 @@ if WITH_OPENVZ
|
|||||||
openvzutilstest_SOURCES = \
|
openvzutilstest_SOURCES = \
|
||||||
openvzutilstest.c \
|
openvzutilstest.c \
|
||||||
testutils.c testutils.h
|
testutils.c testutils.h
|
||||||
openvzutilstest_LDADD = $(LDADDS)
|
openvzutilstest_LDADD = $(LDADDS) \
|
||||||
|
../src/libvirt_driver_openvz.la
|
||||||
else ! WITH_OPENVZ
|
else ! WITH_OPENVZ
|
||||||
EXTRA_DIST += openvzutilstest.c
|
EXTRA_DIST += openvzutilstest.c
|
||||||
endif ! WITH_OPENVZ
|
endif ! WITH_OPENVZ
|
||||||
|
@ -42,7 +42,7 @@ testCompareXMLToConfigFiles(const char *xmlfile,
|
|||||||
if (testSanitizeDef(vmdef) < 0)
|
if (testSanitizeDef(vmdef) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(actualxml = virDomainDefFormat(vmdef, caps, 0)))
|
if (!(actualxml = virDomainDefFormat(vmdef, xmlopt, caps, 0)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virTestCompareToFile(actualxml, xmlfile) < 0)
|
if (virTestCompareToFile(actualxml, xmlfile) < 0)
|
||||||
|
@ -98,6 +98,7 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED)
|
|||||||
" </interface>\n"
|
" </interface>\n"
|
||||||
" </devices>\n"
|
" </devices>\n"
|
||||||
"</domain>\n";
|
"</domain>\n";
|
||||||
|
virDomainXMLOptionPtr xmlopt = openvzXMLOption();
|
||||||
|
|
||||||
if (!(def = virDomainDefNew()))
|
if (!(def = virDomainDefNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -112,7 +113,7 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
actual = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
actual = virDomainDefFormat(def, xmlopt, NULL, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||||
|
|
||||||
if (actual == NULL) {
|
if (actual == NULL) {
|
||||||
fprintf(stderr, "ERROR: %s\n", virGetLastErrorMessage());
|
fprintf(stderr, "ERROR: %s\n", virGetLastErrorMessage());
|
||||||
@ -127,6 +128,7 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED)
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
virObjectUnref(xmlopt);
|
||||||
VIR_FREE(actual);
|
VIR_FREE(actual);
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ testQemuHotplugCheckResult(virDomainObjPtr vm,
|
|||||||
char *actual;
|
char *actual;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
actual = virDomainDefFormat(vm->def, driver.caps,
|
actual = virDomainDefFormat(vm->def, driver.xmlopt, driver.caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||||
if (!actual)
|
if (!actual)
|
||||||
return -1;
|
return -1;
|
||||||
@ -466,7 +466,7 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuData *data)
|
|||||||
char *configXML = NULL;
|
char *configXML = NULL;
|
||||||
|
|
||||||
if (data->file_xml_res_live) {
|
if (data->file_xml_res_live) {
|
||||||
if (!(activeXML = virDomainDefFormat(data->vm->def, driver.caps,
|
if (!(activeXML = virDomainDefFormat(data->vm->def, driver.xmlopt, driver.caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data->file_xml_res_conf) {
|
if (data->file_xml_res_conf) {
|
||||||
if (!(configXML = virDomainDefFormat(data->vm->newDef, driver.caps,
|
if (!(configXML = virDomainDefFormat(data->vm->newDef, driver.xmlopt, driver.caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE |
|
VIR_DOMAIN_DEF_FORMAT_SECURE |
|
||||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -68,7 +68,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL,
|
if (!(actual = virDomainObjFormat(obj, driver.xmlopt, NULL,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE |
|
VIR_DOMAIN_DEF_FORMAT_SECURE |
|
||||||
VIR_DOMAIN_DEF_FORMAT_STATUS |
|
VIR_DOMAIN_DEF_FORMAT_STATUS |
|
||||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
||||||
|
@ -1140,7 +1140,7 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(actual = virDomainDefFormat(def, caps, format_flags))) {
|
if (!(actual = virDomainDefFormat(def, xmlopt, caps, format_flags))) {
|
||||||
result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_FORMAT;
|
result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ testCompareFiles(const char *vmx, const char *xml)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(formatted = virDomainDefFormat(def, caps,
|
if (!(formatted = virDomainDefFormat(def, xmlopt, caps,
|
||||||
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -146,7 +146,8 @@ testCompareFormatXML(const char *xlcfg, const char *xml, bool replaceVars)
|
|||||||
if (!(def = xenParseXL(conf, caps, xmlopt)))
|
if (!(def = xenParseXL(conf, caps, xmlopt)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_XML_INACTIVE |
|
if (!(gotxml = virDomainDefFormat(def, xmlopt, caps,
|
||||||
|
VIR_DOMAIN_XML_INACTIVE |
|
||||||
VIR_DOMAIN_XML_SECURE)))
|
VIR_DOMAIN_XML_SECURE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
|
|||||||
if (!(def = xenParseXM(conf, caps, xmlopt)))
|
if (!(def = xenParseXM(conf, caps, xmlopt)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
if (!(gotxml = virDomainDefFormat(def, xmlopt, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virTestCompareToFile(gotxml, xml) < 0)
|
if (virTestCompareToFile(gotxml, xml) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user