Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 14 +++++++++-----
src/conf/domain_conf.h | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 72664bd72b..9a4252099e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9046,11 +9046,15 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
}
VIR_FREE(tmp);
- if ((tmp = virXMLPropString(cur, "discard")) &&
- (def->discard = virDomainDiskDiscardTypeFromString(tmp)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown disk discard mode '%s'"), tmp);
- return -1;
+ if ((tmp = virXMLPropString(cur, "discard"))) {
+ int discard;
+
+ if ((discard = virDomainDiskDiscardTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk discard mode '%s'"), tmp);
+ return -1;
+ }
+ def->discard = discard;
}
VIR_FREE(tmp);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3402b3f85a..eb4991a312 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -579,7 +579,7 @@ struct _virDomainDiskDef {
virDomainDeviceInfo info;
virTristateBool rawio;
virDomainDeviceSGIO sgio;
- int discard; /* enum virDomainDiskDiscard */
+ virDomainDiskDiscard discard;
unsigned int iothread; /* unused = 0, > 0 specific thread # */
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
char *domain_name; /* backend domain name */
--
2.26.3