[PATCH] qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed
by Martin Kletzander
Commit 62627524607f added the acquiring of a job, but it is not always
VIR_ASYNC_JOB_MIGRATION_OUT, so the code fails when doing save or anything else.
Correct the async job by passing it from the caller as another parameter.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
This will hopefully fix the integration tests that failed this morning:
https://gitlab.com/libvirt/libvirt/-/pipelines/594066714
src/qemu/qemu_driver.c | 8 ++++----
src/qemu/qemu_migration.c | 7 ++++---
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_snapshot.c | 4 ++--
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 75c7a8a6b225..9013e6fb8d9a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2651,13 +2651,13 @@ qemuDomainSaveInternal(virQEMUDriver *driver,
virQEMUSaveData *data = NULL;
g_autoptr(qemuDomainSaveCookie) cookie = NULL;
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
- goto cleanup;
-
if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_SAVE,
VIR_DOMAIN_JOB_OPERATION_SAVE, flags) < 0)
goto cleanup;
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SAVE, 0))
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
@@ -3177,7 +3177,7 @@ doCoreDump(virQEMUDriver *driver,
goto cleanup;
}
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_DUMP, 0))
goto cleanup;
if (qemuMigrationSrcToFile(driver, vm, fd, compressor,
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 84befe7d39e7..20dc91f1cedd 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1452,6 +1452,7 @@ bool
qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
virDomainObj *vm,
bool remote,
+ int asyncJob,
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
@@ -1483,7 +1484,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
g_auto(GStrv) blockers = NULL;
if (qemuDomainGetMigrationBlockers(driver, vm,
- VIR_ASYNC_JOB_MIGRATION_OUT,
+ asyncJob,
&blockers) < 0) {
return false;
}
@@ -2637,7 +2638,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_BEGIN3) < 0)
return NULL;
- if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, priv->job.asyncJob, flags))
return NULL;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
@@ -6039,7 +6040,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver,
if (!(flags & VIR_MIGRATE_OFFLINE) && virDomainObjCheckActive(vm) < 0)
goto endjob;
- if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, VIR_ASYNC_JOB_MIGRATION_OUT, flags))
goto endjob;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 65c29d574405..a39f65165988 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -229,6 +229,7 @@ bool
qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
virDomainObj *vm,
bool remote,
+ int asyncJob,
unsigned int flags);
int
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 833f880252af..0733d44faac4 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -291,7 +291,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver,
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
int ret = -1;
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0))
goto cleanup;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@@ -1422,7 +1422,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
/* do the memory snapshot if necessary */
if (memory) {
/* check if migration is possible */
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0))
goto cleanup;
qemuDomainJobSetStatsType(priv->job.current,
--
2.35.1
2 years, 4 months
[PATCH 0/4] jobs: make & use generalized virDomainObjInitJob()
by Kristina Hanicova
This series uses qemuDomainObjInitJob() as virDomainObjInitJob() in all
drivers that use virDomainObjJob structure.
Kristina Hanicova (4):
qemu & hypervisor: move qemuDomainObjInitJob() into hypervisor
libxl: use virDomainObjInitJob()
LXC: use virDomainObjInitJob()
CH: use virDomainObjInitJob()
src/ch/ch_domain.c | 13 +------------
src/hypervisor/domain_job.c | 25 +++++++++++++++++++++++++
src/hypervisor/domain_job.h | 4 ++++
src/libvirt_private.syms | 1 +
src/libxl/libxl_domain.c | 17 +++--------------
src/lxc/lxc_domain.c | 13 +------------
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domainjob.c | 26 --------------------------
src/qemu/qemu_domainjob.h | 4 ----
9 files changed, 36 insertions(+), 69 deletions(-)
--
2.35.3
2 years, 4 months
[PATCH v2 0/8] domain_conf & domain_capabilities: small refactoring
by Kristina Hanicova
diff to v1:
* dropped 1 wrong commit (thanks Daniel)
* improved setting of the variable (suggested by Peter, Michal, Martin)
* extended the switch to include all cases instead of simple if to be
future proof (suggested by Peter)
v1:
https://listman.redhat.com/archives/libvir-list/2022-July/232991.html
Kristina Hanicova (8):
domain_capabilities: use early return in
virDomainCapsFeatureSEVFormat()
domain_capabilities: reformat virDomainCapsFeatureSEVFormat()
domain_capabilities: reformat virDomainCapsCPUCustomFormat()
domain_conf: remove breaks after return in
virDomainChrSourceDefIsEqual()
domain_conf: extend switch with if in virDomainChrDefFree()
domain_conf: use early return in virDomainObjAssignDef()
domain_conf: rewrite conditions in virDomainObjWaitUntil()
domain_conf: rewrite variable setting
src/conf/domain_capabilities.c | 37 ++++++++---------
src/conf/domain_conf.c | 76 +++++++++++++++++-----------------
2 files changed, 55 insertions(+), 58 deletions(-)
--
2.35.3
2 years, 4 months
[libvirt PATCH] qemu_migration: Use EnterMonitorAsync in qemuDomainGetMigrationBlockers
by Jiri Denemark
The code is run with an async job and thus needs to make sure a nested
job is acquired before entering the monitor.
While touching the code in qemuMigrationSrcIsAllowed I also fixed the
grammar which was accidentally broken by v8.5.0-140-g2103807e33.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5d1e5f987b..d83db3a824 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1418,12 +1418,15 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
static int
qemuDomainGetMigrationBlockers(virQEMUDriver *driver,
virDomainObj *vm,
+ int asyncJob,
char ***blockers)
{
qemuDomainObjPrivate *priv = vm->privateData;
int rc;
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ return -1;
+
rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers);
qemuDomainObjExitMonitor(vm);
@@ -1458,10 +1461,12 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
- /* Ask qemu if it have a migration blocker */
+ /* Ask qemu if it has a migration blocker */
if (blockedReasonsCap) {
g_auto(GStrv) blockers = NULL;
- if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
+ if (qemuDomainGetMigrationBlockers(driver, vm,
+ VIR_ASYNC_JOB_MIGRATION_OUT,
+ &blockers) < 0)
return false;
if (blockers && blockers[0]) {
--
2.35.1
2 years, 4 months
[PATCH 0/2] A couple of migration blocker query patches
by Laine Stump
Five minutes after pushing eperezma's patches that query QEMU for
migration blockers, I realized that the query would be called during
"offline migration" (when there is no QEMU process running). So the
1st patch moves the query down so it will only be called during live
migration.
The 2nd patch takes advantage of this new query to skip the hardcoded
check the makes any vfio assigned device a migration blocker. Once
QEMU and the kernel get migration of (some) vfio devices sorted out,
libvirt will allow migration of domains with those devices.
Laine Stump (2):
qemu: don't try to query QEMU about migration blockers during offline
migration
qemu: skip hardcoded hostdev migration check if QEMU can do it for us
src/qemu/qemu_migration.c | 45 ++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 19 deletions(-)
--
2.35.3
2 years, 4 months
[PATCH 0/9] domain_conf & domain_capabilities: small refactoring
by Kristina Hanicova
*** BLURB HERE ***
Kristina Hanicova (9):
domain_capabilities: use early return in
virDomainCapsFeatureSEVFormat()
domain_capabilities: reformat virDomainCapsFeatureSEVFormat()
domain_capabilities: reformat virDomainCapsCPUCustomFormat()
domain_conf: remove breaks after return in
virDomainChrSourceDefIsEqual()
domain_conf: replace switch with if in virDomainChrDefFree()
domain_conf: rewrite virDomainSoundCodecDefFree()
domain_conf: use early return in virDomainObjAssignDef()
domain_conf: rewrite conditions in virDomainObjWaitUntil()
domain_conf: rewrite variable setting to ternary operator
src/conf/domain_capabilities.c | 37 ++++++++-------
src/conf/domain_conf.c | 82 +++++++++++++++-------------------
2 files changed, 53 insertions(+), 66 deletions(-)
--
2.35.3
2 years, 4 months
[libvirt PATCH v4 0/4] Ask qemu about migration blockers
by Eugenio Pérez
There are some hardcoded migration blockers in libvirt, like having a net
vhost-vdpa device. While it's true that they cannot be migrated at the moment,
there are plans to be able to migrate them soon.
They'll put a migration blockers in the cases where you cannot migrate them.
Ask qemu about then before rejecting the migration. In case the question is not
possible, assume they're not migratable.
v4:
* Do not override qemuDomainGetMigrationBlockers error calling again
virReportError.
* Replace ", " with "; " in blockers separators.
v3:
* Return ok in qemuMonitorJSONGetMigrationBlockers is there are no
blockers.
* Fix indentation
* Report all blockers instead of only the first.
* Squash some patches
* Move note to function doc.
* s/QEMU_MIGRATION_BLOCKED_REASONS/QEMU_CAPS_MIGRATION_BLOCKED_REASONS/
v2:
* Ask qemu if it has some pending blockers before try the migration
Eugenio Pérez (3):
qemu_monitor: add support for get qemu migration blockers
qemu_migration: get migration blockers before hardcoded checks
qemu_migration: Do not forbid vDPA devices if can query blockers
Jonathon Jongsma (1):
qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_migration.c | 34 +++++++++++++-
src/qemu/qemu_monitor.c | 11 +++++
src/qemu/qemu_monitor.h | 4 ++
src/qemu/qemu_monitor_json.c | 44 +++++++++++++++++++
src/qemu/qemu_monitor_json.h | 3 ++
.../caps_6.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../caps_6.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
.../caps_6.2.0.x86_64.xml | 1 +
.../caps_7.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
.../caps_7.0.0.x86_64.xml | 1 +
.../caps_7.1.0.x86_64.xml | 1 +
18 files changed, 109 insertions(+), 1 deletion(-)
--
2.31.1
2 years, 4 months
[libvirt PATCH v3 0/4] Ask qemu about migration blockers
by Eugenio Pérez
There are some hardcoded migration blockers in libvirt, like having a net
vhost-vdpa device. While it's true that they cannot be migrated at the moment,
there are plans to be able to migrate them soon.
They'll put a migration blockers in the cases where you cannot migrate them.
Ask qemu about then before rejecting the migration. In case the question is not
possible, assume they're not migratable.
v3:
* Return ok in qemuMonitorJSONGetMigrationBlockers is there are no
blockers.
* Fix indentation
* Report all blockers instead of only the first.
* Squash some patches
* Move note to function doc.
* s/QEMU_MIGRATION_BLOCKED_REASONS/QEMU_CAPS_MIGRATION_BLOCKED_REASONS/
v2:
* Ask qemu if it has some pending blockers before try the migration
Eugenio Pérez (3):
qemu_monitor: add support for get qemu migration blockers
qemu_migration: get migration blockers before hardcoded checks
qemu_migration: Do not forbid vDPA devices if can query blockers
Jonathon Jongsma (1):
qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_migration.c | 38 +++++++++++++++-
src/qemu/qemu_monitor.c | 11 +++++
src/qemu/qemu_monitor.h | 4 ++
src/qemu/qemu_monitor_json.c | 43 +++++++++++++++++++
src/qemu/qemu_monitor_json.h | 3 ++
.../caps_6.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../caps_6.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
.../caps_6.2.0.x86_64.xml | 1 +
.../caps_7.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
.../caps_7.0.0.x86_64.xml | 1 +
.../caps_7.1.0.x86_64.xml | 1 +
18 files changed, 112 insertions(+), 1 deletion(-)
--
2.31.1
2 years, 4 months