forked from rpms/libvirt
libvirt-9.0.0-5.el9
- qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR (rhbz#2168762) - qemu: blockjob: Handle 'pending' blockjob state only when we need it (rhbz#2168769) Resolves: rhbz#2168762, rhbz#2168769
This commit is contained in:
parent
18102c088b
commit
e5cf731e40
@ -0,0 +1,117 @@
|
|||||||
|
From 11dd7c99fa96364962f81d4efae0ed220c7a7190 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <11dd7c99fa96364962f81d4efae0ed220c7a7190@dist-git>
|
||||||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Date: Fri, 10 Feb 2023 17:16:43 +0100
|
||||||
|
Subject: [PATCH] qemu: blockjob: Handle 'pending' blockjob state only when we
|
||||||
|
need it
|
||||||
|
|
||||||
|
The 'pending' state needs to be handled by the blockjob code only when
|
||||||
|
the snapshot code requests a block-commit without auto-finalization.
|
||||||
|
|
||||||
|
If we always handle it we fail to properly remove the blockjob data for
|
||||||
|
the 'blockdev-create' job as that also transitions trhough 'pending' but
|
||||||
|
we'd never update it once it reaches 'concluded' as the code already
|
||||||
|
thinks that the job has finished and is no longer watching it.
|
||||||
|
|
||||||
|
Introduce a 'processPending' property into block job data and set it
|
||||||
|
only when we know that we need to process 'pending'.
|
||||||
|
|
||||||
|
Fixes: 90d9bc9d74a5157167548b26c00b1a016655e295
|
||||||
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168769
|
||||||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
||||||
|
(cherry picked from commit c433c2434c0459df98ed3355ef615e341acd9009)
|
||||||
|
---
|
||||||
|
src/qemu/qemu_block.c | 1 +
|
||||||
|
src/qemu/qemu_blockjob.c | 19 ++++++++++---------
|
||||||
|
src/qemu/qemu_blockjob.h | 4 ++++
|
||||||
|
3 files changed, 15 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
||||||
|
index c218262691..d8ca50d618 100644
|
||||||
|
--- a/src/qemu/qemu_block.c
|
||||||
|
+++ b/src/qemu/qemu_block.c
|
||||||
|
@@ -3374,6 +3374,7 @@ qemuBlockCommit(virDomainObj *vm,
|
||||||
|
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
|
||||||
|
baseSource,
|
||||||
|
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
|
||||||
|
+ autofinalize,
|
||||||
|
flags)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
|
||||||
|
index cb2d05d71d..a20cf1db62 100644
|
||||||
|
--- a/src/qemu/qemu_blockjob.c
|
||||||
|
+++ b/src/qemu/qemu_blockjob.c
|
||||||
|
@@ -274,6 +274,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
|
||||||
|
virStorageSource *top,
|
||||||
|
virStorageSource *base,
|
||||||
|
bool delete_imgs,
|
||||||
|
+ virTristateBool autofinalize,
|
||||||
|
unsigned int jobflags)
|
||||||
|
{
|
||||||
|
g_autoptr(qemuBlockJobData) job = NULL;
|
||||||
|
@@ -290,6 +291,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
|
||||||
|
job->data.commit.top = top;
|
||||||
|
job->data.commit.base = base;
|
||||||
|
job->data.commit.deleteCommittedImages = delete_imgs;
|
||||||
|
+ job->processPending = autofinalize == VIR_TRISTATE_BOOL_NO;
|
||||||
|
job->jobflags = jobflags;
|
||||||
|
|
||||||
|
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
|
||||||
|
@@ -532,8 +534,6 @@ qemuBlockJobRefreshJobs(virDomainObj *vm)
|
||||||
|
if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
|
||||||
|
job->state == QEMU_BLOCKJOB_STATE_RUNNING)
|
||||||
|
job->newstate = newstate;
|
||||||
|
- } else if (newstate == QEMU_BLOCKJOB_STATE_PENDING) {
|
||||||
|
- job->newstate = newstate;
|
||||||
|
}
|
||||||
|
/* don't update the job otherwise */
|
||||||
|
}
|
||||||
|
@@ -1568,13 +1568,14 @@ qemuBlockJobEventProcess(virQEMUDriver *driver,
|
||||||
|
|
||||||
|
case QEMU_BLOCKJOB_STATE_PENDING:
|
||||||
|
/* Similarly as for 'ready' state we should handle it only when
|
||||||
|
- * previous state was 'new' or 'running' as there are other cases
|
||||||
|
- * when it can be emitted by QEMU. Currently we need this only when
|
||||||
|
- * deleting non-active external snapshots. */
|
||||||
|
- if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
|
||||||
|
- job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
|
||||||
|
- job->state = job->newstate;
|
||||||
|
- qemuDomainSaveStatus(vm);
|
||||||
|
+ * previous state was 'new' or 'running' and only if the blockjob code
|
||||||
|
+ * is handling finalization of the job explicitly. */
|
||||||
|
+ if (job->processPending) {
|
||||||
|
+ if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
|
||||||
|
+ job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
|
||||||
|
+ job->state = job->newstate;
|
||||||
|
+ qemuDomainSaveStatus(vm);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
job->newstate = -1;
|
||||||
|
break;
|
||||||
|
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
|
||||||
|
index e9b283da20..f1ac43b4c7 100644
|
||||||
|
--- a/src/qemu/qemu_blockjob.h
|
||||||
|
+++ b/src/qemu/qemu_blockjob.h
|
||||||
|
@@ -138,6 +138,9 @@ struct _qemuBlockJobData {
|
||||||
|
|
||||||
|
int brokentype; /* the previous type of a broken blockjob qemuBlockJobType */
|
||||||
|
|
||||||
|
+ bool processPending; /* process the 'pending' state of the job, if the job
|
||||||
|
+ should not be auto-finalized */
|
||||||
|
+
|
||||||
|
bool invalidData; /* the job data (except name) is not valid */
|
||||||
|
bool reconnected; /* internal field for tracking whether job is live after reconnect to qemu */
|
||||||
|
};
|
||||||
|
@@ -175,6 +178,7 @@ qemuBlockJobDiskNewCommit(virDomainObj *vm,
|
||||||
|
virStorageSource *top,
|
||||||
|
virStorageSource *base,
|
||||||
|
bool delete_imgs,
|
||||||
|
+ virTristateBool autofinalize,
|
||||||
|
unsigned int jobflags);
|
||||||
|
|
||||||
|
qemuBlockJobData *
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From d78fc22fb96e0050a419623bf27639c63624c998 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <d78fc22fb96e0050a419623bf27639c63624c998@dist-git>
|
||||||
|
From: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Date: Fri, 10 Feb 2023 09:47:05 +0100
|
||||||
|
Subject: [PATCH] qemu_extdevice: Do cleanup host only for
|
||||||
|
VIR_DOMAIN_TPM_TYPE_EMULATOR
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
We only set up host for VIR_DOMAIN_TPM_TYPE_EMULATOR and thus
|
||||||
|
similarly, we should do cleanup for the same type. This also
|
||||||
|
fixes a crasher, in which qemuTPMEmulatorCleanupHost() accesses
|
||||||
|
tpm->data.emulator.storagepath which is NULL for
|
||||||
|
VIR_DOMAIN_TPM_TYPE_EXTERNAL.
|
||||||
|
|
||||||
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168762
|
||||||
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||||
|
(cherry picked from commit 03f76e577d66f8eea6aa7cc513e75026527b4cda)
|
||||||
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
---
|
||||||
|
src/qemu/qemu_extdevice.c | 5 ++++-
|
||||||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
|
||||||
|
index f7b2e2e653..fdefe59215 100644
|
||||||
|
--- a/src/qemu/qemu_extdevice.c
|
||||||
|
+++ b/src/qemu/qemu_extdevice.c
|
||||||
|
@@ -162,7 +162,10 @@ qemuExtDevicesCleanupHost(virQEMUDriver *driver,
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < def->ntpms; i++) {
|
||||||
|
- qemuExtTPMCleanupHost(def->tpms[i], flags, outgoingMigration);
|
||||||
|
+ virDomainTPMDef *tpm = def->tpms[i];
|
||||||
|
+
|
||||||
|
+ if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR)
|
||||||
|
+ qemuExtTPMCleanupHost(tpm, flags, outgoingMigration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
@ -229,7 +229,7 @@
|
|||||||
Summary: Library providing a simple virtualization API
|
Summary: Library providing a simple virtualization API
|
||||||
Name: libvirt
|
Name: libvirt
|
||||||
Version: 9.0.0
|
Version: 9.0.0
|
||||||
Release: 4%{?dist}%{?extra_release}
|
Release: 5%{?dist}%{?extra_release}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://libvirt.org/
|
URL: https://libvirt.org/
|
||||||
|
|
||||||
@ -263,6 +263,8 @@ Patch22: libvirt-qemuProcessLaunch-Tighten-rules-for-external-devices-wrt-incomi
|
|||||||
Patch23: libvirt-qemu_process-Produce-better-debug-message-wrt-domain-namespaces.patch
|
Patch23: libvirt-qemu_process-Produce-better-debug-message-wrt-domain-namespaces.patch
|
||||||
Patch24: libvirt-qemu_namespace-Deal-with-nested-mounts-when-umount-ing-dev.patch
|
Patch24: libvirt-qemu_namespace-Deal-with-nested-mounts-when-umount-ing-dev.patch
|
||||||
Patch25: libvirt-qemuProcessRefreshDisks-Don-t-skip-filling-of-disk-information-if-tray-state-didn-t-change.patch
|
Patch25: libvirt-qemuProcessRefreshDisks-Don-t-skip-filling-of-disk-information-if-tray-state-didn-t-change.patch
|
||||||
|
Patch26: libvirt-qemu_extdevice-Do-cleanup-host-only-for-VIR_DOMAIN_TPM_TYPE_EMULATOR.patch
|
||||||
|
Patch27: libvirt-qemu-blockjob-Handle-pending-blockjob-state-only-when-we-need-it.patch
|
||||||
|
|
||||||
|
|
||||||
Requires: libvirt-daemon = %{version}-%{release}
|
Requires: libvirt-daemon = %{version}-%{release}
|
||||||
@ -2353,6 +2355,10 @@ exit 0
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 13 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-5
|
||||||
|
- qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR (rhbz#2168762)
|
||||||
|
- qemu: blockjob: Handle 'pending' blockjob state only when we need it (rhbz#2168769)
|
||||||
|
|
||||||
* Thu Feb 9 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-4
|
* Thu Feb 9 2023 Jiri Denemark <jdenemar@redhat.com> - 9.0.0-4
|
||||||
- qemuProcessStop: Fix detection of outgoing migration for external devices (rhbz#2161557)
|
- qemuProcessStop: Fix detection of outgoing migration for external devices (rhbz#2161557)
|
||||||
- qemuExtTPMStop: Restore TPM state label more often (rhbz#2161557)
|
- qemuExtTPMStop: Restore TPM state label more often (rhbz#2161557)
|
||||||
|
Loading…
Reference in New Issue
Block a user