From: Peter Krempa Date: Fri, 7 Apr 2017 11:44:54 +0000 (+0200) Subject: conf: Keep 'readonly' property when resetting disk source X-Git-Tag: v3.3.0-rc1~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7526a71586d4072cef7d66798c3da4d30e163e7d;p=thirdparty%2Flibvirt.git conf: Keep 'readonly' property when resetting disk source The property is necessary also for the disk using the source (e.g. cdrom) which needs to be kept readonly. Commit '462c4b66' was a bit too aggressive in this aspect, since the readonly flag is set only while parsing. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 80baa090a7..d660c06e0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1723,9 +1723,12 @@ void virDomainDiskEmptySource(virDomainDiskDefPtr def) { virStorageSourcePtr src = def->src; + bool readonly = src->readonly; virStorageSourceClear(src); src->type = VIR_STORAGE_TYPE_FILE; + /* readonly property is necessary for CDROMs and thus can't be cleared */ + src->readonly = readonly; }