提交 527f377a 编写于 作者: C Cole Robinson

storagefile: Fill in meta->externalDataStore

Add virStorageSourceNewFromExternalData, similar to
virStorageSourceNewFromBacking and use it to fill in a
virStorageSource for externalDataStore
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 884cc9d6
...@@ -3800,6 +3800,24 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent, ...@@ -3800,6 +3800,24 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent,
} }
static int
virStorageSourceNewFromExternalData(virStorageSourcePtr parent,
virStorageSourcePtr *externalDataStore)
{
int rc;
if ((rc = virStorageSourceNewFromChild(parent,
parent->externalDataStoreRaw,
externalDataStore)) < 0)
return rc;
/* qcow2 data_file can only be raw */
(*externalDataStore)->format = VIR_STORAGE_FILE_RAW;
(*externalDataStore)->readonly = parent->readonly;
return rc;
}
/** /**
* @src: disk source definition structure * @src: disk source definition structure
* @fd: file descriptor * @fd: file descriptor
...@@ -5008,6 +5026,23 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src, ...@@ -5008,6 +5026,23 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
} }
VIR_STEAL_PTR(src->backingStore, backingStore); VIR_STEAL_PTR(src->backingStore, backingStore);
if (src->externalDataStoreRaw) {
VIR_AUTOUNREF(virStorageSourcePtr) externalDataStore = NULL;
if ((rv = virStorageSourceNewFromExternalData(src,
&externalDataStore)) < 0)
goto cleanup;
if (rv == 1) {
/* the file would not be usable for VM usage */
ret = 0;
goto cleanup;
}
VIR_STEAL_PTR(src->externalDataStore, externalDataStore);
}
ret = 0; ret = 0;
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册