migration: Create options.c
We move there all capabilities helpers from migration.c. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> --- Following David advise: - looked through the history, capabilities are newer than 2012, so we can remove that bit of the header. - This part is posterior to Anthony. Original Author is Orit. Once there, I put myself. Peter Xu also did quite a bit of work here. Anyone else wants/needs to be there? I didn't search too hard because nobody asked before to be added. What do you think?
This commit is contained in:
parent
9eb1109cfb
commit
1f0776f1c0
@ -32,6 +32,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "migration/misc.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/options.h"
|
||||
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "hw/virtio/virtio-access.h"
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "qapi/qapi-visit-migration.h"
|
||||
#include "qapi/clone-visitor.h"
|
||||
#include "trace.h"
|
||||
#include "options.h"
|
||||
|
||||
#define CHUNK_SIZE (1 << 10)
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "migration/vmstate.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "trace.h"
|
||||
#include "options.h"
|
||||
|
||||
#define BLK_MIG_BLOCK_SIZE (1ULL << 20)
|
||||
#define BDRV_SECTORS_PER_DIRTY_CHUNK (BLK_MIG_BLOCK_SIZE >> BDRV_SECTOR_BITS)
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "sysemu/cpus.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "net/filter.h"
|
||||
#include "options.h"
|
||||
|
||||
static bool vmstate_loading;
|
||||
static Notifier packets_compare_notifier;
|
||||
|
@ -22,6 +22,7 @@ softmmu_ss.add(files(
|
||||
'migration.c',
|
||||
'multifd.c',
|
||||
'multifd-zlib.c',
|
||||
'options.c',
|
||||
'postcopy-ram.c',
|
||||
'savevm.c',
|
||||
'socket.c',
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "sysemu/cpus.h"
|
||||
#include "yank_functions.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "options.h"
|
||||
|
||||
#define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttling */
|
||||
|
||||
@ -357,15 +358,6 @@ static void migrate_generate_event(int new_state)
|
||||
}
|
||||
}
|
||||
|
||||
static bool migrate_late_block_activate(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a message on the return channel back to the source
|
||||
* of the migration.
|
||||
@ -2525,56 +2517,11 @@ void qmp_migrate_continue(MigrationStatus state, Error **errp)
|
||||
qemu_sem_post(&s->pause_sem);
|
||||
}
|
||||
|
||||
bool migrate_release_ram(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_ram(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM];
|
||||
}
|
||||
|
||||
bool migrate_postcopy(void)
|
||||
{
|
||||
return migrate_postcopy_ram() || migrate_dirty_bitmaps();
|
||||
}
|
||||
|
||||
bool migrate_auto_converge(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
|
||||
}
|
||||
|
||||
bool migrate_zero_blocks(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_blocktime(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME];
|
||||
}
|
||||
|
||||
bool migrate_use_compression(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
@ -2620,33 +2567,6 @@ int migrate_decompress_threads(void)
|
||||
return s->parameters.decompress_threads;
|
||||
}
|
||||
|
||||
bool migrate_dirty_bitmaps(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
|
||||
}
|
||||
|
||||
bool migrate_ignore_shared(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED];
|
||||
}
|
||||
|
||||
bool migrate_validate_uuid(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
|
||||
}
|
||||
|
||||
bool migrate_use_events(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
@ -2665,15 +2585,6 @@ bool migrate_use_multifd(void)
|
||||
return s->capabilities[MIGRATION_CAPABILITY_MULTIFD];
|
||||
}
|
||||
|
||||
bool migrate_pause_before_switchover(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
|
||||
}
|
||||
|
||||
int migrate_multifd_channels(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
@ -2785,24 +2696,6 @@ bool migrate_use_block_incremental(void)
|
||||
return s->parameters.block_incremental;
|
||||
}
|
||||
|
||||
bool migrate_background_snapshot(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_preempt(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT];
|
||||
}
|
||||
|
||||
/* migration thread support */
|
||||
/*
|
||||
* Something bad happened to the RP stream, mark an error
|
||||
|
@ -449,16 +449,7 @@ MigrationState *migrate_get_current(void);
|
||||
|
||||
bool migrate_postcopy(void);
|
||||
|
||||
bool migrate_release_ram(void);
|
||||
bool migrate_postcopy_ram(void);
|
||||
bool migrate_zero_blocks(void);
|
||||
bool migrate_dirty_bitmaps(void);
|
||||
bool migrate_ignore_shared(void);
|
||||
bool migrate_validate_uuid(void);
|
||||
|
||||
bool migrate_auto_converge(void);
|
||||
bool migrate_use_multifd(void);
|
||||
bool migrate_pause_before_switchover(void);
|
||||
int migrate_multifd_channels(void);
|
||||
MultiFDCompression migrate_multifd_compression(void);
|
||||
int migrate_multifd_zlib_level(void);
|
||||
@ -487,9 +478,6 @@ int migrate_compress_threads(void);
|
||||
int migrate_compress_wait_thread(void);
|
||||
int migrate_decompress_threads(void);
|
||||
bool migrate_use_events(void);
|
||||
bool migrate_postcopy_blocktime(void);
|
||||
bool migrate_background_snapshot(void);
|
||||
bool migrate_postcopy_preempt(void);
|
||||
|
||||
/* Sending on the return path - generic and then for each message type */
|
||||
void migrate_send_rp_shut(MigrationIncomingState *mis,
|
||||
|
124
migration/options.c
Normal file
124
migration/options.c
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* QEMU migration capabilities
|
||||
*
|
||||
* Copyright (c) 2012-2023 Red Hat Inc
|
||||
*
|
||||
* Authors:
|
||||
* Orit Wasserman <owasserm@redhat.com>
|
||||
* Juan Quintela <quintela@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "migration.h"
|
||||
#include "options.h"
|
||||
|
||||
bool migrate_auto_converge(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
|
||||
}
|
||||
|
||||
bool migrate_background_snapshot(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
|
||||
}
|
||||
|
||||
bool migrate_dirty_bitmaps(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
|
||||
}
|
||||
|
||||
bool migrate_ignore_shared(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED];
|
||||
}
|
||||
|
||||
bool migrate_late_block_activate(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
|
||||
}
|
||||
|
||||
bool migrate_pause_before_switchover(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_blocktime(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_preempt(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT];
|
||||
}
|
||||
|
||||
bool migrate_postcopy_ram(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM];
|
||||
}
|
||||
|
||||
bool migrate_release_ram(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM];
|
||||
}
|
||||
|
||||
bool migrate_validate_uuid(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID];
|
||||
}
|
||||
|
||||
bool migrate_zero_blocks(void)
|
||||
{
|
||||
MigrationState *s;
|
||||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
|
||||
}
|
32
migration/options.h
Normal file
32
migration/options.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* QEMU migration capabilities
|
||||
*
|
||||
* Copyright (c) 2012-2023 Red Hat Inc
|
||||
*
|
||||
* Authors:
|
||||
* Orit Wasserman <owasserm@redhat.com>
|
||||
* Juan Quintela <quintela@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_MIGRATION_OPTIONS_H
|
||||
#define QEMU_MIGRATION_OPTIONS_H
|
||||
|
||||
/* capabilities */
|
||||
|
||||
bool migrate_auto_converge(void);
|
||||
bool migrate_background_snapshot(void);
|
||||
bool migrate_dirty_bitmaps(void);
|
||||
bool migrate_ignore_shared(void);
|
||||
bool migrate_late_block_activate(void);
|
||||
bool migrate_pause_before_switchover(void);
|
||||
bool migrate_postcopy_blocktime(void);
|
||||
bool migrate_postcopy_preempt(void);
|
||||
bool migrate_postcopy_ram(void);
|
||||
bool migrate_release_ram(void);
|
||||
bool migrate_validate_uuid(void);
|
||||
bool migrate_zero_blocks(void);
|
||||
|
||||
#endif
|
@ -37,6 +37,7 @@
|
||||
#include "tls.h"
|
||||
#include "qemu/userfaultfd.h"
|
||||
#include "qemu/mmap-alloc.h"
|
||||
#include "options.h"
|
||||
|
||||
/* Arbitrary limit on size of each discard command,
|
||||
* keeps them around ~200 bytes
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "qemu/iov.h"
|
||||
#include "multifd.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "options.h"
|
||||
|
||||
#include "hw/boards.h" /* for machine_dump_guest_core() */
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include "qemu/yank.h"
|
||||
#include "yank_functions.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "options.h"
|
||||
|
||||
const unsigned int postcopy_ram_discard_version;
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "io/net-listener.h"
|
||||
#include "trace.h"
|
||||
#include "postcopy-ram.h"
|
||||
#include "options.h"
|
||||
|
||||
struct SocketOutgoingArgs {
|
||||
SocketAddress *saddr;
|
||||
|
Loading…
Reference in New Issue
Block a user