Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 39 ++++++++++++++++++++++++---------------
src/conf/domain_conf.h | 6 +++---
2 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 43789fa2c7..014f318dcd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9196,27 +9196,36 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr 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);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 87bc7e8625..853cab96b5 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -568,9 +568,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;
--
2.26.2