qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: Yonit Halperin <yhalperi@redhat.com>
Cc: qemu-devel@nongnu.org, spice-devel@freedesktop.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH spice-server 12/13] server: fall back to switch host scheme in case semi-seamless connection to target fails
Date: Thu, 22 Sep 2011 17:38:32 +0300	[thread overview]
Message-ID: <20110922143832.GF2875@bow.tlv.redhat.com> (raw)
In-Reply-To: <1316620283-8330-13-git-send-email-yhalperi@redhat.com>

On Wed, Sep 21, 2011 at 06:51:22PM +0300, Yonit Halperin wrote:
> 
> Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
> ---
>  server/reds.c |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 76aa0ed..54c06d1 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -283,6 +283,7 @@ typedef struct RedsState {
>      int mig_wait_disconnect;
>      int mig_wait_prev_complete;
>      int mig_inprogress;
> +    int mig_connect_ok;
>      int expect_migrate;
>      int mig_target;
>      RedsMigSpice *mig_spice;
> @@ -1736,6 +1737,7 @@ static void reds_main_handle_message(void *opaque, size_t size, uint32_t type, v
>      case SPICE_MSGC_MAIN_MIGRATE_CONNECTED:
>          red_printf("client connected to migration target");
>          if (reds->mig_wait_connect) {
> +            reds->mig_connect_ok = TRUE;
>              reds_mig_cleanup();
>          }
>          break;
> @@ -1743,6 +1745,7 @@ static void reds_main_handle_message(void *opaque, size_t size, uint32_t type, v
>          // TODO: fall into switch host in case of connect error or timeout
So this is no longer true?

>          red_printf("mig connect error");
>          if (reds->mig_wait_connect) {
> +            reds->mig_connect_ok = FALSE;
>              reds_mig_cleanup();
>          }
>          break;
> @@ -2172,6 +2175,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
>      reds->mig_inprogress = FALSE;
>      reds->mig_wait_connect = FALSE;
>      reds->mig_wait_disconnect = FALSE;
> +    reds->mig_connect_ok = FALSE;
>      reds->stream = link->stream;
>      reds->in_handler.shut = FALSE;
>  
> @@ -4151,8 +4155,6 @@ static void reds_mig_connect(void)
>  
>      reds_push_pipe_item(item);
>  
> -    reds_mig_release();
> -
>      reds->mig_wait_connect = TRUE;
>      core->timer_start(reds->mig_timer, MIGRATE_TIMEOUT);
>  }
> @@ -4194,6 +4196,7 @@ static void reds_mig_started(void)
>  
>      reds_listen_stop();
>      sif = SPICE_CONTAINEROF(migration_interface->base.sif, SpiceMigrateInterface, base);
> +    reds->mig_connect_ok = FALSE;
>  
>      if (reds->stream == NULL) {
>          red_printf("not connected to stream");
> @@ -4227,7 +4230,7 @@ static void reds_mig_finished(int completed)
>      RedsOutItem *item;
>  
>      red_printf("");
> -
> +    reds_mig_release();
>      if (reds->stream == NULL) {
>          red_printf("no stream connected");
>          return;
> @@ -4298,7 +4301,12 @@ static void migrate_timeout(void *opaque)
>  {
>      red_printf("");
>      ASSERT(reds->mig_wait_connect || reds->mig_wait_disconnect || reds->mig_wait_prev_complete);
> -    reds_mig_disconnect();
> +    if (reds->mig_wait_connect) {
> +        reds->mig_connect_ok = FALSE;
> +        reds_mig_cleanup();
> +    } else {
> +        reds_mig_disconnect();
> +    }
>  }
>  
>  static void key_modifiers_sender(void *opaque)
> @@ -5188,7 +5196,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_end(SpiceServer *s, int completed)
>          goto complete;
>      }
>  
> -    if (reds->client_semi_mig_cap) {
> +    if (reds->client_semi_mig_cap && reds->mig_connect_ok) {
>          reds_mig_finished(completed);
>      } else {
>          ret = spice_server_migrate_switch(s);
> -- 
> 1.7.4.4
> 

  reply	other threads:[~2011-09-22 14:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 15:51 [Qemu-devel] [PATCH spice-server 00/13] semi-seamless migration v2 (RHBZ #738266, 725009) Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 01/13] server/spice.h: semi-seamless migration interface, RHBZ #738266 Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 02/13] server: handle migration interface addition Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 03/13] configure: spice-protocol >= 0.8.2 (semi-seamless migration protocol) Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 04/13] server, proto: tell the client to connect to the migration target before migraton starts Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 05/13] spice.proto: add SPICE_MSG_MAIN_MIGRATE_END & SPICE_MSGC_MAIN_MIGRATE_END Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 06/13] server: send SPICE_MSG_MAIN_MIGRATE_END on spice_server_migrate_end Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 07/13] server: move SPICE_MSG_MAIN_INIT sending code to a separate routine Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 08/13] server: move the linking of channels " Yonit Halperin
2011-09-22 14:01   ` Alon Levy
2011-09-25  9:13     ` Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 09/13] server: handling semi-seamless migration in the target side Yonit Halperin
2011-09-22 14:28   ` Alon Levy
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 10/13] server: call migrate_connect_complete callback when no client is connected Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 11/13] server: turn spice_server_migrate_start into a valid call Yonit Halperin
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 12/13] server: fall back to switch host scheme in case semi-seamless connection to target fails Yonit Halperin
2011-09-22 14:38   ` Alon Levy [this message]
2011-09-21 15:51 ` [Qemu-devel] [PATCH spice-server 13/13] Release 0.8.3 Yonit Halperin
2011-09-22 14:50 ` [Qemu-devel] [PATCH spice-server 00/13] semi-seamless migration v2 (RHBZ #738266, 725009) Alon Levy

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=20110922143832.GF2875@bow.tlv.redhat.com \
    --to=alevy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=spice-devel@freedesktop.org \
    --cc=yhalperi@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 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).