diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 720d56cf69..33c6412642 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8964,11 +8964,15 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, def->driverName = virXMLPropString(cur, "name"); - if ((tmp = virXMLPropString(cur, "cache")) && - (def->cachemode = virDomainDiskCacheTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk cache mode '%s'"), tmp); - return -1; + if ((tmp = virXMLPropString(cur, "cache"))) { + int cachemode; + + if ((cachemode = virDomainDiskCacheTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk cache mode '%s'"), tmp); + return -1; + } + def->cachemode = cachemode; } VIR_FREE(tmp); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fab7a0208e..3675e26eb0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -566,7 +566,7 @@ struct _virDomainDiskDef { char *wwn; char *vendor; char *product; - int cachemode; /* enum virDomainDiskCache */ + virDomainDiskCache cachemode; int error_policy; /* enum virDomainDiskErrorPolicy */ int rerror_policy; /* enum virDomainDiskErrorPolicy */ int iomode; /* enum virDomainDiskIo */