Signed-off-by: Tim Wiederhake <twied...@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 67954bb42b..a99553cb0b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9198,27 +9198,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 3da9ba01bf..1bbf859ca6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -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; -- 2.26.2