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

qemu: snapshot: Skip overlay file creation/interogation if unsupported

With blockdev we'll be able to support protocols which are not supported
by the storage backends in libvirt. This means that we have to be able
to skip the creation and relative storage path reading if it's not
supported. This will make it impossible to use relative backing for
network protocols but that would be almost insane anyways.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e3189f7c
......@@ -15316,6 +15316,8 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
{
char *backingStoreStr;
virDomainDiskDefPtr persistdisk;
bool supportsCreate;
bool supportsBacking;
dd->disk = disk;
......@@ -15343,31 +15345,38 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
return -1;
}
if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
return -1;
dd->initialized = true;
supportsCreate = virStorageFileSupportsCreate(dd->src);
supportsBacking = virStorageFileSupportsBackingChainTraversal(dd->src);
/* relative backing store paths need to be updated so that relative
* block commit still works */
if (reuse) {
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
if (supportsCreate || supportsBacking) {
if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0)
return -1;
if (backingStoreStr != NULL) {
if (virStorageIsRelative(backingStoreStr))
VIR_STEAL_PTR(dd->relPath, backingStoreStr);
else
VIR_FREE(backingStoreStr);
}
} else {
/* pre-create the image file so that we can label it before handing it to qemu */
if (dd->src->type != VIR_STORAGE_TYPE_BLOCK) {
if (virStorageFileCreate(dd->src) < 0) {
virReportSystemError(errno, _("failed to create image file '%s'"),
NULLSTR(dd->src->path));
return -1;
dd->initialized = true;
/* relative backing store paths need to be updated so that relative
* block commit still works */
if (reuse) {
if (supportsBacking) {
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
return -1;
if (backingStoreStr != NULL) {
if (virStorageIsRelative(backingStoreStr))
VIR_STEAL_PTR(dd->relPath, backingStoreStr);
else
VIR_FREE(backingStoreStr);
}
}
} else {
/* pre-create the image file so that we can label it before handing it to qemu */
if (supportsCreate && dd->src->type != VIR_STORAGE_TYPE_BLOCK) {
if (virStorageFileCreate(dd->src) < 0) {
virReportSystemError(errno, _("failed to create image file '%s'"),
NULLSTR(dd->src->path));
return -1;
}
dd->created = true;
}
dd->created = true;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册