mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
qemu: Defer support checks for external active snapshots to blockdev code or qemu
Remove libvirt's support check for the target of an external snapshot to the blockdev code or qemu. This will potentially require a more complex cleanup but removes a level of hardcoded feature checks. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a3f8abb003
commit
a6aad9f29f
@ -14917,7 +14917,8 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk,
|
qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk,
|
||||||
virDomainDiskDefPtr domdisk)
|
virDomainDiskDefPtr domdisk,
|
||||||
|
bool blockdev)
|
||||||
{
|
{
|
||||||
int actualType = virStorageSourceGetActualType(snapdisk->src);
|
int actualType = virStorageSourceGetActualType(snapdisk->src);
|
||||||
|
|
||||||
@ -14934,6 +14935,10 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_STORAGE_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
|
/* defer all of the checking to either qemu or libvirt's blockdev code */
|
||||||
|
if (blockdev)
|
||||||
|
break;
|
||||||
|
|
||||||
switch ((virStorageNetProtocol) snapdisk->src->protocol) {
|
switch ((virStorageNetProtocol) snapdisk->src->protocol) {
|
||||||
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
|
||||||
break;
|
break;
|
||||||
@ -14981,7 +14986,8 @@ static int
|
|||||||
qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
|
qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
|
||||||
virDomainSnapshotDiskDefPtr snapdisk,
|
virDomainSnapshotDiskDefPtr snapdisk,
|
||||||
bool active,
|
bool active,
|
||||||
bool reuse)
|
bool reuse,
|
||||||
|
bool blockdev)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int err;
|
int err;
|
||||||
@ -15004,7 +15010,7 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk,
|
|||||||
if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0)
|
if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk) < 0)
|
if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk, blockdev) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15105,6 +15111,8 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
|||||||
virDomainSnapshotDefPtr def,
|
virDomainSnapshotDefPtr def,
|
||||||
unsigned int *flags)
|
unsigned int *flags)
|
||||||
{
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
bool active = virDomainObjIsActive(vm);
|
bool active = virDomainObjIsActive(vm);
|
||||||
@ -15163,7 +15171,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainSnapshotPrepareDiskExternal(dom_disk, disk,
|
if (qemuDomainSnapshotPrepareDiskExternal(dom_disk, disk,
|
||||||
active, reuse) < 0)
|
active, reuse, blockdev) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
external++;
|
external++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user