]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Keep 'readonly' property when resetting disk source
authorPeter Krempa <pkrempa@redhat.com>
Fri, 7 Apr 2017 11:44:54 +0000 (13:44 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 13 Apr 2017 10:12:54 +0000 (12:12 +0200)
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.

src/conf/domain_conf.c

index 80baa090a7f8ddeba72b7387de5a7a5570b1e455..d660c06e0fd0d617975cfd92fc161f70e250e078 100644 (file)
@@ -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;
 }