mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
conf: domain: Convert virDomainDiskDef's 'snapshot' to unsigned int
Unfortunately virDomainSnapshotLocation is declared in snapshot_conf.h which includes domain_conf.h. To avoid a circular dependency use 'unsigned int' for now. Use XML parser can use virXMLPropEnum. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
21c10943a9
commit
1db5a84bdc
@ -9313,7 +9313,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
bool source = false;
|
||||
g_autofree char *tmp = NULL;
|
||||
g_autofree char *snapshot = NULL;
|
||||
g_autofree char *target = NULL;
|
||||
g_autofree char *bus = NULL;
|
||||
g_autofree char *serial = NULL;
|
||||
@ -9349,7 +9348,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
||||
VIR_XML_PROP_OPTIONAL, &def->model) < 0)
|
||||
return NULL;
|
||||
|
||||
snapshot = virXMLPropString(node, "snapshot");
|
||||
if (virXMLPropEnum(node, "snapshot", virDomainSnapshotLocationTypeFromString,
|
||||
VIR_XML_PROP_OPTIONAL | VIR_XML_PROP_NONZERO, &def->snapshot) < 0)
|
||||
return NULL;
|
||||
|
||||
if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def->rawio) < 0)
|
||||
return NULL;
|
||||
@ -9461,16 +9462,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
||||
}
|
||||
}
|
||||
|
||||
if (snapshot) {
|
||||
def->snapshot = virDomainSnapshotLocationTypeFromString(snapshot);
|
||||
if (def->snapshot <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown disk snapshot setting '%s'"),
|
||||
snapshot);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (bus) {
|
||||
if ((def->bus = virDomainDiskBusTypeFromString(bus)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
|
@ -573,7 +573,7 @@ struct _virDomainDiskDef {
|
||||
virTristateSwitch ioeventfd;
|
||||
virTristateSwitch event_idx;
|
||||
virTristateSwitch copy_on_read;
|
||||
int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
|
||||
unsigned int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
|
||||
virDomainStartupPolicy startupPolicy;
|
||||
bool transient;
|
||||
virDomainDeviceInfo info;
|
||||
|
Loading…
Reference in New Issue
Block a user