diff options
-rw-r--r-- | hw/virtio/virtio-balloon.c | 1 | ||||
-rw-r--r-- | migration/block-dirty-bitmap.c | 1 | ||||
-rw-r--r-- | migration/block.c | 1 | ||||
-rw-r--r-- | migration/colo.c | 1 | ||||
-rw-r--r-- | migration/meson.build | 1 | ||||
-rw-r--r-- | migration/migration.c | 109 | ||||
-rw-r--r-- | migration/migration.h | 12 | ||||
-rw-r--r-- | migration/options.c | 124 | ||||
-rw-r--r-- | migration/options.h | 32 | ||||
-rw-r--r-- | migration/postcopy-ram.c | 1 | ||||
-rw-r--r-- | migration/ram.c | 1 | ||||
-rw-r--r-- | migration/savevm.c | 1 | ||||
-rw-r--r-- | migration/socket.c | 1 |
13 files changed, 166 insertions, 120 deletions
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 746f07c..43092aa 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -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" diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index fe73aa9..a6ffae0 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -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) diff --git a/migration/block.c b/migration/block.c index b2497bb..4b167fa 100644 --- a/migration/block.c +++ b/migration/block.c @@ -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) diff --git a/migration/colo.c b/migration/colo.c index 0716e64..93b78c9 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -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; diff --git a/migration/meson.build b/migration/meson.build index 0d1bb9f..480ff68 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -22,6 +22,7 @@ softmmu_ss.add(files( 'migration.c', 'multifd.c', 'multifd-zlib.c', + 'options.c', 'postcopy-ram.c', 'savevm.c', 'socket.c', diff --git a/migration/migration.c b/migration/migration.c index e667424..d8c9166 100644 --- a/migration/migration.c +++ b/migration/migration.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 diff --git a/migration/migration.h b/migration/migration.h index 04e0860..a25fed6 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -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, diff --git a/migration/options.c b/migration/options.c new file mode 100644 index 0000000..88a9a45 --- /dev/null +++ b/migration/options.c @@ -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]; +} diff --git a/migration/options.h b/migration/options.h new file mode 100644 index 0000000..0dfa0af --- /dev/null +++ b/migration/options.h @@ -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 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d7b48dd..0711500 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -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 diff --git a/migration/ram.c b/migration/ram.c index 2297140..912ccd8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -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() */ diff --git a/migration/savevm.c b/migration/savevm.c index 589ef92..ebcf571 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -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; diff --git a/migration/socket.c b/migration/socket.c index e6fdf3c..ebf9ac4 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -27,6 +27,7 @@ #include "io/net-listener.h" #include "trace.h" #include "postcopy-ram.h" +#include "options.h" struct SocketOutgoingArgs { SocketAddress *saddr; |