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_REOPEN

'blockdev-reopen' is supported since qemu-6.1, thus we can now remove
the interlocks.

Document the change to 'mirror' as this patch removes the last clue why
we overwrite the mirror's readonly state to false unconditionally.

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:48:53 +01:00
parent 5ec6318c05
commit 4983cb62e6
3 changed files with 6 additions and 22 deletions

View File

@ -968,10 +968,6 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObj *vm,
g_autoptr(virJSONValue) actions = NULL;
bool active = job->type == QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT;
if (!active &&
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
return 0;
if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
return -1;
@ -1205,9 +1201,6 @@ qemuBlockJobProcessEventCompletedCopyBitmaps(virDomainObj *vm,
g_autoptr(virJSONValue) actions = NULL;
bool shallow = job->jobflags & VIR_DOMAIN_BLOCK_COPY_SHALLOW;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
return 0;
if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
return -1;
@ -1237,7 +1230,6 @@ qemuBlockJobProcessEventConcludedCopyPivot(virQEMUDriver *driver,
qemuBlockJobData *job,
virDomainAsyncJob asyncJob)
{
qemuDomainObjPrivate *priv = vm->privateData;
g_autoptr(virStorageSource) src = NULL;
VIR_DEBUG("copy job '%s' on VM '%s' pivoted", job->name, vm->def->name);
@ -1257,8 +1249,7 @@ qemuBlockJobProcessEventConcludedCopyPivot(virQEMUDriver *driver,
!virStorageSourceIsBacking(job->disk->mirror->backingStore))
job->disk->mirror->backingStore = g_steal_pointer(&job->disk->src->backingStore);
if (job->disk->src->readonly &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
if (job->disk->src->readonly)
ignore_value(qemuBlockReopenReadOnly(vm, job->disk->mirror, asyncJob));
qemuBlockJobRewriteConfigDiskSource(vm, job->disk, job->disk->mirror);

View File

@ -225,8 +225,7 @@ qemuCheckpointDiscardBitmaps(virDomainObj *vm,
false, false, false) < 0)
goto relabel;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) &&
qemuBlockReopenReadWrite(vm, src, VIR_ASYNC_JOB_NONE) < 0)
if (qemuBlockReopenReadWrite(vm, src, VIR_ASYNC_JOB_NONE) < 0)
goto relabel;
relabelimages = g_slist_prepend(relabelimages, src);
@ -240,8 +239,7 @@ qemuCheckpointDiscardBitmaps(virDomainObj *vm,
for (next = relabelimages; next; next = next->next) {
virStorageSource *src = next->data;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
ignore_value(qemuBlockReopenReadOnly(vm, src, VIR_ASYNC_JOB_NONE));
ignore_value(qemuBlockReopenReadOnly(vm, src, VIR_ASYNC_JOB_NONE));
ignore_value(qemuDomainStorageSourceAccessAllow(driver, vm, src,
true, false, false));

View File

@ -14260,14 +14260,9 @@ qemuDomainBlockCopyCommon(virDomainObj *vm,
keepParentLabel) < 0)
goto endjob;
if (mirror->readonly) {
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("copy of read-only disks is not supported"));
goto endjob;
}
mirror->readonly = false;
}
/* In case we're copying a read-only disk we need to open the mirror image
* as read-write for the duration of the copy job */
mirror->readonly = false;
/* we must initialize XML-provided chain prior to detecting to keep semantics
* with VM startup */