All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Het Gala <het.gala@nutanix.com>
Cc: qemu-devel@nongnu.org,  prerna.saxena@nutanix.com,
	 quintela@redhat.com, dgilbert@redhat.com,  pbonzini@redhat.com,
	 berrange@redhat.com, eblake@redhat.com,
	 manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com
Subject: Re: [PATCH v7 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration
Date: Wed, 12 Jul 2023 15:03:51 +0200	[thread overview]
Message-ID: <87y1jlp9hk.fsf@pond.sub.org> (raw)
In-Reply-To: <20230710122750.69194-7-het.gala@nutanix.com> (Het Gala's message of "Mon, 10 Jul 2023 12:27:47 +0000")

The subject

    migration: modified migration QAPIs to accept 'channels' argument for migration

is rather long.  Try to limit subjects to about 60 characters.  Easily
done here:

    migration: New migrate and migrate-incoming argument 'channels'

Het Gala <het.gala@nutanix.com> writes:

> MigrateChannelList allows to connect accross multiple interfaces. Added
> MigrateChannelList struct as argument to migration QAPIs.


We prefer imperative mood for describing a change in a commit message:
"Add MigrateChannelList argument ..."

> Future patchset series plans to include multiple MigrateChannels
> for multiple interfaces to be connected. That is the reason,
> 'MigrateChannelList'
> is the preferred choice of argument over 'MigrateChannel' and making
> migration QAPIs future proof.

If you need to respin, please reflow the paragraph like this:

  Future patchset series plans to include multiple MigrateChannels for
  multiple interfaces to be connected.  That is the reason
  'MigrateChannelList' is the preferred choice of argument over
  'MigrateChannel' and making migration QAPIs future proof.

Or less wordy:

  We plan to support multiple channels in the future, so multiple
  interfaces can be connected.  This is why we make the new argument a
  MigrateChannelList instead of a MigrateChannel.

> For current patchset series, have limited the size of the list to single
> element (single interface) as runtime check.
>
> Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
> Signed-off-by: Het Gala <het.gala@nutanix.com>
> ---
>  migration/migration-hmp-cmds.c |  16 +++--
>  migration/migration.c          |  34 ++++++++--
>  qapi/migration.json            | 109 ++++++++++++++++++++++++++++++++-
>  softmmu/vl.c                   |   2 +-
>  4 files changed, 147 insertions(+), 14 deletions(-)
>
> diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
> index 9885d7c9f7..5f04598202 100644
> --- a/migration/migration-hmp-cmds.c
> +++ b/migration/migration-hmp-cmds.c
> @@ -423,10 +423,12 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
>  {
>      Error *err = NULL;
>      const char *uri = qdict_get_str(qdict, "uri");
> +    MigrationChannelList *caps = NULL;
> +    g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1);
>  
> -    qmp_migrate_incoming(uri, &err);
> -
> -    hmp_handle_error(mon, err);
> +    QAPI_LIST_PREPEND(caps, channel);
> +    qmp_migrate_incoming(uri, false, caps, &err);
> +    qapi_free_MigrationChannelList(caps);
>  }
>  
>  void hmp_migrate_recover(Monitor *mon, const QDict *qdict)
> @@ -704,9 +706,13 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
>      bool resume = qdict_get_try_bool(qdict, "resume", false);
>      const char *uri = qdict_get_str(qdict, "uri");
>      Error *err = NULL;
> +    MigrationChannelList *caps = NULL;
> +    g_autoptr(MigrationChannel) channel = g_new0(MigrationChannel, 1);
>  
> -    qmp_migrate(uri, !!blk, blk, !!inc, inc,
> -                false, false, true, resume, &err);
> +    QAPI_LIST_PREPEND(caps, channel);
> +    qmp_migrate(uri, false, caps, !!blk, blk, !!inc, inc,
> +                 false, false, true, resume, &err);
> +    qapi_free_MigrationChannelList(caps);
>      if (hmp_handle_error(mon, err)) {
>          return;
>      }
> diff --git a/migration/migration.c b/migration/migration.c
> index 52e2ec3502..65272ef739 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -465,10 +465,22 @@ static bool migrate_uri_parse(const char *uri,
>      return true;
>  }
>  
> -static void qemu_start_incoming_migration(const char *uri, Error **errp)
> +static void qemu_start_incoming_migration(const char *uri, bool has_channels,
> +                                          MigrationChannelList *channels,
> +                                          Error **errp)
>  {
>      g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1);
>  
> +    /*
> +     * Having preliminary checks for uri and channel
> +     */
> +    if (uri && has_channels) {
> +        error_setg(errp, "'uri' and 'channels' arguments are mutually "
> +                   "exclusive; exactly one of the two should be present in "
> +                   "'migrate-incoming' qmp command ");
> +        return;
> +    }
> +
>      /* URI is not suitable for migration? */
>      if (!migration_channels_and_uri_compatible(uri, errp)) {
>          return;
> @@ -1496,7 +1508,8 @@ void migrate_del_blocker(Error *reason)
>      migration_blockers = g_slist_remove(migration_blockers, reason);
>  }
>  
> -void qmp_migrate_incoming(const char *uri, Error **errp)
> +void qmp_migrate_incoming(const char *uri, bool has_channels,
> +                          MigrationChannelList *channels, Error **errp)
>  {
>      Error *local_err = NULL;
>      static bool once = true;
> @@ -1514,7 +1527,7 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
>          return;
>      }
>  
> -    qemu_start_incoming_migration(uri, &local_err);
> +    qemu_start_incoming_migration(uri, has_channels, channels, &local_err);
>  
>      if (local_err) {
>          yank_unregister_instance(MIGRATION_YANK_INSTANCE);
> @@ -1550,7 +1563,7 @@ void qmp_migrate_recover(const char *uri, Error **errp)
>       * only re-setup the migration stream and poke existing migration
>       * to continue using that newly established channel.
>       */
> -    qemu_start_incoming_migration(uri, errp);
> +    qemu_start_incoming_migration(uri, false, NULL, errp);
>  }
>  
>  void qmp_migrate_pause(Error **errp)
> @@ -1684,7 +1697,8 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
>      return true;
>  }
>  
> -void qmp_migrate(const char *uri, bool has_blk, bool blk,
> +void qmp_migrate(const char *uri, bool has_channels,
> +                 MigrationChannelList *channels, bool has_blk, bool blk,
>                   bool has_inc, bool inc, bool has_detach, bool detach,
>                   bool has_resume, bool resume, Error **errp)
>  {
> @@ -1693,6 +1707,16 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>      MigrationState *s = migrate_get_current();
>      g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1);
>  
> +    /*
> +     * Having preliminary checks for uri and channel
> +     */
> +    if (uri && has_channels) {
> +        error_setg(errp, "'uri' and 'channels' arguments are mutually "
> +                   "exclusive; exactly one of the two should be present in "
> +                   "'migrate' qmp command ");
> +        return;
> +    }
> +
>      /* URI is not suitable for migration? */
>      if (!migration_channels_and_uri_compatible(uri, errp)) {
>          return;
> diff --git a/qapi/migration.json b/qapi/migration.json
> index b583642c2d..239affdc34 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -1458,6 +1458,34 @@
>      'exec': 'MigrationExecCommand',
>      'rdma': 'InetSocketAddress' } }
>  
> +##
> +# @MigrationChannelType:
> +#
> +# The migration channel-type request options.
> +#
> +# @main: Main outbound migration channel.
> +#
> +# Since 8.1
> +##
> +{ 'enum': 'MigrationChannelType',
> +  'data': [ 'main' ] }
> +
> +##
> +# @MigrationChannel:
> +#
> +# Migration stream channel parameters.
> +#
> +# @channel-type: Channel type for transfering packet information.
> +#
> +# @addr: Migration endpoint configuration on destination interface.
> +#
> +# Since 8.1
> +##
> +{ 'struct': 'MigrationChannel',
> +  'data': {
> +      'channel-type': 'MigrationChannelType',
> +      'addr': 'MigrationAddress' } }
> +
>  ##
>  # @migrate:
>  #
> @@ -1465,6 +1493,9 @@
>  #
>  # @uri: the Uniform Resource Identifier of the destination VM
>  #
> +# @channels: list of migration stream channels with each stream
> +#     in the list connected to a destination interface endpoint.

