migration: Remove block migration

The block migration has been considered obsolete since QEMU 8.2 in
favor of the more flexible storage migration provided by the
blockdev-mirror driver. Two releases have passed so now it's time to
remove it.

Deprecation commit 66db46ca83 ("migration: Deprecate block
migration").

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Fabiano Rosas 2024-04-30 11:27:35 -03:00
parent 18d154f575
commit eef0bae3a7
19 changed files with 26 additions and 1236 deletions

View file

@ -2866,7 +2866,6 @@ F: util/aio-*.h
F: util/defer-call.c
F: util/fdmon-*.c
F: block/io.c
F: migration/block*
F: include/block/aio.h
F: include/block/aio-wait.h
F: include/qemu/defer-call.h

View file

@ -477,16 +477,6 @@ option).
Migration
---------
block migration (since 8.2)
'''''''''''''''''''''''''''
Block migration is too inflexible. It needs to migrate all block
devices or none.
Please see "QMP invocation for live storage migration with
``blockdev-mirror`` + NBD" in docs/interop/live-block-operations.rst
for a detailed explanation.
old compression method (since 8.2)
''''''''''''''''''''''''''''''''''

View file

@ -634,6 +634,13 @@ Use blockdev-mirror with NBD instead. See "QMP invocation for live
storage migration with ``blockdev-mirror`` + NBD" in
docs/interop/live-block-operations.rst for a detailed explanation.
``migrate-set-capabilities`` ``block`` option (removed in 9.1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Block migration has been removed. For a replacement, see "QMP
invocation for live storage migration with ``blockdev-mirror`` + NBD"
in docs/interop/live-block-operations.rst.
Human Monitor Protocol (HMP) commands
-------------------------------------
@ -708,6 +715,13 @@ Use blockdev-mirror with NBD instead. See "QMP invocation for live
storage migration with ``blockdev-mirror`` + NBD" in
docs/interop/live-block-operations.rst for a detailed explanation.
``migrate_set_capability`` ``block`` option (removed in 9.1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Block migration has been removed. For a replacement, see "QMP
invocation for live storage migration with ``blockdev-mirror`` + NBD"
in docs/interop/live-block-operations.rst.
Host Architectures
------------------

View file

@ -454,7 +454,7 @@ Examples of such API functions are:
Iterative device migration
--------------------------
Some devices, such as RAM, Block storage or certain platform devices,
Some devices, such as RAM or certain platform devices,
have large amounts of data that would mean that the CPUs would be
paused for too long if they were sent in one section. For these
devices an *iterative* approach is taken.

View file

@ -45,12 +45,6 @@ bool migrate_ram_is_ignored(RAMBlock *block);
/* migration/block.c */
#ifdef CONFIG_LIVE_BLOCK_MIGRATION
void blk_mig_init(void);
#else
static inline void blk_mig_init(void) {}
#endif
AnnounceParameters *migrate_announce_params(void);
/* migration/savevm.c */

View file

@ -2351,7 +2351,6 @@ config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
config_host_data.set('CONFIG_DEBUG_TCG', get_option('debug_tcg'))
config_host_data.set('CONFIG_DEBUG_REMAP', get_option('debug_remap'))
config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed())
config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug'))
config_host_data.set('CONFIG_REPLICATION', get_option('replication').allowed())
@ -4302,7 +4301,6 @@ if have_block
summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')}
summary_info += {'VirtFS (9P) support': have_virtfs}
summary_info += {'VirtFS (9P) Proxy Helper support (deprecated)': have_virtfs_proxy_helper}
summary_info += {'Live block migration': config_host_data.get('CONFIG_LIVE_BLOCK_MIGRATION')}
summary_info += {'replication support': config_host_data.get('CONFIG_REPLICATION')}
summary_info += {'bochs support': get_option('bochs').allowed()}
summary_info += {'cloop support': get_option('cloop').allowed()}

View file

@ -314,8 +314,6 @@ option('fdt', type: 'combo', value: 'auto',
option('selinux', type: 'feature', value: 'auto',
description: 'SELinux support in qemu-nbd')
option('live_block_migration', type: 'feature', value: 'auto',
description: 'block migration in the main migration stream')
option('replication', type: 'feature', value: 'auto',
description: 'replication support')
option('colo_proxy', type: 'feature', value: 'auto',

File diff suppressed because it is too large Load diff

View file

@ -1,52 +0,0 @@
/*
* QEMU live block migration
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Liran Schour <lirans@il.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/
#ifndef MIGRATION_BLOCK_H
#define MIGRATION_BLOCK_H
#ifdef CONFIG_LIVE_BLOCK_MIGRATION
int blk_mig_active(void);
int blk_mig_bulk_active(void);
uint64_t blk_mig_bytes_transferred(void);
uint64_t blk_mig_bytes_remaining(void);
uint64_t blk_mig_bytes_total(void);
#else
static inline int blk_mig_active(void)
{
return false;
}
static inline int blk_mig_bulk_active(void)
{
return false;
}
static inline uint64_t blk_mig_bytes_transferred(void)
{
return 0;
}
static inline uint64_t blk_mig_bytes_remaining(void)
{
return 0;
}
static inline uint64_t blk_mig_bytes_total(void)
{
return 0;
}
#endif /* CONFIG_LIVE_BLOCK_MIGRATION */
void migrate_set_block_enabled(bool value, Error **errp);
#endif /* MIGRATION_BLOCK_H */

View file

@ -18,7 +18,6 @@
#include "qemu-file.h"
#include "savevm.h"
#include "migration/colo.h"
#include "block.h"
#include "io/channel-buffer.h"
#include "trace.h"
#include "qemu/error-report.h"

View file

@ -39,9 +39,6 @@ else
endif
system_ss.add(when: rdma, if_true: files('rdma.c'))
if get_option('live_block_migration').allowed()
system_ss.add(files('block.c'))
endif
system_ss.add(when: zstd, if_true: files('multifd-zstd.c'))
specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',

View file

@ -145,15 +145,6 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
}
}
if (info->disk) {
monitor_printf(mon, "transferred disk: %" PRIu64 " kbytes\n",
info->disk->transferred >> 10);
monitor_printf(mon, "remaining disk: %" PRIu64 " kbytes\n",
info->disk->remaining >> 10);
monitor_printf(mon, "total disk: %" PRIu64 " kbytes\n",
info->disk->total >> 10);
}
if (info->xbzrle_cache) {
monitor_printf(mon, "cache size: %" PRIu64 " bytes\n",
info->xbzrle_cache->cache_size);
@ -726,24 +717,8 @@ static void hmp_migrate_status_cb(void *opaque)
info = qmp_query_migrate(NULL);
if (!info->has_status || info->status == MIGRATION_STATUS_ACTIVE ||
info->status == MIGRATION_STATUS_SETUP) {
if (info->disk) {
int progress;
if (info->disk->remaining) {
progress = info->disk->transferred * 100 / info->disk->total;
} else {
progress = 100;
}
monitor_printf(status->mon, "Completed %d %%\r", progress);
monitor_flush(status->mon);
}
timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1000);
} else {
if (migrate_block()) {
monitor_printf(status->mon, "\n");
}
if (info->error_desc) {
error_report("%s", info->error_desc);
}

View file

@ -46,7 +46,6 @@
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qnull.h"
#include "qemu/rcu.h"
#include "block.h"
#include "postcopy-ram.h"
#include "qemu/thread.h"
#include "trace.h"
@ -240,7 +239,6 @@ void migration_object_init(void)
migration_object_check(current_migration, &error_fatal);
blk_mig_init();
ram_mig_init();
dirty_bitmap_mig_init();
}
@ -1206,16 +1204,6 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
}
}
static void populate_disk_info(MigrationInfo *info)
{
if (blk_mig_active()) {
info->disk = g_malloc0(sizeof(*info->disk));
info->disk->transferred = blk_mig_bytes_transferred();
info->disk->remaining = blk_mig_bytes_remaining();
info->disk->total = blk_mig_bytes_total();
}
}
static void fill_source_migration_info(MigrationInfo *info)
{
MigrationState *s = migrate_get_current();
@ -1258,7 +1246,6 @@ static void fill_source_migration_info(MigrationInfo *info)
/* TODO add some postcopy stats */
populate_time_info(info, s);
populate_ram_info(info, s);
populate_disk_info(info);
migration_populate_vfio_info(info);
break;
case MIGRATION_STATUS_COLO:
@ -1423,7 +1410,6 @@ static void migrate_fd_cleanup(MigrationState *s)
type = migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED :
MIG_EVENT_PRECOPY_DONE;
migration_call_notifiers(s, type, NULL);
block_cleanup_parameters();
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
}
@ -2102,7 +2088,6 @@ void qmp_migrate(const char *uri, bool has_channels,
"a valid migration protocol");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
MIGRATION_STATUS_FAILED);
block_cleanup_parameters();
}
if (local_err) {

View file

@ -195,7 +195,6 @@ Property migration_properties[] = {
MIGRATION_CAPABILITY_POSTCOPY_PREEMPT),
DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO),
DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM),
DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK),
DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH),
DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD),
DEFINE_PROP_MIG_CAP("x-background-snapshot",
@ -225,13 +224,6 @@ bool migrate_background_snapshot(void)
return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
}
bool migrate_block(void)
{
MigrationState *s = migrate_get_current();
return s->capabilities[MIGRATION_CAPABILITY_BLOCK];
}
bool migrate_colo(void)
{
MigrationState *s = migrate_get_current();
@ -484,18 +476,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
ERRP_GUARD();
MigrationIncomingState *mis = migration_incoming_get_current();
#ifndef CONFIG_LIVE_BLOCK_MIGRATION
if (new_caps[MIGRATION_CAPABILITY_BLOCK]) {
error_setg(errp, "QEMU compiled without old-style block migration");
error_append_hint(errp, "Use blockdev-mirror with NBD instead.\n");
return false;
}
#endif
if (new_caps[MIGRATION_CAPABILITY_BLOCK]) {
warn_report("block migration is deprecated;"
" use blockdev-mirror with NBD instead");
}
if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) {
warn_report("old compression method is deprecated;"
" use multifd compression methods instead");
@ -706,11 +686,6 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
int i;
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
#ifndef CONFIG_LIVE_BLOCK_MIGRATION
if (i == MIGRATION_CAPABILITY_BLOCK) {
continue;
}
#endif
caps = g_malloc0(sizeof(*caps));
caps->capability = i;
caps->state = s->capabilities[i];

View file

@ -25,7 +25,6 @@ extern Property migration_properties[];
/* capabilities */
bool migrate_auto_converge(void);
bool migrate_block(void);
bool migrate_colo(void);
bool migrate_compress(void);
bool migrate_dirty_bitmaps(void);

View file

@ -53,7 +53,6 @@
#include "exec/target_page.h"
#include "qemu/rcu_queue.h"
#include "migration/colo.h"
#include "block.h"
#include "sysemu/cpu-throttle.h"
#include "savevm.h"
#include "qemu/iov.h"
@ -1025,13 +1024,6 @@ static void migration_trigger_throttle(RAMState *rs)
uint64_t bytes_dirty_period = rs->num_dirty_pages_period * TARGET_PAGE_SIZE;
uint64_t bytes_dirty_threshold = bytes_xfer_period * threshold / 100;
/* During block migration the auto-converge logic incorrectly detects
* that ram migration makes no progress. Avoid this by disabling the
* throttling logic during the bulk phase of block migration. */
if (blk_mig_bulk_active()) {
return;
}
/*
* The following detection logic can be refined later. For now:
* Check to see if the ratio between dirtied bytes and the approx.
@ -3230,13 +3222,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
int64_t t0;
int done = 0;
if (blk_mig_bulk_active()) {
/* Avoid transferring ram during bulk phase of block migration as
* the bulk phase will usually take a long time and transferring
* ram updates during that time is pointless. */
goto out;
}
/*
* We'll take this lock a little bit long, but it's okay for two reasons.
* Firstly, the only possible other thread to take it is who calls

View file

@ -1711,11 +1711,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
return -EINVAL;
}
if (migrate_block()) {
error_setg(errp, "Block migration and snapshots are incompatible");
return -EINVAL;
}
ret = migrate_init(ms, errp);
if (ret) {
return ret;

View file

@ -193,9 +193,6 @@
# @ram: @MigrationStats containing detailed migration status, only
# returned if status is 'active' or 'completed'(since 1.2)
#
# @disk: @MigrationStats containing detailed disk migration status,
# only returned if status is 'active' and it is a block migration
#
# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
# migration statistics, only returned if XBZRLE feature is on and
# status is 'active' or 'completed' (since 1.2)
@ -262,17 +259,15 @@
#
# Features:
#
# @deprecated: Member @disk is deprecated because block migration is.
# Member @compression is deprecated because it is unreliable and
# untested. It is recommended to use multifd migration, which
# offers an alternative compression implementation that is
# reliable and tested.
# @deprecated: Member @compression is deprecated because it is
# unreliable and untested. It is recommended to use multifd
# migration, which offers an alternative compression
# implementation that is reliable and tested.
#
# Since: 0.14
##
{ 'struct': 'MigrationInfo',
'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
'*disk': { 'type': 'MigrationStats', 'features': [ 'deprecated' ] },
'*vfio': 'VfioStats',
'*xbzrle-cache': 'XBZRLECacheStats',
'*total-time': 'int',
@ -294,8 +289,7 @@
#
# Returns information about current migration process. If migration
# is active there will be another json-object with RAM migration
# status and if block migration is active another one with block
# migration status.
# status.
#
# Returns: @MigrationInfo
#
@ -333,7 +327,7 @@
# -> { "execute": "query-migrate" }
# <- { "return": { "status": "failed" } }
#
# 4. Migration is being performed and is not a block migration:
# 4. Migration is being performed:
#
# -> { "execute": "query-migrate" }
# <- {
@ -354,33 +348,7 @@
# }
# }
#
# 5. Migration is being performed and is a block migration:
#
# -> { "execute": "query-migrate" }
# <- {
# "return":{
# "status":"active",
# "total-time":12345,
# "setup-time":12345,
# "expected-downtime":12345,
# "ram":{
# "total":1057024,
# "remaining":1053304,
# "transferred":3720,
# "duplicate":123,
# "normal":123,
# "normal-bytes":123456,
# "dirty-sync-count":15
# },
# "disk":{
# "total":20971520,
# "remaining":20880384,
# "transferred":91136
# }
# }
# }
#
# 6. Migration is being performed and XBZRLE is active:
# 5. Migration is being performed and XBZRLE is active:
#
# -> { "execute": "query-migrate" }
# <- {
@ -460,11 +428,6 @@
# @release-ram: if enabled, qemu will free the migrated ram pages on
# the source during postcopy-ram migration. (since 2.9)
#
# @block: If enabled, QEMU will also migrate the contents of all block
# devices. Default is disabled. A possible alternative uses
# mirror jobs to a builtin NBD server on the destination, which
# offers more flexibility. (Since 2.10)
#
# @return-path: If enabled, migration will use the return path even
# for precopy. (since 2.10)
#
@ -528,11 +491,10 @@
#
# Features:
#
# @deprecated: Member @block is deprecated. Use blockdev-mirror with
# NBD instead. Member @compress is deprecated because it is
# unreliable and untested. It is recommended to use multifd
# migration, which offers an alternative compression
# implementation that is reliable and tested.
# @deprecated: Member @compress is deprecated because it is unreliable
# and untested. It is recommended to use multifd migration, which
# offers an alternative compression implementation that is
# reliable and tested.
#
# @unstable: Members @x-colo and @x-ignore-shared are experimental.
#
@ -544,7 +506,6 @@
'events', 'postcopy-ram',
{ 'name': 'x-colo', 'features': [ 'unstable' ] },
'release-ram',
{ 'name': 'block', 'features': [ 'deprecated' ] },
'return-path', 'pause-before-switchover', 'multifd',
'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
{ 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },

View file

@ -143,8 +143,6 @@ meson_options_help() {
printf "%s\n" ' libvduse build VDUSE Library'
printf "%s\n" ' linux-aio Linux AIO support'
printf "%s\n" ' linux-io-uring Linux io_uring support'
printf "%s\n" ' live-block-migration'
printf "%s\n" ' block migration in the main migration stream'
printf "%s\n" ' lzfse lzfse support for DMG images'
printf "%s\n" ' lzo lzo compression support'
printf "%s\n" ' malloc-trim enable libc malloc_trim() for memory optimization'
@ -382,8 +380,6 @@ _meson_option_parse() {
--disable-linux-aio) printf "%s" -Dlinux_aio=disabled ;;
--enable-linux-io-uring) printf "%s" -Dlinux_io_uring=enabled ;;
--disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;;
--enable-live-block-migration) printf "%s" -Dlive_block_migration=enabled ;;
--disable-live-block-migration) printf "%s" -Dlive_block_migration=disabled ;;
--localedir=*) quote_sh "-Dlocaledir=$2" ;;
--localstatedir=*) quote_sh "-Dlocalstatedir=$2" ;;
--enable-lzfse) printf "%s" -Dlzfse=enabled ;;