]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND
authorPeter Krempa <pkrempa@redhat.com>
Thu, 8 Sep 2022 11:04:54 +0000 (13:04 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 9 Sep 2022 14:10:47 +0000 (16:10 +0200)
'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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_migration.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
tests/qemumonitorjsontest.c

index 7dc593d49f5014b6cd248efead7be7f7fcd2ec48..c63b00c9222d397853627fc04ee96f7d6eef3116 100644 (file)
@@ -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");
index 53ea26c58a2d11f65d4476c90be5b81ed8796739..c256e0f5babdd128e2b5b227036357ccd58bd0b5 100644 (file)
@@ -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;
index bf22cc64f826928a9dcd747c7b75ef13846c23e5..031238665f37345a919d89974e07493a5a24d268 100644 (file)
@@ -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);
index fa5455e513d907e48afb3ce920ff0fd6fe197e7a..238c6c18136f9b881e01c1371c34cb63a935149b 100644 (file)
@@ -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)