To migrate TAP device (including open fds) locally, user should: 1. enable local-tap migration capability both on source and target 2. use additional local-incoming=true option for tap on target
Why capability is not enough? We need an option to modify early initialization of TAP, to avoid opening new fds. The capability may not be set at the moment of netdev initialization. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru> --- migration/options.c | 7 +++++++ migration/options.h | 1 + qapi/migration.json | 9 ++++++++- qapi/net.json | 12 +++++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 11b719c81b..fd0cca97b3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -276,6 +276,13 @@ bool migrate_local_vhost_user_blk(void) return s->capabilities[MIGRATION_CAPABILITY_LOCAL_VHOST_USER_BLK]; } +bool migrate_local_tap(void) +{ + MigrationState *s = migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_LOCAL_TAP]; +} + bool migrate_ignore_shared(void) { MigrationState *s = migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 5a40ac073d..aa0ab6a61f 100644 --- a/migration/options.h +++ b/migration/options.h @@ -32,6 +32,7 @@ bool migrate_events(void); bool migrate_mapped_ram(void); bool migrate_local_char_socket(void); bool migrate_local_vhost_user_blk(void); +bool migrate_local_tap(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); bool migrate_multifd(void); diff --git a/qapi/migration.json b/qapi/migration.json index ead7f4d17c..bf554684f4 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -529,6 +529,12 @@ # For target device also @local-incoming option must be specified # (since 10.2) # +# @local-tap: Migrate TAPs locally, keeping backend alive. Open file +# descriptors and TAP-related state are migrated. Only may be +# used when migration channel is unix socket. For target device +# also @local-incoming option must be specified (since 10.2) +# (since 10.2) +# # Features: # # @unstable: Members @x-colo, @x-ignore-shared, @local-char-socket, @@ -551,7 +557,8 @@ 'zero-copy-send', 'postcopy-preempt', 'switchover-ack', 'dirty-limit', 'mapped-ram', { 'name': 'local-char-socket', 'features': [ 'unstable' ] }, - { 'name': 'local-vhost-user-blk', 'features': [ 'unstable' ] } ] } + { 'name': 'local-vhost-user-blk', 'features': [ 'unstable' ] }, + { 'name': 'local-tap', 'features': [ 'unstable' ] } ] } ## # @MigrationCapabilityStatus: diff --git a/qapi/net.json b/qapi/net.json index 78bcc9871e..8f53549d58 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -353,6 +353,15 @@ # @poll-us: maximum number of microseconds that could be spent on busy # polling for tap (since 2.7) # +# @local-incoming: Do load open file descriptor for that TAP +# on incoming migration. May be used only if QEMU is started +# for incoming migration. Will work only together with local-tap +# migration capability enabled (default: false) (Since: 10.2) +# +# Features: +# +# @unstable: Member @local-incoming is experimental +# # Since: 1.2 ## { 'struct': 'NetdevTapOptions', @@ -371,7 +380,8 @@ '*vhostfds': 'str', '*vhostforce': 'bool', '*queues': 'uint32', - '*poll-us': 'uint32'} } + '*poll-us': 'uint32', + '*local-incoming': { 'type': 'bool', 'features': [ 'unstable' ] } } } ## # @NetdevSocketOptions: -- 2.48.1