mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Give virDomainDef parser & formatter their own flags
The virDomainDefParse* and virDomainDefFormat* methods both accept the VIR_DOMAIN_XML_* flags defined in the public API, along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags defined in domain_conf.c. This is seriously confusing & error prone for a number of reasons: - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the formatting operation - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply to parse or to format, but not both. This patch cleanly separates out the flags. There are two distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_* flags that are used by the corresponding methods. The VIR_DOMAIN_XML_* flags received via public API calls must be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where needed. The various calls to virDomainDefParse which hardcoded the use of the VIR_DOMAIN_XML_INACTIVE flag change to use the VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
This commit is contained in:
parent
e34473c1da
commit
0ecd685109
@ -476,7 +476,8 @@ bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
if (virDomainGetXMLDescEnsureACL(domain->conn, vm->def, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat(vm->def, flags);
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -503,7 +504,7 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
|
||||
if ((def = virDomainDefParseString(xml, caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_BHYVE,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
@ -691,7 +692,7 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
|
||||
|
||||
if (!(def = virDomainDefParseString(xmlData, caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_BHYVE,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (bhyveDomainAssignAddresses(def, NULL) < 0)
|
||||
@ -902,7 +903,7 @@ bhyveDomainCreateXML(virConnectPtr conn,
|
||||
|
||||
if ((def = virDomainDefParseString(xml, caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_BHYVE,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLEnsureACL(conn, def) < 0)
|
||||
|
@ -86,39 +86,13 @@ struct _virDomainXMLOption {
|
||||
|
||||
/* XML namespace callbacks */
|
||||
virDomainXMLNamespace ns;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* Private flags used internally by virDomainSaveStatus and
|
||||
* virDomainLoadStatus, in addition to the public virDomainXMLFlags. */
|
||||
typedef enum {
|
||||
/* dump internal domain status information */
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS = 1 << 16,
|
||||
/* dump/parse <actual> element */
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET = 1 << 17,
|
||||
/* dump/parse original states of host PCI device */
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = 1 << 18,
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM = 1 << 19,
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT = 1 << 20,
|
||||
VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST = 1 << 21,
|
||||
/* parse only source half of <disk> */
|
||||
VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE = 1 << 22,
|
||||
} virDomainXMLInternalFlags;
|
||||
|
||||
#define DUMPXML_FLAGS \
|
||||
(VIR_DOMAIN_XML_SECURE | \
|
||||
VIR_DOMAIN_XML_INACTIVE | \
|
||||
VIR_DOMAIN_XML_UPDATE_CPU | \
|
||||
VIR_DOMAIN_XML_MIGRATABLE)
|
||||
|
||||
verify(((VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM |
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT |
|
||||
VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST |
|
||||
VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)
|
||||
& DUMPXML_FLAGS) == 0);
|
||||
#define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \
|
||||
(VIR_DOMAIN_DEF_FORMAT_SECURE | \
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE | \
|
||||
VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU | \
|
||||
VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)
|
||||
|
||||
VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
|
||||
"custom-argv",
|
||||
@ -800,9 +774,6 @@ VIR_ENUM_DECL(virDomainBlockJob)
|
||||
VIR_ENUM_IMPL(virDomainBlockJob, VIR_DOMAIN_BLOCK_JOB_TYPE_LAST,
|
||||
"", "", "copy", "", "active-commit")
|
||||
|
||||
#define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE
|
||||
#define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE
|
||||
|
||||
static virClassPtr virDomainObjClass;
|
||||
static virClassPtr virDomainObjListClass;
|
||||
static virClassPtr virDomainXMLOptionClass;
|
||||
@ -2724,11 +2695,11 @@ virDomainDeviceGetInfo(virDomainDeviceDefPtr device)
|
||||
}
|
||||
|
||||
static bool
|
||||
virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
|
||||
virDomainDeviceInfoNeedsFormat(virDomainDeviceInfoPtr info, unsigned int flags)
|
||||
{
|
||||
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||
return true;
|
||||
if (info->alias && !(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (info->alias && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))
|
||||
return true;
|
||||
if (info->mastertype != VIR_DOMAIN_CONTROLLER_MASTER_NONE)
|
||||
return true;
|
||||
@ -3384,11 +3355,11 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
virDomainDeviceInfoPtr info,
|
||||
unsigned int flags)
|
||||
{
|
||||
if ((flags & VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) && info->bootIndex)
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex)
|
||||
virBufferAsprintf(buf, "<boot order='%d'/>\n", info->bootIndex);
|
||||
|
||||
if (info->alias &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||
!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
|
||||
virBufferAsprintf(buf, "<alias name='%s'/>\n", info->alias);
|
||||
}
|
||||
|
||||
@ -3397,7 +3368,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->master.usb.startport);
|
||||
}
|
||||
|
||||
if ((flags & VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) &&
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) &&
|
||||
(info->rombar || info->romfile)) {
|
||||
|
||||
virBufferAddLit(buf, "<rom");
|
||||
@ -3881,7 +3852,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
||||
while (cur != NULL) {
|
||||
if (cur->type == XML_ELEMENT_NODE) {
|
||||
if (alias == NULL &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "alias")) {
|
||||
alias = cur;
|
||||
} else if (address == NULL &&
|
||||
@ -3891,11 +3862,11 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
||||
xmlStrEqual(cur->name, BAD_CAST "master")) {
|
||||
master = cur;
|
||||
} else if (boot == NULL &&
|
||||
(flags & VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) &&
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "boot")) {
|
||||
boot = cur;
|
||||
} else if (rom == NULL &&
|
||||
(flags & VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) &&
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "rom")) {
|
||||
rom = cur;
|
||||
}
|
||||
@ -4223,7 +4194,7 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node,
|
||||
|
||||
if (virDevicePCIAddressParseXML(cur, addr) < 0)
|
||||
goto out;
|
||||
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "state")) {
|
||||
/* Legacy back-compat. Don't add any more attributes here */
|
||||
char *devaddr = virXMLPropString(cur, "devaddr");
|
||||
@ -4237,7 +4208,7 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node,
|
||||
goto out;
|
||||
}
|
||||
def->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES) &&
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "origstates")) {
|
||||
virDomainHostdevOrigStatesPtr states = &def->origstates;
|
||||
if (virDomainHostdevSubsysPCIOrigStatesDefParseXML(cur, states) < 0)
|
||||
@ -5191,7 +5162,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
||||
* present. Hence, return now. */
|
||||
|
||||
if (STREQ_NULLABLE(seclabel->model, "none")) {
|
||||
if (flags & VIR_DOMAIN_XML_INACTIVE) {
|
||||
if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) {
|
||||
/* Fix older configurations */
|
||||
seclabel->type = VIR_DOMAIN_SECLABEL_NONE;
|
||||
seclabel->relabel = false;
|
||||
@ -5212,7 +5183,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
||||
* if the 'live' VM XML is requested
|
||||
*/
|
||||
if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC ||
|
||||
(!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
(!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
seclabel->type != VIR_DOMAIN_SECLABEL_NONE)) {
|
||||
p = virXPathStringLimit("string(./label[1])",
|
||||
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
|
||||
@ -5228,7 +5199,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
||||
|
||||
/* Only parse imagelabel, if requested live XML with relabeling */
|
||||
if (seclabel->relabel &&
|
||||
(!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
(!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
seclabel->type != VIR_DOMAIN_SECLABEL_NONE)) {
|
||||
p = virXPathStringLimit("string(./imagelabel[1])",
|
||||
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
|
||||
@ -5319,7 +5290,7 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
|
||||
if (def->seclabels[0]->type == VIR_DOMAIN_SECLABEL_NONE ||
|
||||
(def->seclabels[0]->type == VIR_DOMAIN_SECLABEL_DYNAMIC &&
|
||||
!def->seclabels[0]->baselabel &&
|
||||
(flags & VIR_DOMAIN_XML_INACTIVE))) {
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
|
||||
/* Copy model from host. */
|
||||
VIR_DEBUG("Found seclabel without a model, using '%s'",
|
||||
host->secModels[0].model);
|
||||
@ -5327,7 +5298,7 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
|
||||
goto error;
|
||||
|
||||
if (STREQ(def->seclabels[0]->model, "none") &&
|
||||
flags & VIR_DOMAIN_XML_INACTIVE) {
|
||||
flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) {
|
||||
/* Fix older configurations */
|
||||
def->seclabels[0]->type = VIR_DOMAIN_SECLABEL_NONE;
|
||||
def->seclabels[0]->relabel = false;
|
||||
@ -5435,7 +5406,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
|
||||
/* labelskip is only parsed on live images */
|
||||
labelskip = virXMLPropString(list[i], "labelskip");
|
||||
seclabels[i]->labelskip = false;
|
||||
if (labelskip && !(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (labelskip && !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
|
||||
seclabels[i]->labelskip = STREQ(labelskip, "yes");
|
||||
VIR_FREE(labelskip);
|
||||
|
||||
@ -5941,7 +5912,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
driverIOThread = virXMLPropString(cur, "iothread");
|
||||
} else if (!def->mirror &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "mirror") &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
|
||||
char *ready;
|
||||
char *blockJob;
|
||||
|
||||
@ -6194,7 +6165,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->src->shared = true;
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "transient")) {
|
||||
def->transient = true;
|
||||
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "state")) {
|
||||
/* Legacy back-compat. Don't add any more attributes here */
|
||||
devaddr = virXMLPropString(cur, "devaddr");
|
||||
@ -6273,7 +6244,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
* that are not attached to a physical device presently */
|
||||
if (source == NULL && def->src->hosts == NULL && !def->src->srcpool &&
|
||||
(def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||
(flags & VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE))) {
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE))) {
|
||||
virReportError(VIR_ERR_NO_SOURCE,
|
||||
target ? "%s" : NULL, target);
|
||||
goto error;
|
||||
@ -6293,7 +6264,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
ctxt->node = saved_node;
|
||||
}
|
||||
|
||||
if (!target && !(flags & VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)) {
|
||||
if (!target && !(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
|
||||
if (def->src->srcpool) {
|
||||
char *tmp;
|
||||
if (virAsprintf(&tmp, "pool = '%s', volume = '%s'",
|
||||
@ -6308,7 +6279,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(flags & VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)) {
|
||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
!STRPREFIX(target, "fd")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -6379,7 +6350,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
} else {
|
||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_FDC;
|
||||
} else if (!(flags & VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)) {
|
||||
} else if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
|
||||
if (STRPREFIX(target, "hd"))
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||
else if (STRPREFIX(target, "sd"))
|
||||
@ -6553,7 +6524,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
} else {
|
||||
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
|
||||
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -6613,7 +6584,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)) {
|
||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
|
||||
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE
|
||||
&& virDomainDiskDefAssignAddress(xmlopt, def) < 0)
|
||||
goto error;
|
||||
@ -7564,7 +7535,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
xmlStrEqual(cur->name, BAD_CAST "target")) {
|
||||
ifname = virXMLPropString(cur, "dev");
|
||||
if (ifname &&
|
||||
(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX)) {
|
||||
/* An auto-generated target name, blank it out */
|
||||
VIR_FREE(ifname);
|
||||
@ -7597,14 +7568,14 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
filter = virXMLPropString(cur, "filter");
|
||||
virNWFilterHashTableFree(filterparams);
|
||||
filterparams = virNWFilterParseParamAttributes(cur);
|
||||
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "state")) {
|
||||
/* Legacy back-compat. Don't add any more attributes here */
|
||||
devaddr = virXMLPropString(cur, "devaddr");
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "boot")) {
|
||||
/* boot is parsed as part of virDomainDeviceInfoParseXML */
|
||||
} else if (!actual &&
|
||||
(flags & VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET) &&
|
||||
(flags & VIR_DOMAIN_DEF_PARSE_ACTUAL_NET) &&
|
||||
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "actual")) {
|
||||
if (virDomainActualNetDefParseXML(cur, ctxt, def,
|
||||
@ -7661,8 +7632,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
} else {
|
||||
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
|
||||
| VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
|
||||
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
|
||||
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -7835,7 +7806,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->data.direct.linkdev = dev;
|
||||
dev = NULL;
|
||||
|
||||
if (flags & VIR_DOMAIN_XML_INACTIVE)
|
||||
if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
|
||||
VIR_FREE(ifname);
|
||||
|
||||
break;
|
||||
@ -8274,7 +8245,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
|
||||
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
|
||||
def->target.name = virXMLPropString(cur, "name");
|
||||
|
||||
if (!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
||||
(stateStr = virXMLPropString(cur, "state"))) {
|
||||
int tmp;
|
||||
|
||||
@ -8363,7 +8334,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
|
||||
/* PTY path is only parsed from live xml. */
|
||||
if (!path &&
|
||||
(def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)))
|
||||
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
path = virXMLPropString(cur, "path");
|
||||
|
||||
break;
|
||||
@ -9363,7 +9334,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
|
||||
if (address && address[0] &&
|
||||
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
|
||||
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)))) {
|
||||
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)))) {
|
||||
def->address = address;
|
||||
address = NULL;
|
||||
}
|
||||
@ -9381,7 +9352,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
|
||||
}
|
||||
|
||||
if (fromConfig &&
|
||||
flags & VIR_DOMAIN_XML_INTERNAL_STATUS) {
|
||||
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
|
||||
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid fromConfig value: %s"),
|
||||
@ -9520,7 +9491,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
VIR_FREE(port);
|
||||
/* Legacy compat syntax, used -1 for auto-port */
|
||||
if (def->data.vnc.port == -1) {
|
||||
if (flags & VIR_DOMAIN_XML_INACTIVE)
|
||||
if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
|
||||
def->data.vnc.port = 0;
|
||||
def->data.vnc.autoport = true;
|
||||
}
|
||||
@ -9531,7 +9502,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
|
||||
if ((autoport = virXMLPropString(node, "autoport")) != NULL) {
|
||||
if (STREQ(autoport, "yes")) {
|
||||
if (flags & VIR_DOMAIN_XML_INACTIVE)
|
||||
if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
|
||||
def->data.vnc.port = 0;
|
||||
def->data.vnc.autoport = true;
|
||||
}
|
||||
@ -9621,7 +9592,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
VIR_FREE(autoport);
|
||||
}
|
||||
|
||||
if (def->data.rdp.autoport && (flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (def->data.rdp.autoport && (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
|
||||
def->data.rdp.port = 0;
|
||||
|
||||
if ((replaceUser = virXMLPropString(node, "replaceUser")) != NULL) {
|
||||
@ -9714,7 +9685,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
def->data.spice.autoport = true;
|
||||
}
|
||||
|
||||
if (def->data.spice.autoport && (flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||
if (def->data.spice.autoport && (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
|
||||
def->data.spice.port = 0;
|
||||
def->data.spice.tlsPort = 0;
|
||||
}
|
||||
@ -10759,8 +10730,8 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
|
||||
if (def->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
if (virDomainDeviceInfoParseXML(node, bootHash, def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
|
||||
| VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
|
||||
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
|
||||
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -10854,7 +10825,7 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
|
||||
def->source.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
|
||||
|
||||
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
|
||||
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0)
|
||||
goto error;
|
||||
|
||||
if (def->bus == VIR_DOMAIN_REDIRDEV_BUS_USB &&
|
||||
@ -11293,7 +11264,7 @@ virDomainDiskDefSourceParse(const char *xmlStr,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
flags |= VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE;
|
||||
flags |= VIR_DOMAIN_DEF_PARSE_DISK_SOURCE;
|
||||
if (!(disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
|
||||
NULL, def->seclabels,
|
||||
def->nseclabels,
|
||||
@ -12652,6 +12623,7 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static virDomainDefPtr
|
||||
virDomainDefParseXML(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
@ -12678,7 +12650,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
|
||||
if (virXPathLong("string(./@id)", ctxt, &id) < 0)
|
||||
id = -1;
|
||||
def->id = (int)id;
|
||||
@ -16469,7 +16441,7 @@ virSecurityDeviceLabelDefFormat(virBufferPtr buf,
|
||||
{
|
||||
/* For offline output, skip elements that allow labels but have no
|
||||
* label specified (possible if labelskip was ignored on input). */
|
||||
if ((flags & VIR_DOMAIN_XML_INACTIVE) && !def->label && def->relabel)
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && !def->label && def->relabel)
|
||||
return;
|
||||
|
||||
virBufferAddLit(buf, "<seclabel");
|
||||
@ -16884,7 +16856,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
||||
|
||||
/* Don't format backingStore to inactive XMLs until the code for
|
||||
* persistent storage of backing chains is ready. */
|
||||
if (!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
||||
virDomainDiskBackingStoreFormat(buf, def->src->backingStore,
|
||||
def->src->backingStoreRaw, 1) < 0)
|
||||
return -1;
|
||||
@ -16898,7 +16870,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
||||
* the new style similar to backingStore, but for back-compat on
|
||||
* blockcopy files we also have to output old style attributes.
|
||||
* The parser accepts either style across libvirtd upgrades. */
|
||||
if (def->mirror && !(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||
if (def->mirror && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
|
||||
const char *formatStr = NULL;
|
||||
|
||||
if (def->mirror->format)
|
||||
@ -17041,7 +17013,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
||||
virStorageEncryptionFormat(buf, def->src->encryption) < 0)
|
||||
return -1;
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
|
||||
flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) < 0)
|
||||
return -1;
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
@ -17117,7 +17089,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
|
||||
}
|
||||
|
||||
if (def->queues || def->cmd_per_lun || def->max_sectors ||
|
||||
virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) {
|
||||
virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
|
||||
@ -17134,7 +17106,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
|
||||
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
|
||||
@ -17347,10 +17319,10 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
||||
policy = virDomainStartupPolicyTypeToString(def->startupPolicy);
|
||||
virBufferAsprintf(buf, " startupPolicy='%s'", policy);
|
||||
}
|
||||
if (usbsrc->autoAddress && (flags & VIR_DOMAIN_XML_MIGRATABLE))
|
||||
if (usbsrc->autoAddress && (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))
|
||||
virBufferAddLit(buf, " autoAddress='yes'");
|
||||
|
||||
if (def->missing && !(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (def->missing && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))
|
||||
virBufferAddLit(buf, " missing='yes'");
|
||||
}
|
||||
|
||||
@ -17384,7 +17356,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("PCI address Formatting failed"));
|
||||
|
||||
if ((flags & VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES) &&
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES) &&
|
||||
(def->origstates.states.pci.unbind_from_stub ||
|
||||
def->origstates.states.pci.remove_slot ||
|
||||
def->origstates.states.pci.reprobe)) {
|
||||
@ -17722,9 +17694,9 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
*/
|
||||
if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
|
||||
def->data.network.actual &&
|
||||
!(flags & (VIR_DOMAIN_XML_INACTIVE |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_MIGRATABLE)))
|
||||
!(flags & (VIR_DOMAIN_DEF_FORMAT_INACTIVE |
|
||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
||||
VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)))
|
||||
publicActual = true;
|
||||
|
||||
if (publicActual) {
|
||||
@ -17787,7 +17759,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
* as a subelement of <interface> so that no persistent config
|
||||
* data is overwritten.
|
||||
*/
|
||||
if ((flags & VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET) &&
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET) &&
|
||||
(virDomainActualNetDefFormat(buf, def, flags) < 0))
|
||||
return -1;
|
||||
break;
|
||||
@ -17865,7 +17837,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, "<script path='%s'/>\n",
|
||||
def->script);
|
||||
if (def->ifname &&
|
||||
!((flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
||||
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX)))) {
|
||||
/* Skip auto-generated target names for inactive config. */
|
||||
virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname);
|
||||
@ -17942,8 +17914,8 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
virDomainNetInterfaceLinkStateTypeToString(def->linkstate));
|
||||
}
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
|
||||
| VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
|
||||
flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT
|
||||
| VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0)
|
||||
return -1;
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
@ -17999,7 +17971,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
|
||||
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
||||
if (def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
|
||||
(def->data.file.path &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE))) {
|
||||
!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) {
|
||||
virBufferEscapeString(buf, "<source path='%s'",
|
||||
def->data.file.path);
|
||||
virDomainSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
|
||||
@ -18097,7 +18069,7 @@ virDomainChrDefFormat(virBufferPtr buf,
|
||||
tty_compat = (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||
def->target.port == 0 &&
|
||||
def->source.type == VIR_DOMAIN_CHR_TYPE_PTY &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
|
||||
def->source.data.file.path);
|
||||
if (virDomainChrSourceDefFormat(buf, def, &def->source, tty_compat, flags) < 0)
|
||||
return -1;
|
||||
@ -18136,7 +18108,7 @@ virDomainChrDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, " name='%s'", def->target.name);
|
||||
|
||||
if (def->state != VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
|
||||
virBufferAsprintf(buf, " state='%s'",
|
||||
virDomainChrDeviceStateTypeToString(def->state));
|
||||
}
|
||||
@ -18170,7 +18142,7 @@ virDomainChrDefFormat(virBufferPtr buf,
|
||||
break;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
}
|
||||
@ -18199,7 +18171,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
switch (def->type) {
|
||||
case VIR_DOMAIN_SMARTCARD_TYPE_HOST:
|
||||
if (!virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (!virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
return 0;
|
||||
@ -18275,7 +18247,7 @@ virDomainTPMDefFormat(virBufferPtr buf,
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</backend>\n");
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
}
|
||||
@ -18313,7 +18285,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
|
||||
virDomainSoundCodecDefFormat(buf, def->codecs[i]);
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
if (!children) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
@ -18351,7 +18323,7 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(buf, "<memballoon model='%s'", model);
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
@ -18381,7 +18353,7 @@ virDomainNVRAMDefFormat(virBufferPtr buf,
|
||||
{
|
||||
virBufferAddLit(buf, "<nvram>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
|
||||
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
|
||||
@ -18415,7 +18387,7 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(buf, "<watchdog model='%s' action='%s'",
|
||||
model, action);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
@ -18452,7 +18424,7 @@ virDomainShmemDefFormat(virBufferPtr buf,
|
||||
if (!def->size &&
|
||||
!def->server.enabled &&
|
||||
!def->msi.enabled &&
|
||||
!virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
!virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
return 0;
|
||||
} else {
|
||||
@ -18524,7 +18496,7 @@ virDomainRNGDefFormat(virBufferPtr buf,
|
||||
break;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
return -1;
|
||||
}
|
||||
@ -18634,7 +18606,7 @@ virDomainInputDefFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(buf, "<input type='%s' bus='%s'",
|
||||
type, bus);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
@ -18741,7 +18713,7 @@ virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf,
|
||||
if (!def->passwd)
|
||||
return;
|
||||
|
||||
if (flags & VIR_DOMAIN_XML_SECURE)
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_SECURE)
|
||||
virBufferEscapeString(buf, " passwd='%s'",
|
||||
def->passwd);
|
||||
|
||||
@ -18766,7 +18738,7 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
|
||||
{
|
||||
/* If generating migratable XML, skip listen address
|
||||
* dragged in from config file */
|
||||
if ((flags & VIR_DOMAIN_XML_MIGRATABLE) && def->fromConfig)
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) && def->fromConfig)
|
||||
return;
|
||||
|
||||
virBufferAddLit(buf, "<listen");
|
||||
@ -18778,7 +18750,7 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
|
||||
if (def->address &&
|
||||
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
|
||||
(def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
|
||||
!(flags & VIR_DOMAIN_XML_INACTIVE)))) {
|
||||
!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))) {
|
||||
/* address may also be set to show current status when type='network',
|
||||
* but we don't want to print that if INACTIVE data is requested. */
|
||||
virBufferAsprintf(buf, " address='%s'", def->address);
|
||||
@ -18789,7 +18761,7 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, " network='%s'", def->network);
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_XML_INTERNAL_STATUS)
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS)
|
||||
virBufferAsprintf(buf, " fromConfig='%d'", def->fromConfig);
|
||||
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
@ -18818,7 +18790,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
for (i = 0; i < def->nListens; i++) {
|
||||
if (virDomainGraphicsListenGetType(def, i)
|
||||
== VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
|
||||
if (flags & VIR_DOMAIN_XML_MIGRATABLE &&
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
|
||||
def->listens[i].fromConfig)
|
||||
continue;
|
||||
listenAddr = virDomainGraphicsListenGetAddress(def, i);
|
||||
@ -18836,7 +18808,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
def->data.vnc.socket);
|
||||
} else {
|
||||
if (def->data.vnc.port &&
|
||||
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_XML_INACTIVE)))
|
||||
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
||||
virBufferAsprintf(buf, " port='%d'",
|
||||
def->data.vnc.port);
|
||||
else if (def->data.vnc.autoport)
|
||||
@ -18940,7 +18912,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
if (virDomainGraphicsListenGetType(def, i)
|
||||
== VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE)
|
||||
continue;
|
||||
if (flags & VIR_DOMAIN_XML_MIGRATABLE &&
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
|
||||
def->listens[i].fromConfig)
|
||||
continue;
|
||||
if (!children) {
|
||||
@ -19089,8 +19061,8 @@ virDomainHostdevDefFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "<shareable/>\n");
|
||||
|
||||
if (virDomainDeviceInfoFormat(buf, def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
|
||||
| VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
|
||||
flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT
|
||||
| VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0)
|
||||
return -1;
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
@ -19113,7 +19085,7 @@ virDomainRedirdevDefFormat(virBufferPtr buf,
|
||||
if (virDomainChrSourceDefFormat(buf, NULL, &def->source.chr, false, flags) < 0)
|
||||
return -1;
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info,
|
||||
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
|
||||
flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) < 0)
|
||||
return -1;
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</redirdev>\n");
|
||||
@ -19170,7 +19142,7 @@ virDomainHubDefFormat(virBufferPtr buf,
|
||||
|
||||
virBufferAsprintf(buf, "<hub type='%s'", type);
|
||||
|
||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||
if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
@ -19308,9 +19280,9 @@ virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This internal version can accept VIR_DOMAIN_XML_INTERNAL_*,
|
||||
* whereas the public version cannot. Also, it appends to an existing
|
||||
* buffer (possibly with auto-indent), rather than flattening to string.
|
||||
/* This internal version appends to an existing buffer
|
||||
* (possibly with auto-indent), rather than flattening
|
||||
* to string.
|
||||
* Return -1 on failure. */
|
||||
int
|
||||
virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
@ -19325,11 +19297,11 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
bool blkio = false;
|
||||
bool cputune = false;
|
||||
|
||||
virCheckFlags(DUMPXML_FLAGS |
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST,
|
||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS |
|
||||
VIR_DOMAIN_DEF_FORMAT_STATUS |
|
||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
||||
VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST,
|
||||
-1);
|
||||
|
||||
if (!(type = virDomainVirtTypeToString(def->virtType))) {
|
||||
@ -19339,10 +19311,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (def->id == -1)
|
||||
flags |= VIR_DOMAIN_XML_INACTIVE;
|
||||
flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||
|
||||
virBufferAsprintf(buf, "<domain type='%s'", type);
|
||||
if (!(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))
|
||||
virBufferAsprintf(buf, " id='%d'", def->id);
|
||||
if (def->namespaceData && def->ns.href)
|
||||
virBufferAsprintf(buf, " %s", (def->ns.href)());
|
||||
@ -19883,7 +19855,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (virCPUDefFormatBufFull(buf, def->cpu,
|
||||
!!(flags & VIR_DOMAIN_XML_UPDATE_CPU)) < 0)
|
||||
!!(flags & VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU)) < 0)
|
||||
goto error;
|
||||
|
||||
virBufferAsprintf(buf, "<clock offset='%s'",
|
||||
@ -19898,7 +19870,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virBufferAsprintf(buf, " adjustment='%lld' basis='%s'",
|
||||
def->clock.data.variable.adjustment,
|
||||
virDomainClockBasisTypeToString(def->clock.data.variable.basis));
|
||||
if (flags & VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST) {
|
||||
if (flags & VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST) {
|
||||
if (def->clock.data.variable.adjustment0)
|
||||
virBufferAsprintf(buf, " adjustment0='%lld'",
|
||||
def->clock.data.variable.adjustment0);
|
||||
@ -20048,7 +20020,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(flags & VIR_DOMAIN_XML_MIGRATABLE)) {
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) {
|
||||
autoInput.type = VIR_DOMAIN_INPUT_TYPE_KBD;
|
||||
if (virDomainInputDefFormat(buf, &autoInput, flags) < 0)
|
||||
goto error;
|
||||
@ -20136,12 +20108,29 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags)
|
||||
{
|
||||
unsigned int formatFlags = 0;
|
||||
|
||||
if (flags & VIR_DOMAIN_XML_SECURE)
|
||||
formatFlags |= VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||
if (flags & VIR_DOMAIN_XML_INACTIVE)
|
||||
formatFlags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||
if (flags & VIR_DOMAIN_XML_UPDATE_CPU)
|
||||
formatFlags |= VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU;
|
||||
if (flags & VIR_DOMAIN_XML_MIGRATABLE)
|
||||
formatFlags |= VIR_DOMAIN_DEF_FORMAT_MIGRATABLE;
|
||||
|
||||
return formatFlags;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
virDomainDefFormat(virDomainDefPtr def, unsigned int flags)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
virCheckFlags(DUMPXML_FLAGS, NULL);
|
||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
||||
if (virDomainDefFormatInternal(def, flags, &buf) < 0)
|
||||
return NULL;
|
||||
|
||||
@ -20318,7 +20307,7 @@ virDomainSaveConfig(const char *configDir,
|
||||
int ret = -1;
|
||||
char *xml;
|
||||
|
||||
if (!(xml = virDomainDefFormat(def, VIR_DOMAIN_XML_WRITE_FLAGS)))
|
||||
if (!(xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainSaveXML(configDir, def, xml))
|
||||
@ -20335,11 +20324,11 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
|
||||
const char *statusDir,
|
||||
virDomainObjPtr obj)
|
||||
{
|
||||
unsigned int flags = (VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST);
|
||||
unsigned int flags = (VIR_DOMAIN_DEF_FORMAT_SECURE |
|
||||
VIR_DOMAIN_DEF_FORMAT_STATUS |
|
||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
||||
VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST);
|
||||
|
||||
int ret = -1;
|
||||
char *xml;
|
||||
@ -20378,7 +20367,7 @@ virDomainObjListLoadConfig(virDomainObjListPtr doms,
|
||||
goto error;
|
||||
if (!(def = virDomainDefParseFile(configFile, caps, xmlopt,
|
||||
expectedVirtTypes,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
||||
@ -20425,10 +20414,10 @@ virDomainObjListLoadStatus(virDomainObjListPtr doms,
|
||||
goto error;
|
||||
|
||||
if (!(obj = virDomainObjParseFile(statusFile, caps, xmlopt, expectedVirtTypes,
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST)))
|
||||
VIR_DOMAIN_DEF_PARSE_STATUS |
|
||||
VIR_DOMAIN_DEF_PARSE_ACTUAL_NET |
|
||||
VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_DEF_PARSE_CLOCK_ADJUST)))
|
||||
goto error;
|
||||
|
||||
virUUIDFormat(obj->def->uuid, uuidstr);
|
||||
@ -20951,17 +20940,17 @@ virDomainDefCopy(virDomainDefPtr src,
|
||||
{
|
||||
char *xml;
|
||||
virDomainDefPtr ret;
|
||||
unsigned int write_flags = VIR_DOMAIN_XML_WRITE_FLAGS;
|
||||
unsigned int read_flags = VIR_DOMAIN_XML_READ_FLAGS;
|
||||
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
|
||||
|
||||
if (migratable)
|
||||
write_flags |= VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_MIGRATABLE;
|
||||
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, write_flags)))
|
||||
if (!(xml = virDomainDefFormat(src, format_flags)))
|
||||
return NULL;
|
||||
|
||||
ret = virDomainDefParseString(xml, caps, xmlopt, -1, read_flags);
|
||||
ret = virDomainDefParseString(xml, caps, xmlopt, -1, parse_flags);
|
||||
|
||||
VIR_FREE(xml);
|
||||
return ret;
|
||||
@ -21427,7 +21416,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
|
||||
* @src: source to be copied
|
||||
*
|
||||
* virDomainDeviceDefCopy does a deep copy of only the parts of a
|
||||
* DeviceDef that are valid when just the flag VIR_DOMAIN_XML_INACTIVE is
|
||||
* DeviceDef that are valid when just the flag VIR_DOMAIN_DEF_PARSE_INACTIVE is
|
||||
* set. This means that any part of the device xml that is conditionally
|
||||
* parsed/formatted based on some other flag being set (or on the INACTIVE
|
||||
* flag being reset) *will not* be copied to the destination. Caveat emptor.
|
||||
@ -21442,7 +21431,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||
{
|
||||
virDomainDeviceDefPtr ret = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
int flags = VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE;
|
||||
int flags = VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||
char *xmlStr = NULL;
|
||||
int rc = -1;
|
||||
|
||||
@ -21515,7 +21504,8 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||
goto cleanup;
|
||||
|
||||
xmlStr = virBufferContentAndReset(&buf);
|
||||
ret = virDomainDeviceDefParse(xmlStr, def, caps, xmlopt, flags);
|
||||
ret = virDomainDeviceDefParse(xmlStr, def, caps, xmlopt,
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(xmlStr);
|
||||
|
@ -2436,6 +2436,37 @@ void virDomainObjListRemove(virDomainObjListPtr doms,
|
||||
void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
|
||||
virDomainObjPtr dom);
|
||||
|
||||
typedef enum {
|
||||
/* parse internal domain status information */
|
||||
VIR_DOMAIN_DEF_PARSE_STATUS = 1 << 0,
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE = 1 << 1,
|
||||
/* parse <actual> element */
|
||||
VIR_DOMAIN_DEF_PARSE_ACTUAL_NET = 1 << 2,
|
||||
/* parse original states of host PCI device */
|
||||
VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES = 1 << 3,
|
||||
VIR_DOMAIN_DEF_PARSE_ALLOW_ROM = 1 << 4,
|
||||
VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT = 1 << 5,
|
||||
VIR_DOMAIN_DEF_PARSE_CLOCK_ADJUST = 1 << 6,
|
||||
/* parse only source half of <disk> */
|
||||
VIR_DOMAIN_DEF_PARSE_DISK_SOURCE = 1 << 7,
|
||||
} virDomainDefParseFlags;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE = 1 << 0,
|
||||
VIR_DOMAIN_DEF_FORMAT_INACTIVE = 1 << 1,
|
||||
VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU = 1 << 2,
|
||||
VIR_DOMAIN_DEF_FORMAT_MIGRATABLE = 1 << 3,
|
||||
/* format internal domain status information */
|
||||
VIR_DOMAIN_DEF_FORMAT_STATUS = 1 << 4,
|
||||
/* format <actual> element */
|
||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET = 1 << 5,
|
||||
/* format original states of host PCI device */
|
||||
VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES = 1 << 6,
|
||||
VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM = 1 << 7,
|
||||
VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT = 1 << 8,
|
||||
VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST = 1 << 9,
|
||||
} virDomainDefFormatFlags;
|
||||
|
||||
virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
|
||||
const virDomainDef *def,
|
||||
virCapsPtr caps,
|
||||
@ -2467,6 +2498,8 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
|
||||
|
||||
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
|
||||
|
||||
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);
|
||||
|
||||
char *virDomainDefFormat(virDomainDefPtr def,
|
||||
unsigned int flags);
|
||||
int virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
|
@ -287,7 +287,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
|
||||
def->dom = virDomainDefParseNode(ctxt->node->doc, domainNode,
|
||||
caps, xmlopt,
|
||||
expectedVirtTypes,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!def->dom)
|
||||
goto cleanup;
|
||||
} else {
|
||||
@ -677,10 +677,10 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_UPDATE_CPU, NULL);
|
||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_SECURE |
|
||||
VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU, NULL);
|
||||
|
||||
flags |= VIR_DOMAIN_XML_INACTIVE;
|
||||
flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||
|
||||
virBufferAddLit(&buf, "<domainsnapshot>\n");
|
||||
virBufferAdjustIndent(&buf, 2);
|
||||
|
@ -2751,7 +2751,8 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff)
|
||||
def->id = id;
|
||||
|
||||
xml = virDomainDefFormat(def, flags);
|
||||
xml = virDomainDefFormat(def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@ -2805,7 +2806,7 @@ esxConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
||||
def = virVMXParseConfig(&ctx, priv->xmlopt, nativeConfig);
|
||||
|
||||
if (def)
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
virDomainDefFree(def);
|
||||
|
||||
@ -2844,7 +2845,7 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
|
||||
|
||||
def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VMWARE,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
|
||||
if (!def)
|
||||
return NULL;
|
||||
@ -3055,7 +3056,7 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
/* Parse domain XML */
|
||||
def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VMWARE,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
|
||||
if (!def)
|
||||
return NULL;
|
||||
@ -4302,7 +4303,9 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
|
||||
virUUIDFormat(snapshot->domain->uuid, uuid_string);
|
||||
|
||||
xml = virDomainSnapshotDefFormat(uuid_string, &def, flags, 0);
|
||||
xml = virDomainSnapshotDefFormat(uuid_string, &def,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
|
||||
|
@ -887,7 +887,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
|
||||
/* FIXME: devices section is totally missing */
|
||||
|
||||
xml = virDomainDefFormat(def, flags);
|
||||
xml = virDomainDefFormat(def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
|
@ -192,6 +192,7 @@ virDomainDefCompatibleDevice;
|
||||
virDomainDefCopy;
|
||||
virDomainDefFindDevice;
|
||||
virDomainDefFormat;
|
||||
virDomainDefFormatConvertXMLFlags;
|
||||
virDomainDefFormatInternal;
|
||||
virDomainDefFree;
|
||||
virDomainDefGetDefaultEmulator;
|
||||
|
@ -880,7 +880,7 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
VIR_FREE(xml);
|
||||
|
@ -643,7 +643,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLEnsureACL(conn, def) < 0)
|
||||
@ -2189,7 +2189,8 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
if (virDomainGetXMLDescEnsureACL(dom->conn, vm->def, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefFormat(vm->def, flags);
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -2241,7 +2242,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
@ -2278,7 +2279,7 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
||||
if (!(def = virDomainDefParseString(domainXml,
|
||||
cfg->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(conf = xenFormatXM(conn, def, cfg->verInfo->xen_version_major)))
|
||||
@ -2381,7 +2382,7 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
@ -3274,7 +3275,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
/* Make a copy for updated domain. */
|
||||
@ -3291,7 +3292,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
virDomainDeviceDefFree(dev);
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
if (libxlDomainAttachDeviceLive(driver, priv, vm, dev) < 0)
|
||||
@ -3385,7 +3386,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
/* Make a copy for updated domain. */
|
||||
@ -3402,7 +3403,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
virDomainDeviceDefFree(dev);
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
if (libxlDomainDetachDeviceLive(driver, priv, vm, dev) < 0)
|
||||
@ -3493,7 +3494,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
/* Make a copy for updated domain. */
|
||||
@ -3512,7 +3513,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
virDomainDeviceDefFree(dev);
|
||||
if (!(dev = virDomainDeviceDefParse(xml, vm->def,
|
||||
cfg->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if ((ret = libxlDomainUpdateDeviceLive(priv, vm, dev)) < 0)
|
||||
|
@ -242,7 +242,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
|
||||
if (!(tmpdef = virDomainDefParseString(xmlin, cfg->caps,
|
||||
driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
if (!libxlDomainDefCheckABIStability(driver, vm->def, tmpdef))
|
||||
@ -256,7 +256,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
|
||||
if (!libxlDomainMigrationIsAllowed(def))
|
||||
goto endjob;
|
||||
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
endjob:
|
||||
if (!libxlDomainObjEndJob(driver, vm))
|
||||
@ -288,7 +288,7 @@ libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
|
||||
|
||||
if (!(def = virDomainDefParseString(dom_xml, cfg->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (dname) {
|
||||
|
@ -463,7 +463,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_LXC,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
@ -1040,7 +1040,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
|
||||
|
||||
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) &&
|
||||
vm->newDef ? vm->newDef : vm->def,
|
||||
flags);
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -1206,7 +1206,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_LXC,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLWithFilesEnsureACL(conn, def) < 0)
|
||||
@ -4989,7 +4989,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
|
||||
caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -5118,7 +5118,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom,
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
|
||||
caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -5231,7 +5231,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom,
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
|
||||
caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -566,7 +566,8 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virDomainDefFormat(vm->def, flags);
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -989,7 +990,7 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
openvzDriverLock(driver);
|
||||
if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_OPENVZ,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
vm = virDomainObjListFindByName(driver->domains, vmdef->name);
|
||||
@ -1082,7 +1083,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
openvzDriverLock(driver);
|
||||
if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_OPENVZ,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
vm = virDomainObjListFindByName(driver->domains, vmdef->name);
|
||||
@ -2114,7 +2115,7 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
goto cleanup;
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, vmdef, driver->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!dev)
|
||||
goto cleanup;
|
||||
|
||||
@ -2269,7 +2270,7 @@ openvzDomainMigrateBegin3Params(virDomainPtr domain,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
xml = virDomainDefFormat(vm->def, VIR_DOMAIN_XML_SECURE);
|
||||
xml = virDomainDefFormat(vm->def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -2317,7 +2318,7 @@ openvzDomainMigratePrepare3Params(virConnectPtr dconn,
|
||||
|
||||
if (!(def = virDomainDefParseString(dom_xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_OPENVZ,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
if (!(vm = virDomainObjListAdd(driver->domains, def,
|
||||
|
@ -670,7 +670,7 @@ parallelsDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int
|
||||
parallelsDriverLock(privconn);
|
||||
if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_PARALLELS,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
olddom = virDomainObjListFindByUUID(privconn->domains, def->uuid);
|
||||
|
@ -1720,7 +1720,7 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml)
|
||||
goto cleanup;
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!dev)
|
||||
goto cleanup;
|
||||
|
||||
@ -3291,7 +3291,8 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
goto err;
|
||||
}
|
||||
|
||||
return virDomainDefFormat(&def, flags);
|
||||
return virDomainDefFormat(&def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
err:
|
||||
return NULL;
|
||||
|
@ -1699,7 +1699,7 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
|
||||
|
||||
if (!(ret = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
cleanup:
|
||||
@ -1807,7 +1807,9 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
||||
|
||||
}
|
||||
|
||||
ret = virDomainDefFormatInternal(def, flags, buf);
|
||||
ret = virDomainDefFormatInternal(def,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
buf);
|
||||
|
||||
cleanup:
|
||||
def->cpu = def_cpu;
|
||||
@ -2159,8 +2161,10 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||
newxml = virDomainSnapshotDefFormat(uuidstr, snapshot->def,
|
||||
QEMU_DOMAIN_FORMAT_LIVE_FLAGS, 1);
|
||||
newxml = virDomainSnapshotDefFormat(
|
||||
uuidstr, snapshot->def,
|
||||
virDomainDefFormatConvertXMLFlags(QEMU_DOMAIN_FORMAT_LIVE_FLAGS),
|
||||
1);
|
||||
if (newxml == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -1690,7 +1690,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLEnsureACL(conn, def) < 0)
|
||||
@ -3165,7 +3165,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
|
||||
|
||||
if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE))) {
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
|
||||
goto endjob;
|
||||
}
|
||||
if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) {
|
||||
@ -5582,7 +5582,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
|
||||
|
||||
if (!(newdef = virDomainDefParseString(newxml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(newdef_migr = qemuDomainDefCopy(driver,
|
||||
@ -5738,7 +5738,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||
/* Create a domain from this XML */
|
||||
if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
if (xmlout)
|
||||
@ -6317,7 +6317,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
|
||||
|
||||
def = virDomainDefParseString(xmlData, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!def)
|
||||
goto cleanup;
|
||||
|
||||
@ -6684,7 +6684,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
@ -7530,7 +7530,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
virDomainDefPtr vmdef = NULL;
|
||||
virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
|
||||
int ret = -1;
|
||||
unsigned int affect, parse_flags = VIR_DOMAIN_XML_INACTIVE;
|
||||
unsigned int affect, parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
|
||||
virQEMUCapsPtr qemuCaps = NULL;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
@ -7729,7 +7729,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
|
||||
caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto endjob;
|
||||
|
||||
@ -7865,7 +7865,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
|
||||
if ((flags & VIR_DOMAIN_AFFECT_CONFIG) &&
|
||||
!(flags & VIR_DOMAIN_AFFECT_LIVE))
|
||||
parse_flags |= VIR_DOMAIN_XML_INACTIVE;
|
||||
parse_flags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
|
||||
|
||||
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
|
||||
caps, driver->xmlopt,
|
||||
@ -13930,7 +13930,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
||||
if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)) ||
|
||||
!(def->dom = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto endjob;
|
||||
|
||||
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) {
|
||||
@ -14367,7 +14367,9 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
|
||||
virUUIDFormat(snapshot->domain->uuid, uuidstr);
|
||||
|
||||
xml = virDomainSnapshotDefFormat(uuidstr, snap->def, flags, 0);
|
||||
xml = virDomainSnapshotDefFormat(uuidstr, snap->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
qemuDomObjEndAPI(&vm);
|
||||
@ -16134,7 +16136,7 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
|
||||
}
|
||||
|
||||
if (!(dest = virDomainDiskDefSourceParse(destxml, vm->def, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest, bandwidth,
|
||||
|
@ -1249,7 +1249,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
|
||||
}
|
||||
mig->persistent = virDomainDefParseNode(doc, nodes[0],
|
||||
caps, driver->xmlopt,
|
||||
-1, VIR_DOMAIN_XML_INACTIVE);
|
||||
-1, VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!mig->persistent) {
|
||||
/* virDomainDefParseNode already reported
|
||||
* an error for us */
|
||||
@ -2668,7 +2668,7 @@ static char
|
||||
if (xmlin) {
|
||||
if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!qemuDomainDefCheckABIStability(driver, vm->def, def))
|
||||
@ -2869,7 +2869,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
|
||||
VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
|
||||
newdef = virDomainDefParseString(xmlout, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!newdef)
|
||||
goto cleanup;
|
||||
|
||||
@ -3345,7 +3345,7 @@ qemuMigrationPrepareDef(virQEMUDriverPtr driver,
|
||||
|
||||
if (!(def = virDomainDefParseString(dom_xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (dname) {
|
||||
|
@ -178,7 +178,7 @@ load_profile(virSecurityManagerPtr mgr,
|
||||
const char *probe = virSecurityManagerGetAllowDiskFormatProbing(mgr)
|
||||
? "1" : "0";
|
||||
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
if (!xml)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -740,7 +740,8 @@ get_definition(vahControl * ctl, const char *xmlStr)
|
||||
|
||||
ctl->def = virDomainDefParseString(xmlStr,
|
||||
ctl->caps, ctl->xmlopt,
|
||||
-1, VIR_DOMAIN_XML_INACTIVE);
|
||||
-1,
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (ctl->def == NULL) {
|
||||
vah_error(ctl, 0, _("could not parse XML"));
|
||||
goto exit;
|
||||
|
@ -758,7 +758,7 @@ testOpenDefault(virConnectPtr conn)
|
||||
privconn->caps,
|
||||
privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_TEST,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
if (testDomainGenerateIfnames(domdef) < 0)
|
||||
@ -1082,7 +1082,7 @@ testParseDomains(testConnPtr privconn,
|
||||
def = virDomainDefParseNode(ctxt->doc, node,
|
||||
privconn->caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_TEST,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!def)
|
||||
goto error;
|
||||
|
||||
@ -1749,7 +1749,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
testDriverLock(privconn);
|
||||
if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_TEST,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (testDomainGenerateIfnames(def) < 0)
|
||||
@ -2218,7 +2218,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
|
||||
}
|
||||
|
||||
xml = virDomainDefFormat(privdom->def,
|
||||
VIR_DOMAIN_XML_SECURE);
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
if (xml == NULL) {
|
||||
virReportSystemError(errno,
|
||||
@ -2362,7 +2362,7 @@ testDomainRestoreFlags(virConnectPtr conn,
|
||||
|
||||
def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_TEST,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!def)
|
||||
goto cleanup;
|
||||
|
||||
@ -2890,7 +2890,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
privdom->newDef ? privdom->newDef : privdom->def;
|
||||
|
||||
ret = virDomainDefFormat(def,
|
||||
flags);
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
@ -2943,7 +2943,7 @@ static virDomainPtr testDomainDefineXMLFlags(virConnectPtr conn,
|
||||
testDriverLock(privconn);
|
||||
if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_TEST,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (testDomainGenerateIfnames(def) < 0)
|
||||
@ -6785,7 +6785,9 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
|
||||
virUUIDFormat(snapshot->domain->uuid, uuidstr);
|
||||
|
||||
xml = virDomainSnapshotDefFormat(uuidstr, snap->def, flags, 0);
|
||||
xml = virDomainSnapshotDefFormat(uuidstr, snap->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
|
@ -1612,7 +1612,7 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
umlDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_UML,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLEnsureACL(conn, def) < 0)
|
||||
@ -1988,7 +1988,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
|
||||
|
||||
ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef ?
|
||||
vm->newDef : vm->def,
|
||||
flags);
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -2088,7 +2088,7 @@ umlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
umlDriverLock(driver);
|
||||
if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_UML,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
@ -2253,7 +2253,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
@ -2373,7 +2373,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml)
|
||||
}
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1860,7 +1860,7 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags
|
||||
VBOX_IID_INITIALIZE(&mchiid);
|
||||
if (!(def = virDomainDefParseString(xml, data->caps, data->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VBOX,
|
||||
VIR_DOMAIN_XML_INACTIVE))) {
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -3978,7 +3978,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
/* dump USB devices/filters if active */
|
||||
vboxHostDeviceGetXMLDesc(data, def, machine);
|
||||
|
||||
ret = virDomainDefFormat(def, flags);
|
||||
ret = virDomainDefFormat(def, virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
VBOX_RELEASE(machine);
|
||||
@ -4117,7 +4117,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -4249,7 +4249,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
|
||||
goto cleanup;
|
||||
|
||||
dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (dev == NULL)
|
||||
goto cleanup;
|
||||
|
||||
@ -5209,7 +5209,7 @@ vboxSnapshotRedefine(virDomainPtr dom,
|
||||
VIR_FREE(currentSnapshotXmlFilePath);
|
||||
if (virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml", machineLocationPath, snapshotMachineDesc->currentSnapshot) < 0)
|
||||
goto cleanup;
|
||||
char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, VIR_DOMAIN_XML_SECURE, 0);
|
||||
char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, VIR_DOMAIN_DEF_FORMAT_SECURE, 0);
|
||||
if (snapshotContent == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to get snapshot content"));
|
||||
@ -6129,7 +6129,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
|
||||
virUUIDFormat(dom->uuid, uuidstr);
|
||||
memcpy(def->dom->uuid, dom->uuid, VIR_UUID_BUFLEN);
|
||||
ret = virDomainSnapshotDefFormat(uuidstr, def, flags, 0);
|
||||
ret = virDomainSnapshotDefFormat(uuidstr, def,
|
||||
virDomainDefFormatConvertXMLFlags(flags),
|
||||
0);
|
||||
|
||||
cleanup:
|
||||
virDomainSnapshotDefFree(def);
|
||||
|
@ -378,7 +378,7 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
vmwareDriverLock(driver);
|
||||
if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VMWARE,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
/* generate vmx file */
|
||||
@ -666,7 +666,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
|
||||
if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VMWARE,
|
||||
VIR_DOMAIN_XML_INACTIVE)) == NULL)
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
/* generate vmx file */
|
||||
@ -984,7 +984,8 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = virDomainDefFormat(vm->def, flags);
|
||||
ret = virDomainDefFormat(vm->def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -1015,7 +1016,7 @@ vmwareConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
|
||||
def = virVMXParseConfig(&ctx, driver->xmlopt, nativeConfig);
|
||||
|
||||
if (def != NULL)
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
|
||||
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
virDomainDefFree(def);
|
||||
|
||||
|
@ -775,7 +775,7 @@ xenUnifiedDomainCreateXML(virConnectPtr conn,
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainCreateXMLEnsureACL(conn, def) < 0)
|
||||
@ -1596,7 +1596,8 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
}
|
||||
|
||||
if (def)
|
||||
ret = virDomainDefFormat(def, flags);
|
||||
ret = virDomainDefFormat(def,
|
||||
virDomainDefFormatConvertXMLFlags(flags));
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
@ -1686,7 +1687,7 @@ xenUnifiedConnectDomainXMLToNative(virConnectPtr conn,
|
||||
|
||||
if (!(def = virDomainDefParseString(xmlData, priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (STREQ(format, XEN_CONFIG_FORMAT_XM)) {
|
||||
@ -1892,7 +1893,7 @@ xenUnifiedDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int
|
||||
|
||||
if (!(def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
|
@ -2256,7 +2256,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
|
||||
@ -2404,7 +2404,7 @@ xenDaemonUpdateDeviceFlags(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
|
||||
@ -2506,7 +2506,7 @@ xenDaemonDetachDeviceFlags(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainXMLDevID(conn, minidef, dev, class, ref, sizeof(ref)))
|
||||
|
@ -1251,7 +1251,7 @@ xenXMDomainAttachDeviceFlags(virConnectPtr conn,
|
||||
if (!(dev = virDomainDeviceDefParse(xml, entry->def,
|
||||
priv->caps,
|
||||
priv->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
switch (dev->type) {
|
||||
@ -1338,7 +1338,7 @@ xenXMDomainDetachDeviceFlags(virConnectPtr conn,
|
||||
if (!(dev = virDomainDeviceDefParse(xml, entry->def,
|
||||
priv->caps,
|
||||
priv->xmlopt,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
switch (dev->type) {
|
||||
|
@ -554,7 +554,7 @@ xenapiDomainCreateXML(virConnectPtr conn,
|
||||
virDomainDefPtr defPtr = virDomainDefParseString(xmlDesc,
|
||||
priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
createVMRecordFromXml(conn, defPtr, &record, &vm);
|
||||
virDomainDefFree(defPtr);
|
||||
if (record) {
|
||||
@ -1728,7 +1728,7 @@ xenapiDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
virDomainDefPtr defPtr = virDomainDefParseString(xml,
|
||||
priv->caps, priv->xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
if (!defPtr)
|
||||
return NULL;
|
||||
|
||||
|
@ -33,7 +33,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
|
||||
if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_BHYVE,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto out;
|
||||
|
||||
vm.def = vmdef;
|
||||
|
@ -28,10 +28,10 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
|
||||
|
||||
if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_BHYVE,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE)))
|
||||
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (STRNEQ(outXmlData, actual)) {
|
||||
|
@ -102,7 +102,7 @@ testCompareXMLToXMLFiles(const char *inxml,
|
||||
goto cleanup;
|
||||
|
||||
if (!(actual = virDomainSnapshotDefFormat(uuid, def,
|
||||
VIR_DOMAIN_XML_SECURE,
|
||||
VIR_DOMAIN_DEF_FORMAT_SECURE,
|
||||
internal)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
||||
|
||||
if (!(def = virDomainDefParseString(inXmlData, caps, xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_LXC,
|
||||
live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
|
||||
live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, def)) {
|
||||
@ -46,7 +46,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
|
||||
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto fail;
|
||||
|
||||
if (STRNEQ(outXmlData, actual)) {
|
||||
|
@ -115,7 +115,7 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
actual = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
|
||||
actual = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_INACTIVE);
|
||||
|
||||
if (actual == NULL) {
|
||||
err = virGetLastError();
|
||||
|
@ -187,7 +187,7 @@ testQemuAgentGetFSInfo(const void *data)
|
||||
|
||||
if (!(def = virDomainDefParseString(domain_xml, caps, xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
|
||||
|
@ -67,7 +67,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
|
||||
driver.caps,
|
||||
driver.xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
priv = (*vm)->privateData;
|
||||
@ -177,7 +177,7 @@ testQemuHotplugCheckResult(virDomainObjPtr vm,
|
||||
char *actual;
|
||||
int ret;
|
||||
|
||||
actual = virDomainDefFormat(vm->def, VIR_DOMAIN_XML_SECURE);
|
||||
actual = virDomainDefFormat(vm->def, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
if (!actual)
|
||||
return -1;
|
||||
|
||||
@ -246,7 +246,7 @@ testQemuHotplug(const void *data)
|
||||
}
|
||||
|
||||
if (test->action == ATTACH)
|
||||
device_parse_flags = VIR_DOMAIN_XML_INACTIVE;
|
||||
device_parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
|
||||
|
||||
if (!(dev = virDomainDeviceDefParse(device_xml, vm->def,
|
||||
caps, driver.xmlopt,
|
||||
|
@ -287,7 +287,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
|
||||
if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE))) {
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
|
||||
if (!virtTestOOMActive() &&
|
||||
(flags & FLAG_EXPECT_PARSE_ERROR))
|
||||
goto ok;
|
||||
|
@ -30,7 +30,10 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
||||
char *actual = NULL;
|
||||
int ret = -1;
|
||||
virDomainDefPtr def = NULL;
|
||||
unsigned int flags = live ? 0 : VIR_DOMAIN_XML_INACTIVE;
|
||||
unsigned int parse_flags = live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE;
|
||||
unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
|
||||
if (!live)
|
||||
format_flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;
|
||||
|
||||
if (virtTestLoadFile(inxml, &inXmlData) < 0)
|
||||
goto fail;
|
||||
@ -38,7 +41,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
||||
goto fail;
|
||||
|
||||
if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES, flags)))
|
||||
QEMU_EXPECTED_VIRT_TYPES, parse_flags)))
|
||||
goto fail;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, def)) {
|
||||
@ -46,7 +49,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE | flags)))
|
||||
if (!(actual = virDomainDefFormat(def, format_flags)))
|
||||
goto fail;
|
||||
|
||||
if (STRNEQ(outXmlData, actual)) {
|
||||
|
@ -56,7 +56,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
|
||||
if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
|
||||
|
@ -90,7 +90,7 @@ testCompareFiles(const char *vmx, const char *xml)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
|
||||
if (!(formatted = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto cleanup;
|
||||
|
||||
if (STRNEQ(xmlData, formatted)) {
|
||||
|
@ -74,7 +74,7 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
|
||||
|
||||
if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, def)) {
|
||||
@ -140,7 +140,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml, int xendConfigVersion)
|
||||
if (!(def = xenParseXM(conf, priv.xendConfigVersion, priv.caps)))
|
||||
goto fail;
|
||||
|
||||
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
|
||||
if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||
goto fail;
|
||||
|
||||
if (STRNEQ(xmlData, gotxml)) {
|
||||
|
@ -37,7 +37,7 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
|
||||
|
||||
if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_XEN,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
|
||||
goto fail;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, def)) {
|
||||
|
@ -86,7 +86,7 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
|
||||
|
||||
def = virDomainDefParseString(xmlData, caps, xmlopt,
|
||||
1 << VIR_DOMAIN_VIRT_VMWARE,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
VIR_DOMAIN_DEF_PARSE_INACTIVE);
|
||||
|
||||
if (def == NULL)
|
||||
goto failure;
|
||||
|
Loading…
Reference in New Issue
Block a user