Formatting is acceptable as is, but if you need to respin, tweak it like
this:

   # @channels: list of migration stream channels with each stream in the
   #     list connected to a destination interface endpoint.

> +#
>  # @blk: do block migration (full disk copy)
>  #
>  # @inc: incremental disk copy migration
> @@ -1489,14 +1520,50 @@
>  # 3. The user Monitor's "detach" argument is invalid in QMP and should
>  #    not be used
>  #
> +# 4. The uri argument should have the Uniform Resource Identifier of
> +#    default destination VM. This connection will be bound to default
> +#    network.
> +#
> +# 5. For now, number of migration streams is restricted to one, i.e
> +#    number of items in 'channels' list is just 1.
> +#
> +# 6. The 'uri' and 'channels' arguments are mutually exclusive;
> +#    exactly one of the two should be present.
> +#
>  # Example:
>  #
>  # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
>  # <- { "return": {} }
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "socket",
> +#                                    "type": "inet",
> +#                                    "host": "10.12.34.9",
> +#                                    "port": "1050" } } ] } }
> +# <- { "return": {} }
> +#
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "exec",
> +#                                    "args": [ "/bin/nc", "-p", "6000",
> +#                                              "/some/sock" ] } } ] } }
> +# <- { "return": {} }
> +#
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "rdma",
> +#                                    "host": "10.12.34.9",
> +#                                    "port": "1050" } } ] } }
> +# <- { "return": {} }
> +#
>  ##
>  { 'command': 'migrate',
> -  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
> -           '*detach': 'bool', '*resume': 'bool' } }
> +  'data': {'*uri': 'str', '*channels': [ 'MigrationChannel' ],
> +           '*blk': 'bool', '*inc': 'bool', '*detach': 'bool',
> +           '*resume': 'bool' } }
>  
>  ##
>  # @migrate-incoming:
> @@ -1507,6 +1574,9 @@
>  # @uri: The Uniform Resource Identifier identifying the source or
>  #     address to listen on
>  #
> +# @channels: list of migration stream channels with each stream
> +#     in the list connected to a destination interface endpoint.

   # @channels: list of migration stream channels with each stream in the
   #     list connected to a destination interface endpoint.

