[PATCH 7/8] qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'qemuMonitorJSONMigrate' is called from:
 - qemuMonitorMigrateToHost
 - qemuMonitorMigrateToSocket
   Both of the above function are called only from
   qemuMigrationSrcStart.

 - qemuMonitorMigrateToFd
   - called from:
     - qemuMigrationSrcToFile
       Both instances here pass QEMU_MONITOR_MIGRATE_BACKGROUND
       directly.
     - qemuMigrationSrcStart

qemuMigrationSrcStart is then called from qemuMigrationSrcRun and
qemuMigrationSrcResume, both of which always add QEMU_MONITOR_MIGRATE_BACKGROUND
to the flags.

Thus any caller always passes the flag so that we can remove the flag
altogether.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c    | 15 ++++-----------
 src/qemu/qemu_monitor.h      |  1 -
 src/qemu/qemu_monitor_json.c |  3 +--
 tests/qemumonitorjsontest.c  |  2 +-
 4 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7dc593d49f..c63b00c922 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4678,7 +4678,6 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
                     const char *nbdURI)
 {
     int ret = -1;
-    unsigned int migrate_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
     qemuDomainObjPrivate *priv = vm->privateData;
     g_autoptr(qemuMigrationCookie) mig = NULL;
     g_autofree char *tlsAlias = NULL;
@@ -4867,7 +4866,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
         goto exit_monitor;
     }

-    rc = qemuMigrationSrcStart(vm, spec, migrate_flags, &fd);
+    rc = qemuMigrationSrcStart(vm, spec, 0, &fd);

     qemuDomainObjExitMonitor(vm);
     if (rc < 0)
@@ -5033,8 +5032,6 @@ qemuMigrationSrcResume(virDomainObj *vm,
     qemuDomainObjPrivate *priv = vm->privateData;
     virQEMUDriver *driver = priv->driver;
     g_autoptr(qemuMigrationCookie) mig = NULL;
-    unsigned int migrateFlags = QEMU_MONITOR_MIGRATE_BACKGROUND |
-                                QEMU_MONITOR_MIGRATE_RESUME;
     int rc;

     VIR_DEBUG("vm=%p", vm);
@@ -5053,7 +5050,7 @@ qemuMigrationSrcResume(virDomainObj *vm,
                                        VIR_ASYNC_JOB_MIGRATION_OUT) < 0)
         return -1;

-    rc = qemuMigrationSrcStart(vm, spec, migrateFlags, NULL);
+    rc = qemuMigrationSrcStart(vm, spec, QEMU_MONITOR_MIGRATE_RESUME, NULL);

     qemuDomainObjExitMonitor(vm);
     if (rc < 0)
@@ -6902,9 +6899,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
         goto cleanup;

     if (!compressor) {
-        rc = qemuMonitorMigrateToFd(priv->mon,
-                                    QEMU_MONITOR_MIGRATE_BACKGROUND,
-                                    fd);
+        rc = qemuMonitorMigrateToFd(priv->mon, 0, fd);
     } else {
         virCommandSetInputFD(compressor, pipeFD[0]);
         virCommandSetOutputFD(compressor, &fd);
@@ -6920,9 +6915,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
             qemuDomainObjExitMonitor(vm);
             goto cleanup;
         }
-        rc = qemuMonitorMigrateToFd(priv->mon,
-                                    QEMU_MONITOR_MIGRATE_BACKGROUND,
-                                    pipeFD[1]);
+        rc = qemuMonitorMigrateToFd(priv->mon, 0, pipeFD[1]);
         if (VIR_CLOSE(pipeFD[0]) < 0 ||
             VIR_CLOSE(pipeFD[1]) < 0)
             VIR_WARN("failed to close intermediate pipe");
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 53ea26c58a..c256e0f5ba 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -825,7 +825,6 @@ int qemuMonitorGetSEVCapabilities(qemuMonitor *mon,
                                   virSEVCapability **capabilities);

 typedef enum {
-  QEMU_MONITOR_MIGRATE_BACKGROUND       = 1 << 0,
   QEMU_MONITOR_MIGRATE_RESUME           = 1 << 3, /* resume failed post-copy migration */
   QEMU_MONITOR_MIGRATION_FLAGS_LAST
 } QEMU_MONITOR_MIGRATE;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index bf22cc64f8..031238665f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3109,10 +3109,9 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon,
                            unsigned int flags,
                            const char *uri)
 {
-    bool detach = !!(flags & QEMU_MONITOR_MIGRATE_BACKGROUND);
     bool resume = !!(flags & QEMU_MONITOR_MIGRATE_RESUME);
     g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("migrate",
-                                                             "b:detach", detach,
+                                                             "b:detach", true,
                                                              "b:resume", resume,
                                                              "s:uri", uri,
                                                              NULL);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index fa5455e513..238c6c1813 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1201,7 +1201,7 @@ GEN_TEST_FUNC(qemuMonitorJSONExpirePassword, "spice", "123456")
 GEN_TEST_FUNC(qemuMonitorJSONSetBalloon, 1024)
 GEN_TEST_FUNC(qemuMonitorJSONSaveVirtualMemory, 0, 1024, "/foo/bar")
 GEN_TEST_FUNC(qemuMonitorJSONSavePhysicalMemory, 0, 1024, "/foo/bar")
-GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND, "tcp:localhost:12345")
+GEN_TEST_FUNC(qemuMonitorJSONMigrate, 0, "tcp:localhost:12345")
 GEN_TEST_FUNC(qemuMonitorJSONMigrateRecover, "tcp://destination.host:54321");
 GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "elf",
               true)
-- 
2.37.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux