提交 3817fa10 编写于 作者: P Peter Krempa

storage: Properly track that backing chain members are readonly

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 5dbdd401
...@@ -8735,6 +8735,9 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, ...@@ -8735,6 +8735,9 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
if (VIR_ALLOC(backingStore) < 0) if (VIR_ALLOC(backingStore) < 0)
goto cleanup; goto cleanup;
/* backing store is always read-only */
backingStore->readonly = true;
/* terminator does not have a type */ /* terminator does not have a type */
if (!(type = virXMLPropString(ctxt->node, "type"))) { if (!(type = virXMLPropString(ctxt->node, "type"))) {
VIR_STEAL_PTR(src->backingStore, backingStore); VIR_STEAL_PTR(src->backingStore, backingStore);
......
...@@ -14680,6 +14680,9 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd, ...@@ -14680,6 +14680,9 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd,
if (dd->initialized) if (dd->initialized)
virStorageFileDeinit(dd->src); 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->disk->src->relPath, dd->relPath);
VIR_STEAL_PTR(dd->src->backingStore, dd->disk->src); VIR_STEAL_PTR(dd->src->backingStore, dd->disk->src);
VIR_STEAL_PTR(dd->disk->src, dd->src); VIR_STEAL_PTR(dd->disk->src, dd->src);
......
...@@ -3425,6 +3425,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent) ...@@ -3425,6 +3425,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent)
if (virStorageSourceInitChainElement(ret, parent, true) < 0) if (virStorageSourceInitChainElement(ret, parent, true) < 0)
goto error; goto error;
ret->readonly = true;
ret->detected = true; ret->detected = true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册