conf: Use virTristateXXX in virDomainDiskDef

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-04-07 13:48:31 +02:00 committed by Peter Krempa
parent 5cbc83774a
commit a9ef3272c5
2 changed files with 27 additions and 18 deletions

View File

@ -9210,27 +9210,36 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
}
VIR_FREE(tmp);
if ((tmp = virXMLPropString(cur, "ioeventfd")) &&
(def->ioeventfd = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk ioeventfd mode '%s'"), tmp);
return -1;
if ((tmp = virXMLPropString(cur, "ioeventfd"))) {
int value;
if ((value = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk ioeventfd mode '%s'"), tmp);
return -1;
}
def->ioeventfd = value;
}
VIR_FREE(tmp);
if ((tmp = virXMLPropString(cur, "event_idx")) &&
(def->event_idx = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk event_idx mode '%s'"), tmp);
return -1;
if ((tmp = virXMLPropString(cur, "event_idx"))) {
int value;
if ((value = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk event_idx mode '%s'"), tmp);
return -1;
}
def->event_idx = value;
}
VIR_FREE(tmp);
if ((tmp = virXMLPropString(cur, "copy_on_read")) &&
(def->copy_on_read = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk copy_on_read mode '%s'"), tmp);
return -1;
if ((tmp = virXMLPropString(cur, "copy_on_read"))) {
int value;
if ((value = virTristateSwitchTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk copy_on_read mode '%s'"), tmp);
return -1;
}
def->copy_on_read = value;
}
VIR_FREE(tmp);

View File

@ -569,9 +569,9 @@ struct _virDomainDiskDef {
int error_policy; /* enum virDomainDiskErrorPolicy */
int rerror_policy; /* enum virDomainDiskErrorPolicy */
int iomode; /* enum virDomainDiskIo */
int ioeventfd; /* enum virTristateSwitch */
int event_idx; /* enum virTristateSwitch */
int copy_on_read; /* enum virTristateSwitch */
virTristateSwitch ioeventfd;
virTristateSwitch event_idx;
virTristateSwitch copy_on_read;
int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
int startupPolicy; /* enum virDomainStartupPolicy */
bool transient;