[libvirt] [PATCH 1/5] conf: Keep 'readonly' property when resetting disk source

Peter Krempa pkrempa at redhat.com
Fri Apr 7 15:50:12 UTC 2017


The property is necessary also for the disk using the source (e.g. cdrom)
which needs to be kept readonly.
---
 src/conf/domain_conf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 80baa090a..d660c06e0 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;
 }


-- 
2.12.2




More information about the libvir-list mailing list