Everything besides the top of the chain is readonly. Track this when
parsing the XML and detecting the chain from the disk. Also fix the
state when taking snapshots.
All other cases where the top image is changed already preserve the
readonly state from the original image.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
if (VIR_ALLOC(backingStore) < 0)
goto cleanup;
+ /* backing store is always read-only */
+ backingStore->readonly = true;
+
/* terminator does not have a type */
if (!(type = virXMLPropString(ctxt->node, "type"))) {
VIR_STEAL_PTR(src->backingStore, backingStore);
if (dd->initialized)
virStorageFileDeinit(dd->src);
+ /* the old disk image is now readonly */
+ dd->disk->src->readonly = true;
+
VIR_STEAL_PTR(dd->disk->src->relPath, dd->relPath);
VIR_STEAL_PTR(dd->src->backingStore, dd->disk->src);
VIR_STEAL_PTR(dd->disk->src, dd->src);
if (virStorageSourceInitChainElement(ret, parent, true) < 0)
goto error;
+ ret->readonly = true;
ret->detected = true;
}