qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND

'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>
This commit is contained in:
Peter Krempa 2022-09-08 13:04:54 +02:00
parent d5fb23bc6e
commit bc753aa6f7
4 changed files with 6 additions and 15 deletions

View 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");

View 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;

View 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);

View 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)