mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
conf: domain: Convert virDomainDiskDef's 'sgio' to virDomainDeviceSGIO
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
56a190068d
commit
e3434446c5
@ -9314,7 +9314,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
bool source = false;
|
bool source = false;
|
||||||
g_autofree char *tmp = NULL;
|
g_autofree char *tmp = NULL;
|
||||||
g_autofree char *snapshot = NULL;
|
g_autofree char *snapshot = NULL;
|
||||||
g_autofree char *sgio = NULL;
|
|
||||||
g_autofree char *target = NULL;
|
g_autofree char *target = NULL;
|
||||||
g_autofree char *bus = NULL;
|
g_autofree char *bus = NULL;
|
||||||
g_autofree char *serial = NULL;
|
g_autofree char *serial = NULL;
|
||||||
@ -9359,7 +9358,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def->rawio) < 0)
|
if (virXMLPropTristateBool(node, "rawio", VIR_XML_PROP_OPTIONAL, &def->rawio) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sgio = virXMLPropString(node, "sgio");
|
if (virXMLPropEnum(node, "sgio", virDomainDeviceSGIOTypeFromString,
|
||||||
|
VIR_XML_PROP_OPTIONAL | VIR_XML_PROP_NONZERO, &def->sgio) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (cur = node->children; cur != NULL; cur = cur->next) {
|
for (cur = node->children; cur != NULL; cur = cur->next) {
|
||||||
if (cur->type != XML_ELEMENT_NODE)
|
if (cur->type != XML_ELEMENT_NODE)
|
||||||
@ -9474,14 +9475,6 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sgio) {
|
|
||||||
if ((def->sgio = virDomainDeviceSGIOTypeFromString(sgio)) <= 0) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("unknown disk sgio mode '%s'"), sgio);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bus) {
|
if (bus) {
|
||||||
if ((def->bus = virDomainDiskBusTypeFromString(bus)) <= 0) {
|
if ((def->bus = virDomainDiskBusTypeFromString(bus)) <= 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
@ -578,7 +578,7 @@ struct _virDomainDiskDef {
|
|||||||
bool transient;
|
bool transient;
|
||||||
virDomainDeviceInfo info;
|
virDomainDeviceInfo info;
|
||||||
virTristateBool rawio;
|
virTristateBool rawio;
|
||||||
int sgio; /* enum virDomainDeviceSGIO */
|
virDomainDeviceSGIO sgio;
|
||||||
int discard; /* enum virDomainDiskDiscard */
|
int discard; /* enum virDomainDiskDiscard */
|
||||||
unsigned int iothread; /* unused = 0, > 0 specific thread # */
|
unsigned int iothread; /* unused = 0, > 0 specific thread # */
|
||||||
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
|
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
|
||||||
|
Loading…
Reference in New Issue
Block a user