[PATCH 0/2] qemu: monitor: Fix handling of 'detach' for 'migrate' and 'dump-guest-memory' QMP commands

QEMU is deprecating 'detach' argument of 'migrate' as it was never actually used. Drop it in libvirt as we always specify it. The monitor handler of 'dump-guest-memory' allows controlling 'detach' but always passes true. Libvirt doesn't want to block the monitor so hardcode 'true' in the monitor code instead. Peter Krempa (2): qemuMonitorDumpToFd: Drop 'detach' argument qemuMonitorJSONMigrate: Drop 'detach' QMP option src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 5 ++--- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 6 ++---- src/qemu/qemu_monitor_json.h | 3 +-- tests/qemumonitorjsontest.c | 3 +-- 6 files changed, 8 insertions(+), 14 deletions(-) -- 2.49.0

From: Peter Krempa <pkrempa@redhat.com> The only caller always passes 'true'. We also don't want to ever use the blocking variant as it blocks the whole monitor until dump finishes. Hardcode it to 'true' in the monitor code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 5 ++--- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 5 ++--- src/qemu/qemu_monitor_json.h | 3 +-- tests/qemumonitorjsontest.c | 3 +-- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 893fa0c66c..aef313ae9c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3045,7 +3045,7 @@ qemuDumpToFd(virQEMUDriver *driver, } } - rc = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, true); + rc = qemuMonitorDumpToFd(priv->mon, fd, dumpformat); qemuDomainObjExitMonitor(vm); if (rc < 0) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 981975cdd2..d508f50ed6 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2362,8 +2362,7 @@ qemuMonitorGetDumpGuestMemoryCapability(qemuMonitor *mon, int qemuMonitorDumpToFd(qemuMonitor *mon, int fd, - const char *dumpformat, - bool detach) + const char *dumpformat) { int ret; VIR_DEBUG("fd=%d dumpformat=%s", fd, dumpformat); @@ -2373,7 +2372,7 @@ qemuMonitorDumpToFd(qemuMonitor *mon, if (qemuMonitorSendFileHandle(mon, "dump", fd) < 0) return -1; - ret = qemuMonitorJSONDump(mon, "fd:dump", dumpformat, detach); + ret = qemuMonitorJSONDump(mon, "fd:dump", dumpformat); if (ret < 0) { if (qemuMonitorCloseFileHandle(mon, "dump") < 0) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 58d84d424b..51b65b4019 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -893,8 +893,7 @@ int qemuMonitorQueryDump(qemuMonitor *mon, int qemuMonitorDumpToFd(qemuMonitor *mon, int fd, - const char *dumpformat, - bool detach); + const char *dumpformat); int qemuMonitorGraphicsRelocate(qemuMonitor *mon, int type, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index dc2eaace96..3c2b35575e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3371,8 +3371,7 @@ qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitor *mon, int qemuMonitorJSONDump(qemuMonitor *mon, const char *protocol, - const char *dumpformat, - bool detach) + const char *dumpformat) { g_autoptr(virJSONValue) cmd = NULL; g_autoptr(virJSONValue) reply = NULL; @@ -3381,7 +3380,7 @@ qemuMonitorJSONDump(qemuMonitor *mon, "b:paging", false, "s:protocol", protocol, "S:format", dumpformat, - "B:detach", detach, + "b:detach", true, NULL); if (!cmd) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index ba278af98a..7f07e55e06 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -193,8 +193,7 @@ qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitor *mon, int qemuMonitorJSONDump(qemuMonitor *mon, const char *protocol, - const char *dumpformat, - bool detach); + const char *dumpformat); int qemuMonitorJSONGraphicsRelocate(qemuMonitor *mon, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 7485f683fb..a18872db60 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1149,8 +1149,7 @@ GEN_TEST_FUNC(qemuMonitorJSONSaveVirtualMemory, 0, 1024, "/foo/bar") GEN_TEST_FUNC(qemuMonitorJSONSavePhysicalMemory, 0, 1024, "/foo/bar") GEN_TEST_FUNC(qemuMonitorJSONMigrate, 0, "tcp:localhost:12345") GEN_TEST_FUNC(qemuMonitorJSONMigrateRecover, "tcp://destination.host:54321"); -GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "elf", - true) +GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "elf") GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, "localhost", 12345, 12346, "certsubjectval") GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0") -- 2.49.0

From: Peter Krempa <pkrempa@redhat.com> The argument was always ignored by qemu [1], as of qemu-10.1 it will be deprecated. As it was always unused/ignored we can drop it without any extra logic. [1] qemu docs state: 3. The user Monitor's "detach" argument is invalid in QMP and should not be used. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_monitor_json.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3c2b35575e..a6fb2a2013 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3198,7 +3198,6 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon, { bool resume = !!(flags & QEMU_MONITOR_MIGRATE_RESUME); g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("migrate", - "b:detach", true, "b:resume", resume, "s:uri", uri, NULL); -- 2.49.0

On 5/21/25 10:06, Peter Krempa via Devel wrote:
QEMU is deprecating 'detach' argument of 'migrate' as it was never actually used. Drop it in libvirt as we always specify it.
The monitor handler of 'dump-guest-memory' allows controlling 'detach' but always passes true. Libvirt doesn't want to block the monitor so hardcode 'true' in the monitor code instead.
Peter Krempa (2): qemuMonitorDumpToFd: Drop 'detach' argument qemuMonitorJSONMigrate: Drop 'detach' QMP option
src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 5 ++--- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 6 ++---- src/qemu/qemu_monitor_json.h | 3 +-- tests/qemumonitorjsontest.c | 3 +-- 6 files changed, 8 insertions(+), 14 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Michal Prívozník
-
Peter Krempa