1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemu: Always assume support for QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY

qemu supports the @allow-write-only-overlay feature since qemu-5.0.
Remove the alternate code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2025-03-12 16:56:29 +01:00
parent 514c1f8dda
commit 2f4e76a770
3 changed files with 9 additions and 21 deletions

View File

@ -3826,7 +3826,6 @@ qemuBlockPivot(virDomainObj *vm,
* to copy data into the backing chain while the top image is being
* copied shallow */
if (reuse && shallow &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY) &&
virStorageSourceHasBacking(disk->mirror)) {
if (qemuProcessPrepareHostStorageSourceChain(vm, disk->mirror->backingStore) < 0)

View File

@ -1268,7 +1268,6 @@ qemuBlockJobProcessEventConcludedCopyAbort(virQEMUDriver *driver,
qemuBlockJobData *job,
virDomainAsyncJob asyncJob)
{
qemuDomainObjPrivate *priv = vm->privateData;
g_autoptr(virStorageSource) mirror = NULL;
VIR_DEBUG("copy job '%s' on VM '%s' aborted", job->name, vm->def->name);
@ -1283,12 +1282,10 @@ qemuBlockJobProcessEventConcludedCopyAbort(virQEMUDriver *driver,
bool reuse = job->jobflags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT;
/* In the special case of a shallow copy with reused image we don't
* hotplug the full chain when QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY
* is supported. Attempting to delete it would thus result in spurious
* errors as we'd attempt to blockdev-del images which were not added
* yet */
* hotplug the full chain. Attempting to delete it would thus result in
* spurious errors as we'd attempt to blockdev-del images which were
* not added yet */
if (reuse && shallow &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY) &&
virStorageSourceHasBacking(job->disk->mirror))
g_clear_pointer(&job->disk->mirror->backingStore, virObjectUnref);
}

View File

@ -14299,22 +14299,14 @@ qemuDomainBlockCopyCommon(virDomainObj *vm,
* level is being copied. To restore this semantics if
* blockdev-reopen is supported defer opening of the backing chain
* of 'mirror' to the pivot step */
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY)) {
g_autoptr(virStorageSource) terminator = virStorageSourceNew();
g_autoptr(virStorageSource) terminator = virStorageSourceNew();
if (qemuProcessPrepareHostStorageSource(vm, mirror) < 0)
goto endjob;
if (qemuProcessPrepareHostStorageSource(vm, mirror) < 0)
goto endjob;
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(mirror,
terminator)))
goto endjob;
} else {
if (qemuProcessPrepareHostStorageSourceChain(vm, mirror) < 0)
goto endjob;
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(mirror)))
goto endjob;
}
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(mirror,
terminator)))
goto endjob;
} else {
if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, VIR_ASYNC_JOB_NONE)))
goto endjob;