Likewise.

> +#
>  # Returns: nothing on success
>  #
>  # Since: 2.3
> @@ -1522,13 +1592,46 @@
>  #
>  # 3. The uri format is the same as for -incoming
>  #
> +# 5. For now, number of migration streams is restricted to one, i.e
> +#    number of items in 'channels' list is just 1.
> +#
> +# 4. The 'uri' and 'channels' arguments are mutually exclusive;
> +#    exactly one of the two should be present.
> +#
>  # Example:
>  #
>  # -> { "execute": "migrate-incoming",
>  #      "arguments": { "uri": "tcp::4446" } }
>  # <- { "return": {} }
> +#
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "socket",
> +#                                    "type": "inet",
> +#                                    "host": "10.12.34.9",
> +#                                    "port": "1050" } } ] } }
> +# <- { "return": {} }
> +#
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "exec",
> +#                                    "args": [ "/bin/nc", "-p", "6000",
> +#                                              "/some/sock" ] } } ] } }
> +# <- { "return": {} }
> +#
> +# -> { "execute": "migrate",
> +#      "arguments": {
> +#          "channels": [ { "channel-type": "main",
> +#                          "addr": { "transport": "rdma",
> +#                                    "host": "10.12.34.9",
> +#                                    "port": "1050" } } ] } }
> +# <- { "return": {} }
>  ##
> -{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
> +{ 'command': 'migrate-incoming',
> +             'data': {'*uri': 'str',
> +                      '*channels': [ 'MigrationChannel' ] } }
>  
>  ##
>  # @xen-save-devices-state:
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b0b96f67fa..d811f3f878 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2651,7 +2651,7 @@ void qmp_x_exit_preconfig(Error **errp)
>      if (incoming) {
>          Error *local_err = NULL;
>          if (strcmp(incoming, "defer") != 0) {
> -            qmp_migrate_incoming(incoming, &local_err);
> +            qmp_migrate_incoming(incoming, false, NULL, &local_err);
>              if (local_err) {
>                  error_reportf_err(local_err, "-incoming %s: ", incoming);
>                  exit(1);

The issues I'm pointing out don't justfy yet another respin.  But if you
need to respin the series for some other reason, plase take care of them.

Acked-by: Markus Armbruster <armbru@redhat.com>



  reply	other threads:[~2023-07-12 13:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 12:27 [PATCH v7 0/9] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration Het Gala
2023-07-10 12:27 ` [PATCH v7 1/9] migration: introduced 'MigrateAddress' in QAPI for migration wire protocol Het Gala
2023-07-12 12:55   ` Markus Armbruster
2023-07-13  7:53     ` Het Gala
2023-07-10 12:27 ` [PATCH v7 2/9] migration: convert uri parameter into 'MigrateAddress' struct Het Gala
2023-07-10 12:27 ` [PATCH v7 3/9] migration: convert socket backend to accept MigrateAddress struct Het Gala
2023-07-10 12:27 ` [PATCH v7 4/9] migration: convert rdma " Het Gala
2023-07-10 12:27 ` [PATCH v7 5/9] migration: convert exec " Het Gala
2023-07-10 12:27 ` [PATCH v7 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration Het Gala
2023-07-12 13:03   ` Markus Armbruster [this message]
2023-07-10 12:27 ` [PATCH v7 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate new migration QAPI syntax Het Gala
2023-07-10 12:27 ` [PATCH v7 8/9] migration: Introduced MigrateChannelList struct to migration code flow Het Gala
2023-07-10 12:27 ` [PATCH v7 9/9] migration: adding test case for modified QAPI syntax Het Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1jlp9hk.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=aravind.retnakaran@nutanix.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=het.gala@nutanix.com \
    --cc=manish.mishra@nutanix.com \
    --cc=pbonzini@redhat.com \
    --cc=prerna.saxena@nutanix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.