1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

conf: disk: extract sgio/rawio validation

This commit is contained in:
Peter Krempa 2016-04-20 16:52:46 +02:00
parent af93e2bf3d
commit d9cab30a9c

View File

@ -6911,6 +6911,20 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
}
}
if (def->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
if (def->rawio != VIR_TRISTATE_BOOL_ABSENT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("rawio can be used only with device='lun'"));
return -1;
}
if (def->sgio != VIR_DOMAIN_DEVICE_SGIO_DEFAULT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("sgio can be used only with device='lun'"));
return -1;
}
}
return 0;
}
@ -7330,14 +7344,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
def->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
}
if ((rawio || sgio) &&
(def->device != VIR_DOMAIN_DISK_DEVICE_LUN)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("rawio or sgio can be used only with "
"device='lun'"));
goto error;
}
if (rawio) {
if ((def->rawio = virTristateBoolTypeFromString(rawio)) <= 0) {
virReportError(VIR_ERR_XML_ERROR,