]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Always assume support for QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY
authorPeter Krempa <pkrempa@redhat.com>
Wed, 12 Mar 2025 15:56:29 +0000 (16:56 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 13 Mar 2025 14:38:16 +0000 (15:38 +0100)
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>
src/qemu/qemu_block.c
src/qemu/qemu_blockjob.c
src/qemu/qemu_driver.c

index eb0621463e34ae92b1d248031297631e28c180bd..76e7f4ca833c0c79aa67d7469571b7b82b98bc0a 100644 (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)
index be18f7b27366c897c45e80dbf43a95f0e277a75a..7b7d54fdcaf8a0a2e9605b364bb9441090257551 100644 (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);
     }
index ef731cb07262ed14eb684e2644b2a29285a35836..f974d2fba8160180b0948a4351f2b0fa20a5acad 100644 (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 (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(mirror,
-                                                                             terminator)))
-                goto endjob;
-        } else {
-            if (qemuProcessPrepareHostStorageSourceChain(vm, mirror) < 0)
-                goto endjob;
+        if (qemuProcessPrepareHostStorageSource(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;