qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com
Subject: Re: [PATCH 24/29] migration, vl: start migration via qmp_migrate_incoming
Date: Fri, 20 Nov 2020 16:34:08 +0100	[thread overview]
Message-ID: <20201120163408.7740a92f@redhat.com> (raw)
In-Reply-To: <20201027182144.3315885-25-pbonzini@redhat.com>

On Tue, 27 Oct 2020 14:21:39 -0400
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Make qemu_start_incoming_migration local to migration/migration.c.
> By using the runstate instead of a separate flag, vl need not do
> anything to setup deferred incoming migration.
> 
> qmp_migrate_incoming also does not need the deferred_incoming flag
> anymore, because "-incoming PROTOCOL" will clear the "once" flag
> before the main loop starts.  Therefore, later invocations of
> the migrate-incoming command will fail with the existing
> "The incoming migration has already been started" error message.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/migration/misc.h |  1 -
>  migration/migration.c    | 33 ++++++++-------------------------
>  softmmu/vl.c             | 11 +++++++----
>  3 files changed, 15 insertions(+), 30 deletions(-)
> 
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index 34e7d75713..bccc1b6b44 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -58,7 +58,6 @@ void dump_vmstate_json_to_file(FILE *out_fp);
>  /* migration/migration.c */
>  void migration_object_init(void);
>  void migration_shutdown(void);
> -void qemu_start_incoming_migration(const char *uri, Error **errp);
>  bool migration_is_idle(void);
>  bool migration_is_active(MigrationState *);
>  void add_migration_state_change_notifier(Notifier *notify);
> diff --git a/migration/migration.c b/migration/migration.c
> index f48b03cac2..d078094c56 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -114,8 +114,6 @@
>  static NotifierList migration_state_notifiers =
>      NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
>  
> -static bool deferred_incoming;
> -
>  /* Messages sent on the return path from destination to source */
>  enum mig_rp_message_type {
>      MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
> @@ -257,19 +255,6 @@ static bool migrate_late_block_activate(void)
>          MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
>  }
>  
> -/*
> - * Called on -incoming with a defer: uri.
> - * The migration can be started later after any parameters have been
> - * changed.
> - */
> -static void deferred_incoming_migration(Error **errp)
> -{
> -    if (deferred_incoming) {
> -        error_setg(errp, "Incoming migration already deferred");
> -    }
> -    deferred_incoming = true;
> -}
> -
>  /*
>   * Send a message on the return channel back to the source
>   * of the migration.
> @@ -380,16 +365,14 @@ void migrate_add_address(SocketAddress *address)
>      addrs->value = QAPI_CLONE(SocketAddress, address);
>  }
>  
> -void qemu_start_incoming_migration(const char *uri, Error **errp)
> +static void qemu_start_incoming_migration(const char *uri, Error **errp)
>  {
>      const char *p = NULL;
>  
>      qapi_event_send_migration(MIGRATION_STATUS_SETUP);
> -    if (!strcmp(uri, "defer")) {
> -        deferred_incoming_migration(errp);
> -    } else if (strstart(uri, "tcp:", &p) ||
> -               strstart(uri, "unix:", NULL) ||
> -               strstart(uri, "vsock:", NULL)) {
considering the last hunk does won't call qmp_migrate_incoming
if 'defer' was used, wouldn't we will lose QAPI event here?
not sure how important it to users,
Ccing David

> +    if (strstart(uri, "tcp:", &p) ||
> +        strstart(uri, "unix:", NULL) ||
> +        strstart(uri, "vsock:", NULL)) {
>          socket_start_incoming_migration(p ? p : uri, errp);
>  #ifdef CONFIG_RDMA
>      } else if (strstart(uri, "rdma:", &p)) {
> @@ -1926,14 +1909,14 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
>      Error *local_err = NULL;
>      static bool once = true;
>  
> -    if (!deferred_incoming) {
> -        error_setg(errp, "For use with '-incoming defer'");
> -        return;
> -    }
>      if (!once) {
>          error_setg(errp, "The incoming migration has already been started");
>          return;
>      }
> +    if (!runstate_check(RUN_STATE_INMIGRATE)) {
> +        error_setg(errp, "'-incoming' was not specified on the command line");
> +        return;
> +    }
>  
>      qemu_start_incoming_migration(uri, &local_err);
>  
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ae2854d8af..583366510b 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -109,6 +109,7 @@
>  #include "qapi/qapi-visit-block-core.h"
>  #include "qapi/qapi-visit-ui.h"
>  #include "qapi/qapi-commands-block-core.h"
> +#include "qapi/qapi-commands-migration.h"
>  #include "qapi/qapi-commands-run-state.h"
>  #include "qapi/qapi-commands-ui.h"
>  #include "qapi/qmp/qerror.h"
> @@ -4557,10 +4558,12 @@ void qemu_init(int argc, char **argv, char **envp)
>      }
>      if (incoming) {
>          Error *local_err = NULL;
> -        qemu_start_incoming_migration(incoming, &local_err);
> -        if (local_err) {
> -            error_reportf_err(local_err, "-incoming %s: ", incoming);
> -            exit(1);
> +        if (strcmp(incoming, "defer") != 0) {
> +            qmp_migrate_incoming(incoming, &local_err);
> +            if (local_err) {
> +                error_reportf_err(local_err, "-incoming %s: ", incoming);
> +                exit(1);
> +            }
>          }
>      } else if (autostart) {
>          vm_start();



  reply	other threads:[~2020-11-20 15:36 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 18:21 [RFC PATCH v2 00/37] cleanup qemu_init and make sense of command line processing Paolo Bonzini
2020-10-27 18:21 ` [PATCH 01/29] trace: remove argument from trace_init_file Paolo Bonzini
2020-10-27 18:21 ` [PATCH 02/29] semihosting: fix order of initialization functions Paolo Bonzini
2020-10-27 18:21 ` [PATCH 03/29] vl: extract validation of -smp to machine.c Paolo Bonzini
2020-10-28 16:32   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 04/29] vl: remove bogus check Paolo Bonzini
2020-10-28 16:48   ` Igor Mammedov
2020-10-28 16:55     ` Daniel P. Berrangé
2020-10-28 19:32   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 05/29] vl: split various early command line options to a separate function Paolo Bonzini
2020-11-02 15:30   ` Igor Mammedov
2020-11-02 16:33     ` Paolo Bonzini
2020-10-27 18:21 ` [PATCH 06/29] vl: move various initialization routines out of qemu_init Paolo Bonzini
2020-11-02 15:40   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 07/29] vl: extract qemu_init_subsystems Paolo Bonzini
2020-11-02 15:55   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 08/29] vl: move prelaunch part of qemu_init to new functions Paolo Bonzini
2020-11-11 19:29   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 09/29] vl: extract various command line validation snippets to a new function Paolo Bonzini
2020-11-11 19:39   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 10/29] vl: preconfig and loadvm are mutually exclusive Paolo Bonzini
2020-11-11 19:58   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 11/29] vl: extract various command line desugaring snippets to a new function Paolo Bonzini
2020-11-11 19:57   ` Igor Mammedov
2020-11-11 20:04     ` Paolo Bonzini
2020-11-18 16:55       ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 12/29] vl: create "-net nic -net user" default earlier Paolo Bonzini
2020-11-18 14:43   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 13/29] vl: load plugins as late as possible Paolo Bonzini
2020-10-27 18:21 ` [PATCH 14/29] vl: move semihosting command line fallback to qemu_finish_machine_init Paolo Bonzini
2020-10-27 18:21 ` [PATCH 15/29] vl: extract default devices to separate functions Paolo Bonzini
2020-10-27 18:21 ` [PATCH 16/29] vl: move CHECKPOINT_INIT after preconfig Paolo Bonzini
2020-10-27 18:21 ` [PATCH 17/29] vl: separate qemu_create_early_backends Paolo Bonzini
2020-11-18 16:29   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 18/29] vl: separate qemu_create_late_backends Paolo Bonzini
2020-11-18 16:33   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 19/29] vl: separate qemu_create_machine Paolo Bonzini
2020-11-18 16:45   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 20/29] vl: separate qemu_apply_machine_options Paolo Bonzini
2020-11-18 16:57   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 21/29] vl: separate qemu_resolve_machine_memdev Paolo Bonzini
2020-11-20 13:15   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 22/29] vl: initialize displays before preconfig loop Paolo Bonzini
2020-11-20 15:11   ` Igor Mammedov
2020-11-20 15:53     ` Paolo Bonzini
2020-11-20 16:32       ` Igor Mammedov
2020-11-20 16:46         ` Paolo Bonzini
2020-11-20 17:11           ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 23/29] vl: move -global check earlier Paolo Bonzini
2020-11-20 15:10   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 24/29] migration, vl: start migration via qmp_migrate_incoming Paolo Bonzini
2020-11-20 15:34   ` Igor Mammedov [this message]
2020-11-20 16:02     ` Paolo Bonzini
2020-12-02 13:10       ` Dr. David Alan Gilbert
2020-12-02 13:15         ` Daniel P. Berrangé
2020-12-02 13:29           ` Paolo Bonzini
2020-12-02 13:36         ` Paolo Bonzini
2020-12-02 15:08           ` Dr. David Alan Gilbert
2020-10-27 18:21 ` [PATCH 25/29] vl: start VM via qmp_cont Paolo Bonzini
2020-11-20 16:08   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 26/29] hmp: introduce cmd_available Paolo Bonzini
2020-11-20 15:46   ` Igor Mammedov
2020-10-27 18:21 ` [PATCH 27/29] remove preconfig state Paolo Bonzini
2020-11-20 16:01   ` Igor Mammedov
2020-11-20 16:22     ` Paolo Bonzini
2020-10-27 18:21 ` [PATCH 28/29] vl: remove separate preconfig main_loop Paolo Bonzini
2020-11-20 16:26   ` Igor Mammedov
2020-11-20 16:39     ` Paolo Bonzini
2020-11-23  8:34     ` Paolo Bonzini
2020-10-27 18:21 ` [PATCH 29/29] vl: allow -incoming defer with -preconfig Paolo Bonzini
2020-11-20 16:28   ` Igor Mammedov
2020-11-20 16:45     ` Paolo Bonzini
2020-11-02 15:57 ` [RFC PATCH v2 00/37] cleanup qemu_init and make sense of command line processing Igor Mammedov
2020-11-02 16:34   ` Paolo Bonzini
2020-11-03 12:57     ` Igor Mammedov
2020-11-03 14:37       ` Paolo Bonzini
2020-11-20 16:19         ` Igor Mammedov
2020-11-20 16:27           ` Paolo Bonzini

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=20201120163408.7740a92f@redhat.com \
    --to=imammedo@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).