Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 36 ++++++------------------------------
1 file changed, 6 insertions(+), 30 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f2fb3c8dd5..f17c979e31 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9132,38 +9132,14 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
}
VIR_FREE(tmp);
- 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 (virXMLPropTristateSwitch(cur, "ioeventfd", false,
&def->ioeventfd) < 0)
+ 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 (virXMLPropTristateSwitch(cur, "event_idx", false,
&def->event_idx) < 0)
+ 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);
+ if (virXMLPropTristateSwitch(cur, "copy_on_read", false,
&def->copy_on_read) < 0)
+ return -1;
if ((tmp = virXMLPropString(cur, "discard")) &&
(def->discard = virDomainDiskDiscardTypeFromString(tmp)) <= 0) {
--
2.26.2