提交 a7643da8 编写于 作者: P Peter Krempa

qemu: block: Explicitly specify backingStore when creating format layer props

Pass in backing store explicitly to qemuBlockStorageSourceGetBlockdevProps
and fix the callers.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 d6f11160
...@@ -1396,15 +1396,16 @@ qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src) ...@@ -1396,15 +1396,16 @@ qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src)
* qemuBlockStorageSourceGetBlockdevProps: * qemuBlockStorageSourceGetBlockdevProps:
* *
* @src: storage source to format * @src: storage source to format
* @backingStore: a storage source to use as backing of @src
* *
* Formats @src into a JSON object which can be used with blockdev-add or * Formats @src into a JSON object which can be used with blockdev-add or
* -blockdev. The formatted object contains both the storage and format layer * -blockdev. The formatted object contains both the storage and format layer
* in nested form including link to the backing chain layer if necessary. * in nested form including link to the backing chain layer if necessary.
*/ */
virJSONValuePtr virJSONValuePtr
qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src) qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src,
virStorageSourcePtr backingStore)
{ {
virStorageSourcePtr backingStore = src->backingStore;
VIR_AUTOPTR(virJSONValue) props = NULL; VIR_AUTOPTR(virJSONValue) props = NULL;
if (!(props = qemuBlockStorageSourceGetBlockdevFormatProps(src))) if (!(props = qemuBlockStorageSourceGetBlockdevFormatProps(src)))
...@@ -1484,7 +1485,8 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src, ...@@ -1484,7 +1485,8 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
if (VIR_ALLOC(data) < 0) if (VIR_ALLOC(data) < 0)
return NULL; return NULL;
if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src)) || if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src,
src->backingStore)) ||
!(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false, !(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false,
false, false,
autoreadonly))) autoreadonly)))
......
...@@ -66,7 +66,8 @@ virURIPtr ...@@ -66,7 +66,8 @@ virURIPtr
qemuBlockStorageSourceGetURI(virStorageSourcePtr src); qemuBlockStorageSourceGetURI(virStorageSourcePtr src);
virJSONValuePtr virJSONValuePtr
qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src); qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src,
virStorageSourcePtr backingStore);
virJSONValuePtr virJSONValuePtr
qemuBlockStorageGetCopyOnReadProps(virDomainDiskDefPtr disk); qemuBlockStorageGetCopyOnReadProps(virDomainDiskDefPtr disk);
......
...@@ -226,7 +226,7 @@ testQemuDiskXMLToProps(const void *opaque) ...@@ -226,7 +226,7 @@ testQemuDiskXMLToProps(const void *opaque)
if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0) if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0)
goto cleanup; goto cleanup;
if (!(formatProps = qemuBlockStorageSourceGetBlockdevProps(n)) || if (!(formatProps = qemuBlockStorageSourceGetBlockdevProps(n, n->backingStore)) ||
!(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, false, true, true)) || !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, false, true, true)) ||
!(storageProps = qemuBlockStorageSourceGetBackendProps(n, false, false, true))) { !(storageProps = qemuBlockStorageSourceGetBackendProps(n, false, false, true))) {
if (!data->fail) { if (!data->fail) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册