This parameter enables backend-transfer feature: all devices which support it will migrate their backends (for example a TAP device, by passing open file descriptor to migration channel).
Currently no such devices, so the new parameter is a noop. Next commit will add support for virtio-net, to migrate its TAP backend. Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> --- migration/options.c | 18 ++++++++++++++++++ migration/options.h | 2 ++ qapi/migration.json | 38 ++++++++++++++++++++++++++++++++------ 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/migration/options.c b/migration/options.c index 5183112775..a461b07b54 100644 --- a/migration/options.c +++ b/migration/options.c @@ -262,6 +262,12 @@ bool migrate_mapped_ram(void) return s->capabilities[MIGRATION_CAPABILITY_MAPPED_RAM]; } +bool migrate_backend_transfer(void) +{ + MigrationState *s = migrate_get_current(); + return s->parameters.backend_transfer; +} + bool migrate_ignore_shared(void) { MigrationState *s = migrate_get_current(); @@ -963,6 +969,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) params->cpr_exec_command = QAPI_CLONE(strList, s->parameters.cpr_exec_command); + params->has_backend_transfer = true; + params->backend_transfer = s->parameters.backend_transfer; + return params; } @@ -997,6 +1006,7 @@ void migrate_params_init(MigrationParameters *params) params->has_zero_page_detection = true; params->has_direct_io = true; params->has_cpr_exec_command = true; + params->has_backend_transfer = true; } /* @@ -1305,6 +1315,10 @@ static void migrate_params_test_apply(MigrateSetParameters *params, if (params->has_cpr_exec_command) { dest->cpr_exec_command = params->cpr_exec_command; } + + if (params->has_backend_transfer) { + dest->backend_transfer = params->backend_transfer; + } } static void migrate_params_apply(MigrateSetParameters *params, Error **errp) @@ -1443,6 +1457,10 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp) s->parameters.cpr_exec_command = QAPI_CLONE(strList, params->cpr_exec_command); } + + if (params->has_backend_transfer) { + s->parameters.backend_transfer = params->backend_transfer; + } } void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) diff --git a/migration/options.h b/migration/options.h index 82d839709e..755ba1c024 100644 --- a/migration/options.h +++ b/migration/options.h @@ -87,6 +87,8 @@ const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); +bool migrate_backend_transfer(void); + /* parameters helpers */ bool migrate_params_check(MigrationParameters *params, Error **errp); diff --git a/qapi/migration.json b/qapi/migration.json index be0f3fcc12..35601a1f87 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -951,9 +951,16 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @backend-transfer: Enable backend-transfer feature for devices that +# supports it. In general that means that backend state and its +# file descriptors are passed to the destination in the migraton +# channel (which must be a UNIX socket). Individual devices +# declare the support for backend-transfer by per-device +# backend-transfer option. (Since 10.2) +# # Features: # -# @unstable: Members @x-checkpoint-delay and +# @unstable: Members @backend-transfer, @x-checkpoint-delay and # @x-vcpu-dirty-limit-period are experimental. # # Since: 2.4 @@ -978,7 +985,8 @@ 'mode', 'zero-page-detection', 'direct-io', - 'cpr-exec-command'] } + 'cpr-exec-command', + { 'name': 'backend-transfer', 'features': ['unstable'] } ] } ## # @MigrateSetParameters: @@ -1137,9 +1145,16 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @backend-transfer: Enable backend-transfer feature for devices that +# supports it. In general that means that backend state and its +# file descriptors are passed to the destination in the migraton +# channel (which must be a UNIX socket). Individual devices +# declare the support for backend-transfer by per-device +# backend-transfer option. (Since 10.2) +# # Features: # -# @unstable: Members @x-checkpoint-delay and +# @unstable: Members @backend-transfer, @x-checkpoint-delay and # @x-vcpu-dirty-limit-period are experimental. # # TODO: either fuse back into `MigrationParameters`, or make @@ -1179,7 +1194,9 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*backend-transfer': { 'type': 'bool', + 'features': [ 'unstable' ] } } } ## # @migrate-set-parameters: @@ -1352,9 +1369,16 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @backend-transfer: Enable backend-transfer feature for devices that +# supports it. In general that means that backend state and its +# file descriptors are passed to the destination in the migraton +# channel (which must be a UNIX socket). Individual devices +# declare the support for backend-transfer by per-device +# backend-transfer option. (Since 10.2) +# # Features: # -# @unstable: Members @x-checkpoint-delay and +# @unstable: Members @backend-transfer, @x-checkpoint-delay and # @x-vcpu-dirty-limit-period are experimental. # # Since: 2.4 @@ -1391,7 +1415,9 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', - '*cpr-exec-command': [ 'str' ]} } + '*cpr-exec-command': [ 'str' ], + '*backend-transfer': { 'type': 'bool', + 'features': [ 'unstable' ] } } } ## # @query-migrate-parameters: -- 2.48.1
