libvirt-8.5.0-3.el9
- qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS (rhbz#2092833) - qemu: new function to retrieve migration blocker reasons from QEMU (rhbz#2092833) - qemu: query QEMU for migration blockers before our own harcoded checks (rhbz#2092833) - qemu: remove hardcoded migration fail for vDPA devices if we can ask QEMU (rhbz#2092833) - qemu_migration: Use EnterMonitorAsync in qemuDomainGetMigrationBlockers (rhbz#2092833) - qemu: don't try to query QEMU about migration blockers during offline migration (rhbz#2092833) - qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed (rhbz#2092833) - virsh: Require --xpath for *dumpxml (rhbz#2103524) - qemu: skip hardcoded hostdev migration check if QEMU can do it for us (rhbz#1497907) Resolves: rhbz#1497907, rhbz#2092833, rhbz#2103524
This commit is contained in:
parent
57b51a5b9e
commit
1dc8926705
@ -0,0 +1,87 @@
|
||||
From 80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb@dist-git>
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 01:56:11 -0400
|
||||
Subject: [PATCH] qemu: don't try to query QEMU about migration blockers during
|
||||
offline migration
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The new code that queries QEMU about migration blockers was put at the
|
||||
top of qemuMigrationSrcIsAllowed(), but that function can also be
|
||||
called in the case of offline migration (ie when the domain is
|
||||
inactive / QEMU isn't running). This check should have been put inside
|
||||
the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move
|
||||
it there.
|
||||
|
||||
Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31
|
||||
Signed-off-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 2dd5587f1dc8e2cf4e6e0a4e4cf576b8183b33cd)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 39 +++++++++++++++++++++------------------
|
||||
1 file changed, 21 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 735eb02673..96c4c0f1da 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -1458,24 +1458,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
int nsnapshots;
|
||||
int pauseReason;
|
||||
size_t i;
|
||||
- bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
|
||||
- QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
|
||||
-
|
||||
- /* Ask qemu if it has a migration blocker */
|
||||
- if (blockedReasonsCap) {
|
||||
- g_auto(GStrv) blockers = NULL;
|
||||
- if (qemuDomainGetMigrationBlockers(driver, vm,
|
||||
- VIR_ASYNC_JOB_MIGRATION_OUT,
|
||||
- &blockers) < 0)
|
||||
- return false;
|
||||
-
|
||||
- if (blockers && blockers[0]) {
|
||||
- g_autofree char *reasons = g_strjoinv("; ", blockers);
|
||||
- virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
- _("cannot migrate domain: %s"), reasons);
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
|
||||
/* perform these checks only when migrating to remote hosts */
|
||||
if (remote) {
|
||||
@@ -1493,6 +1475,27 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
|
||||
/* following checks don't make sense for offline migration */
|
||||
if (!(flags & VIR_MIGRATE_OFFLINE)) {
|
||||
+ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
|
||||
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
|
||||
+
|
||||
+ /* Ask qemu if it has a migration blocker */
|
||||
+ if (blockedReasonsCap) {
|
||||
+ g_auto(GStrv) blockers = NULL;
|
||||
+
|
||||
+ if (qemuDomainGetMigrationBlockers(driver, vm,
|
||||
+ VIR_ASYNC_JOB_MIGRATION_OUT,
|
||||
+ &blockers) < 0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (blockers && blockers[0]) {
|
||||
+ g_autofree char *reasons = g_strjoinv("; ", blockers);
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
+ _("cannot migrate domain: %s"), reasons);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (remote) {
|
||||
/* cancel migration if disk I/O error is emitted while migrating */
|
||||
if (flags & VIR_MIGRATE_ABORT_ON_ERROR &&
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,206 @@
|
||||
From 81f8b07ed1e4e485ded7f366739c110351120785 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <81f8b07ed1e4e485ded7f366739c110351120785@dist-git>
|
||||
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 19:29:05 +0200
|
||||
Subject: [PATCH] qemu: introduce capability
|
||||
QEMU_CAPS_MIGRATION_BLOCKED_REASONS
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
since qemu 6.0, if migration is blocked for some reason, 'query-migrate'
|
||||
will return an array of error strings describing the migration blockers.
|
||||
This can be used to check whether there are any devices blocking
|
||||
migration, etc.
|
||||
|
||||
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
|
||||
(cherry picked from commit 1e9d84d9f9513a73572842db30e3d1445e892291)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 2 ++
|
||||
src/qemu/qemu_capabilities.h | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 +
|
||||
13 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 8586930266..48002f3b58 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -671,6 +671,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
||||
"chardev.qemu-vdagent", /* QEMU_CAPS_CHARDEV_QEMU_VDAGENT */
|
||||
"display-dbus", /* QEMU_CAPS_DISPLAY_DBUS */
|
||||
"iothread.thread-pool-max", /* QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX */
|
||||
+ "migration.blocked-reasons", /* QEMU_CAPS_MIGRATION_BLOCKED_REASONS */
|
||||
);
|
||||
|
||||
|
||||
@@ -1623,6 +1624,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
|
||||
{ "chardev-add/arg-type/backend/+qemu-vdagent", QEMU_CAPS_CHARDEV_QEMU_VDAGENT },
|
||||
{ "query-display-options/ret-type/+dbus", QEMU_CAPS_DISPLAY_DBUS },
|
||||
{ "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX },
|
||||
+ { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS },
|
||||
};
|
||||
|
||||
typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 6f35ba1485..570e43292d 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -650,6 +650,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
||||
QEMU_CAPS_CHARDEV_QEMU_VDAGENT, /* -chardev qemu-vdagent */
|
||||
QEMU_CAPS_DISPLAY_DBUS, /* -display dbus */
|
||||
QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX, /* -object iothread.thread-pool-max */
|
||||
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS, /* query-migrate returns 'blocked-reasons */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
index 4b4cc2d3aa..3e48d17811 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
@@ -189,6 +189,7 @@
|
||||
<flag name='memory-backend-file.prealloc-threads'/>
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
index 06543071aa..790b7221d4 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
@@ -147,6 +147,7 @@
|
||||
<flag name='memory-backend-file.prealloc-threads'/>
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>39100242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
index 8c61bf8a84..86c3732c72 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
@@ -231,6 +231,7 @@
|
||||
<flag name='memory-backend-file.prealloc-threads'/>
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
index afd8f606eb..bd76a7a398 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
@@ -236,6 +236,7 @@
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6001000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
index 86fc46918f..6ed51ec796 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
@@ -201,6 +201,7 @@
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6001050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700244</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
index 983b54430d..1a98fe122e 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
@@ -196,6 +196,7 @@
|
||||
<flag name='memory-backend-file.prealloc-threads'/>
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900244</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
index 19605d93ae..a77efaaa37 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
@@ -238,6 +238,7 @@
|
||||
<flag name='virtio-iommu-pci'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100244</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
|
||||
index e24e2235fb..6848a075a8 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
|
||||
@@ -209,6 +209,7 @@
|
||||
<flag name='virtio-iommu.boot-bypass'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>6002092</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
|
||||
index 83e0f50e3a..cf4286b78b 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
|
||||
@@ -213,6 +213,7 @@
|
||||
<flag name='virtio-iommu.boot-bypass'/>
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>7000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
|
||||
index 05f844fd5b..8e2c1652f9 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
|
||||
@@ -243,6 +243,7 @@
|
||||
<flag name='virtio-net.rss'/>
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
<flag name='display-dbus'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>7000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
|
||||
index 3707d9b7c9..9bdb207c4e 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
|
||||
@@ -244,6 +244,7 @@
|
||||
<flag name='chardev.qemu-vdagent'/>
|
||||
<flag name='display-dbus'/>
|
||||
<flag name='iothread.thread-pool-max'/>
|
||||
+ <flag name='migration.blocked-reasons'/>
|
||||
<version>7000050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100244</microcodeVersion>
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,140 @@
|
||||
From 90d326f60706a990db3ed49ba338d911471578c0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <90d326f60706a990db3ed49ba338d911471578c0@dist-git>
|
||||
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 19:29:10 +0200
|
||||
Subject: [PATCH] qemu: new function to retrieve migration blocker reasons from
|
||||
QEMU
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since QEMU 6.0, if migration is blocked for some reason,
|
||||
'query-migrate' will return an array of error strings describing the
|
||||
migration blockers. This can be used to check whether there are any
|
||||
devices, or other conditions, that would cause migration to fail.
|
||||
|
||||
This patch adds a function that sends this query via a QMP command and
|
||||
returns the resulting array of reasons. qemuMigrationSrcIsAllowed()
|
||||
will be able to use the new function to ask QEMU for migration
|
||||
blockers, instead of the hardcoded guesses that libvirt currently has.
|
||||
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
|
||||
(cherry picked from commit 7e52c4839fabac2d19c6f22c99142e992e3d898e)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_monitor.c | 12 ++++++++++
|
||||
src/qemu/qemu_monitor.h | 4 ++++
|
||||
src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++++++++
|
||||
src/qemu/qemu_monitor_json.h | 3 +++
|
||||
4 files changed, 65 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
||||
index fda5d2f368..865a3e69ed 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -4541,3 +4541,15 @@ qemuMonitorMigrateRecover(qemuMonitor *mon,
|
||||
|
||||
return qemuMonitorJSONMigrateRecover(mon, uri);
|
||||
}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
|
||||
+ char ***blockers)
|
||||
+{
|
||||
+ VIR_DEBUG("blockers=%p", blockers);
|
||||
+
|
||||
+ QEMU_CHECK_MONITOR(mon);
|
||||
+
|
||||
+ return qemuMonitorJSONGetMigrationBlockers(mon, blockers);
|
||||
+}
|
||||
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
||||
index 95267ec6c7..0c3f023419 100644
|
||||
--- a/src/qemu/qemu_monitor.h
|
||||
+++ b/src/qemu/qemu_monitor.h
|
||||
@@ -1554,3 +1554,7 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon,
|
||||
int
|
||||
qemuMonitorMigrateRecover(qemuMonitor *mon,
|
||||
const char *uri);
|
||||
+
|
||||
+int
|
||||
+qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
|
||||
+ char ***blockers);
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index 3aad2ab212..84f4589c42 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -3434,6 +3434,52 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
+/*
|
||||
+ * Get the exposed migration blockers.
|
||||
+ *
|
||||
+ * This function assume qemu has the capability of request them.
|
||||
+ *
|
||||
+ * It returns a NULL terminated array on blockers if there are any, or it set
|
||||
+ * it to NULL otherwise.
|
||||
+ */
|
||||
+int
|
||||
+qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon,
|
||||
+ char ***blockers)
|
||||
+{
|
||||
+ g_autoptr(virJSONValue) cmd = NULL;
|
||||
+ g_autoptr(virJSONValue) reply = NULL;
|
||||
+ virJSONValue *data;
|
||||
+ virJSONValue *jblockers;
|
||||
+ size_t i;
|
||||
+
|
||||
+ *blockers = NULL;
|
||||
+ if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate", NULL)))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ data = virJSONValueObjectGetObject(reply, "return");
|
||||
+
|
||||
+ if (!(jblockers = virJSONValueObjectGetArray(data, "blocked-reasons")))
|
||||
+ return 0;
|
||||
+
|
||||
+ *blockers = g_new0(char *, virJSONValueArraySize(jblockers) + 1);
|
||||
+ for (i = 0; i < virJSONValueArraySize(jblockers); i++) {
|
||||
+ virJSONValue *jblocker = virJSONValueArrayGet(jblockers, i);
|
||||
+ const char *blocker = virJSONValueGetString(jblocker);
|
||||
+
|
||||
+ (*blockers)[i] = g_strdup(blocker);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
int qemuMonitorJSONMigrateCancel(qemuMonitor *mon)
|
||||
{
|
||||
g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("migrate_cancel", NULL);
|
||||
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
||||
index ad3853ae69..4e7d6a1a8d 100644
|
||||
--- a/src/qemu/qemu_monitor_json.h
|
||||
+++ b/src/qemu/qemu_monitor_json.h
|
||||
@@ -199,6 +199,9 @@ qemuMonitorJSONMigrate(qemuMonitor *mon,
|
||||
unsigned int flags,
|
||||
const char *uri);
|
||||
int
|
||||
+qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon,
|
||||
+ char ***blockers);
|
||||
+int
|
||||
qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitor *mon,
|
||||
bool *spice_migrated);
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,80 @@
|
||||
From 9764a6c484d4f3586b0e0be33e8c53de63b11edd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9764a6c484d4f3586b0e0be33e8c53de63b11edd@dist-git>
|
||||
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 19:29:13 +0200
|
||||
Subject: [PATCH] qemu: query QEMU for migration blockers before our own
|
||||
harcoded checks
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since QEMU 6.0, if QEMU knows that a migration would fail,
|
||||
'query-migrate' will return an array of error strings describing the
|
||||
migration blockers. This can be used to check whether there are any
|
||||
devices/conditions blocking migration.
|
||||
|
||||
This patch adds a call to this query at the top of
|
||||
qemuMigrationSrcIsAllowed().
|
||||
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
|
||||
(cherry picked from commit 156e99f686690855be4e45d9b8b3194191a8bc31)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 30 ++++++++++++++++++++++++++++++
|
||||
1 file changed, 30 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 2a6b7b7819..cfb7626bb0 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -1415,6 +1415,22 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+qemuDomainGetMigrationBlockers(virQEMUDriver *driver,
|
||||
+ virDomainObj *vm,
|
||||
+ char ***blockers)
|
||||
+{
|
||||
+ qemuDomainObjPrivate *priv = vm->privateData;
|
||||
+ int rc;
|
||||
+
|
||||
+ qemuDomainObjEnterMonitor(driver, vm);
|
||||
+ rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers);
|
||||
+ qemuDomainObjExitMonitor(vm);
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* qemuMigrationSrcIsAllowed:
|
||||
* @driver: qemu driver struct
|
||||
@@ -1440,6 +1456,20 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
int pauseReason;
|
||||
size_t i;
|
||||
|
||||
+ /* Ask qemu if it has a migration blocker */
|
||||
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
|
||||
+ g_auto(GStrv) blockers = NULL;
|
||||
+ if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
|
||||
+ return false;
|
||||
+
|
||||
+ if (blockers && blockers[0]) {
|
||||
+ g_autofree char *reasons = g_strjoinv("; ", blockers);
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
+ _("cannot migrate domain: %s"), reasons);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* perform these checks only when migrating to remote hosts */
|
||||
if (remote) {
|
||||
nsnapshots = virDomainSnapshotObjListNum(vm->snapshots, NULL, 0);
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,58 @@
|
||||
From 0ba11af2300d0aaf80456575e03848f843ae29de Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0ba11af2300d0aaf80456575e03848f843ae29de@dist-git>
|
||||
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 19:29:15 +0200
|
||||
Subject: [PATCH] qemu: remove hardcoded migration fail for vDPA devices if we
|
||||
can ask QEMU
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
vDPA devices will be migratable soon, so we shouldn't unconditionally
|
||||
block migration of any domain with a vDPA device. Instead, we should
|
||||
rely on QEMU to make the decision when that info is available from the
|
||||
query-migrate QMP command (QEMU versions too old to have that info in
|
||||
the results of query-migrate don't support migration of vDPA devices,
|
||||
so in that case we will continue to unconditionally block migration).
|
||||
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
|
||||
(cherry picked from commit 2103807e330487952f423d86f541a7a28e003e95)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index cfb7626bb0..2f77e45abf 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -1455,9 +1455,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
int nsnapshots;
|
||||
int pauseReason;
|
||||
size_t i;
|
||||
+ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
|
||||
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
|
||||
|
||||
- /* Ask qemu if it has a migration blocker */
|
||||
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
|
||||
+ /* Ask qemu if it have a migration blocker */
|
||||
+ if (blockedReasonsCap) {
|
||||
g_auto(GStrv) blockers = NULL;
|
||||
if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
|
||||
return false;
|
||||
@@ -1576,7 +1578,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
virDomainNetDef *net = vm->def->nets[i];
|
||||
qemuSlirp *slirp;
|
||||
|
||||
- if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
|
||||
+ if (!blockedReasonsCap && net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("vDPA devices cannot be migrated"));
|
||||
return false;
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,62 @@
|
||||
From 8f2cd77dc208cfa90b37faa18b092ca4a76a0716 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8f2cd77dc208cfa90b37faa18b092ca4a76a0716@dist-git>
|
||||
From: Laine Stump <laine@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 02:03:49 -0400
|
||||
Subject: [PATCH] qemu: skip hardcoded hostdev migration check if QEMU can do
|
||||
it for us
|
||||
|
||||
libvirt currently will block migration for any vfio-assigned device
|
||||
unless it is a network device that is associated with a virtio-net
|
||||
failover device (ie. if the hostdev object has a teaming->type ==
|
||||
VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT).
|
||||
|
||||
In the future there will be other vfio devices that can be migrated,
|
||||
so we don't want to rely on this hardcoded block. QEMU 6.0+ will
|
||||
anyway inform us of any devices that will block migration (as a part
|
||||
of qemuDomainGetMigrationBlockers()), so we only need to do the
|
||||
hardcoded check in the case of old QEMU that can't provide that
|
||||
information.
|
||||
|
||||
Signed-off-by: Laine Stump <laine@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 25883cd5f0b188f2417f294b7d219a77b219f7c2)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1497907
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@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 f571c9eb27..76903d612b 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -1495,6 +1495,14 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
_("cannot migrate domain: %s"), reasons);
|
||||
return false;
|
||||
}
|
||||
+ } else {
|
||||
+ /* checks here are for anything that doesn't need to be
|
||||
+ * checked by libvirt if running QEMU that can be queried
|
||||
+ * about migration blockers.
|
||||
+ */
|
||||
+
|
||||
+ if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
|
||||
+ return false;
|
||||
}
|
||||
|
||||
if (remote) {
|
||||
@@ -1521,9 +1529,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
|
||||
- return false;
|
||||
-
|
||||
if (vm->def->cpu) {
|
||||
/* QEMU blocks migration and save with invariant TSC enabled
|
||||
* unless TSC frequency is explicitly set.
|
||||
--
|
||||
2.35.1
|
||||
|
@ -0,0 +1,132 @@
|
||||
From d4c4660b097695916244307d1125a17c30c0c9ef Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d4c4660b097695916244307d1125a17c30c0c9ef@dist-git>
|
||||
From: Martin Kletzander <mkletzan@redhat.com>
|
||||
Date: Fri, 22 Jul 2022 12:20:04 +0200
|
||||
Subject: [PATCH] qemu_migration: Acquire correct job in
|
||||
qemuMigrationSrcIsAllowed
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 69e0e33873f1aec55df77f12fb0197d50dca3319)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
||||
---
|
||||
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 654b5d65e5..847c96639d 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -2650,13 +2650,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"));
|
||||
@@ -3176,7 +3176,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 96c4c0f1da..f571c9eb27 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;
|
||||
}
|
||||
@@ -2632,7 +2633,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)) &&
|
||||
@@ -6033,7 +6034,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 81cc1e91c0..61d12d6eb1 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 833f880252..0733d44faa 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
|
||||
|
@ -0,0 +1,64 @@
|
||||
From 25fe3cf8990b654fd568f580b8885102b3f92789 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <25fe3cf8990b654fd568f580b8885102b3f92789@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Thu, 21 Jul 2022 15:00:28 +0200
|
||||
Subject: [PATCH] qemu_migration: Use EnterMonitorAsync in
|
||||
qemuDomainGetMigrationBlockers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 62627524607f214e724a48fcac575737f49a271c)
|
||||
Resolves: https://bugzilla.redhat.com/2092833
|
||||
Signed-off-by: Eugenio Pérez <eperezma@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 2f77e45abf..735eb02673 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
|
||||
|
215
libvirt-virsh-Require-xpath-for-dumpxml.patch
Normal file
215
libvirt-virsh-Require-xpath-for-dumpxml.patch
Normal file
@ -0,0 +1,215 @@
|
||||
From 045c3fbdc6f4a5b98013a00fcaefcd3481c1df39 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <045c3fbdc6f4a5b98013a00fcaefcd3481c1df39@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 8 Jul 2022 12:45:42 +0200
|
||||
Subject: [PATCH] virsh: Require --xpath for *dumpxml
|
||||
|
||||
Historically, the dumpxml command reject any unknown arguments,
|
||||
for instance:
|
||||
|
||||
virsh dumpxml fedora xxx
|
||||
|
||||
However, after v8.5.0-rc1~31 the second argument ('xxx') is
|
||||
treated as an XPath, but it's not that clearly visible.
|
||||
Therefore, require the --xpath switch, like this:
|
||||
|
||||
virsh dumpxml fedora --xpath xxx
|
||||
|
||||
Yes, this breaks already released virsh, but I think we can argue
|
||||
that the pool of users of this particular function is very small.
|
||||
We also document the argument being mandatory:
|
||||
|
||||
dumpxml [--inactive] [--security-info] [--update-cpu] [--migratable]
|
||||
[--xpath EXPRESSION] [--wrap] domain
|
||||
|
||||
The sooner we do this change, the better.
|
||||
|
||||
The same applies for other *dumpxml functions (net-dumpxml,
|
||||
pool-dumpxml, vol-dumpxl to name a few).
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103524
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit e90d48ae6e22eaf1650f920abc0a6b87d2daa82b)
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
tools/virsh-backup.c | 1 +
|
||||
tools/virsh-checkpoint.c | 1 +
|
||||
tools/virsh-domain.c | 3 +++
|
||||
tools/virsh-interface.c | 1 +
|
||||
tools/virsh-network.c | 2 ++
|
||||
tools/virsh-nodedev.c | 1 +
|
||||
tools/virsh-nwfilter.c | 2 ++
|
||||
tools/virsh-pool.c | 1 +
|
||||
tools/virsh-secret.c | 1 +
|
||||
tools/virsh-snapshot.c | 1 +
|
||||
tools/virsh-volume.c | 1 +
|
||||
11 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c
|
||||
index db122abc09..1bb2c63113 100644
|
||||
--- a/tools/virsh-backup.c
|
||||
+++ b/tools/virsh-backup.c
|
||||
@@ -117,6 +117,7 @@ static const vshCmdOptDef opts_backup_dumpxml[] = {
|
||||
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
|
||||
index a7ef39849d..9605c893af 100644
|
||||
--- a/tools/virsh-checkpoint.c
|
||||
+++ b/tools/virsh-checkpoint.c
|
||||
@@ -854,6 +854,7 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
||||
index da63cc95ff..76d12d2b70 100644
|
||||
--- a/tools/virsh-domain.c
|
||||
+++ b/tools/virsh-domain.c
|
||||
@@ -4529,6 +4529,7 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
@@ -4961,6 +4962,7 @@ static const vshCmdOptDef opts_managed_save_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
@@ -10469,6 +10471,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
|
||||
index b29ffc9bef..39ea53ec9d 100644
|
||||
--- a/tools/virsh-interface.c
|
||||
+++ b/tools/virsh-interface.c
|
||||
@@ -472,6 +472,7 @@ static const vshCmdOptDef opts_interface_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
|
||||
index 99ced6ccc6..004719dad6 100644
|
||||
--- a/tools/virsh-network.c
|
||||
+++ b/tools/virsh-network.c
|
||||
@@ -351,6 +351,7 @@ static const vshCmdOptDef opts_network_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
@@ -1556,6 +1557,7 @@ static const vshCmdOptDef opts_network_port_dumpxml[] = {
|
||||
VIRSH_COMMON_OPT_NETWORK_PORT(0),
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
|
||||
index 37e361c701..2adcad9c10 100644
|
||||
--- a/tools/virsh-nodedev.c
|
||||
+++ b/tools/virsh-nodedev.c
|
||||
@@ -567,6 +567,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
|
||||
index ff7f6f4026..d4112c8620 100644
|
||||
--- a/tools/virsh-nwfilter.c
|
||||
+++ b/tools/virsh-nwfilter.c
|
||||
@@ -188,6 +188,7 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
@@ -610,6 +611,7 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
|
||||
index 820a61f889..8a98c6ae40 100644
|
||||
--- a/tools/virsh-pool.c
|
||||
+++ b/tools/virsh-pool.c
|
||||
@@ -777,6 +777,7 @@ static const vshCmdOptDef opts_pool_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
|
||||
index 79fa3faf5a..17d2bbd88d 100644
|
||||
--- a/tools/virsh-secret.c
|
||||
+++ b/tools/virsh-secret.c
|
||||
@@ -140,6 +140,7 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
|
||||
index 83fdfb9616..8fa64ba903 100644
|
||||
--- a/tools/virsh-snapshot.c
|
||||
+++ b/tools/virsh-snapshot.c
|
||||
@@ -1609,6 +1609,7 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
|
||||
},
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
|
||||
index bf72d8135f..300a0aa8e5 100644
|
||||
--- a/tools/virsh-volume.c
|
||||
+++ b/tools/virsh-volume.c
|
||||
@@ -1161,6 +1161,7 @@ static const vshCmdOptDef opts_vol_dumpxml[] = {
|
||||
VIRSH_COMMON_OPT_POOL_OPTIONAL,
|
||||
{.name = "xpath",
|
||||
.type = VSH_OT_STRING,
|
||||
+ .flags = VSH_OFLAG_REQ_OPT,
|
||||
.completer = virshCompleteEmpty,
|
||||
.help = N_("xpath expression to filter the XML document")
|
||||
},
|
||||
--
|
||||
2.35.1
|
||||
|
22
libvirt.spec
22
libvirt.spec
@ -231,7 +231,7 @@
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 8.5.0
|
||||
Release: 2%{?dist}%{?extra_release}
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
URL: https://libvirt.org/
|
||||
|
||||
@ -250,6 +250,15 @@ Patch7: libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch
|
||||
Patch8: libvirt-domcaps-Introduce-TPM-backendVersion.patch
|
||||
Patch9: libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch
|
||||
Patch10: libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch
|
||||
Patch11: libvirt-qemu-introduce-capability-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch
|
||||
Patch12: libvirt-qemu-new-function-to-retrieve-migration-blocker-reasons-from-QEMU.patch
|
||||
Patch13: libvirt-qemu-query-QEMU-for-migration-blockers-before-our-own-harcoded-checks.patch
|
||||
Patch14: libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch
|
||||
Patch15: libvirt-qemu_migration-Use-EnterMonitorAsync-in-qemuDomainGetMigrationBlockers.patch
|
||||
Patch16: libvirt-qemu-don-t-try-to-query-QEMU-about-migration-blockers-during-offline-migration.patch
|
||||
Patch17: libvirt-qemu_migration-Acquire-correct-job-in-qemuMigrationSrcIsAllowed.patch
|
||||
Patch18: libvirt-virsh-Require-xpath-for-dumpxml.patch
|
||||
Patch19: libvirt-qemu-skip-hardcoded-hostdev-migration-check-if-QEMU-can-do-it-for-us.patch
|
||||
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
@ -2156,6 +2165,17 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jul 25 2022 Jiri Denemark <jdenemar@redhat.com> - 8.5.0-3
|
||||
- qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS (rhbz#2092833)
|
||||
- qemu: new function to retrieve migration blocker reasons from QEMU (rhbz#2092833)
|
||||
- qemu: query QEMU for migration blockers before our own harcoded checks (rhbz#2092833)
|
||||
- qemu: remove hardcoded migration fail for vDPA devices if we can ask QEMU (rhbz#2092833)
|
||||
- qemu_migration: Use EnterMonitorAsync in qemuDomainGetMigrationBlockers (rhbz#2092833)
|
||||
- qemu: don't try to query QEMU about migration blockers during offline migration (rhbz#2092833)
|
||||
- qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed (rhbz#2092833)
|
||||
- virsh: Require --xpath for *dumpxml (rhbz#2103524)
|
||||
- qemu: skip hardcoded hostdev migration check if QEMU can do it for us (rhbz#1497907)
|
||||
|
||||
* Fri Jul 15 2022 Jiri Denemark <jdenemar@redhat.com> - 8.5.0-2
|
||||
- domain_conf: Format <defaultiothread/> more often (rhbz#2059511)
|
||||
- domain_conf: Format iothread IDs more often (rhbz#2059511)
|
||||
|
Loading…
Reference in New Issue
Block a user