All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Yonit Halperin <yhalperi@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 05/14] spice: add 'migrated' flag to spice info
Date: Thu,  6 Sep 2012 09:21:31 +0200	[thread overview]
Message-ID: <1346916100-12958-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1346916100-12958-1-git-send-email-kraxel@redhat.com>

From: Yonit Halperin <yhalperi@redhat.com>

The flag is 'true' when spice migration has completed on the src side.
It is needed for a case where libvirt dies before migration completes
and it misses the event QEVENT_SPICE_MIGRATE_COMPLETED.
When libvirt is restored and queries the migration status, it also needs
to query spice and check if its migration has completed.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hmp.c            |    2 ++
 qapi-schema.json |    5 ++++-
 ui/spice-core.c  |    4 ++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/hmp.c b/hmp.c
index 81c8acb..ec4274b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -413,6 +413,8 @@ void hmp_info_spice(Monitor *mon)
         monitor_printf(mon, "     address: %s:%" PRId64 " [tls]\n",
                        info->host, info->tls_port);
     }
+    monitor_printf(mon, "    migrated: %s\n",
+                   info->migrated ? "true" : "false");
     monitor_printf(mon, "        auth: %s\n", info->auth);
     monitor_printf(mon, "    compiled: %s\n", info->compiled_version);
     monitor_printf(mon, "  mouse-mode: %s\n",
diff --git a/qapi-schema.json b/qapi-schema.json
index bd8ad74..8ddde12 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -808,6 +808,9 @@
 #
 # @enabled: true if the SPICE server is enabled, false otherwise
 #
+# @migrated: true if the last guest migration completed and spice
+#            migration had completed as well. false otherwise.
+#
 # @host: #optional The hostname the SPICE server is bound to.  This depends on
 #        the name resolution on the host and may be an IP address.
 #
@@ -833,7 +836,7 @@
 # Since: 0.14.0
 ##
 { 'type': 'SpiceInfo',
-  'data': {'enabled': 'bool', '*host': 'str', '*port': 'int',
+  'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',
            '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
            'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} }
 
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 851e869..ab069c5 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -46,6 +46,7 @@ static Notifier migration_state;
 static const char *auth = "spice";
 static char *auth_passwd;
 static time_t auth_expires = TIME_MAX;
+static int spice_migration_completed;
 int using_spice = 0;
 
 static QemuThread me;
@@ -310,6 +311,7 @@ static void migrate_connect_complete_cb(SpiceMigrateInstance *sin)
 static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
 {
     monitor_protocol_event(QEVENT_SPICE_MIGRATE_COMPLETED, NULL);
+    spice_migration_completed = true;
 }
 #endif
 
@@ -443,6 +445,7 @@ SpiceInfo *qmp_query_spice(Error **errp)
     }
 
     info->enabled = true;
+    info->migrated = spice_migration_completed;
 
     addr = qemu_opt_get(opts, "addr");
     port = qemu_opt_get_number(opts, "port", 0);
@@ -496,6 +499,7 @@ static void migration_state_notifier(Notifier *notifier, void *data)
 #ifndef SPICE_INTERFACE_MIGRATION
         spice_server_migrate_switch(spice_server);
         monitor_protocol_event(QEVENT_SPICE_MIGRATE_COMPLETED, NULL);
+        spice_migration_completed = true;
 #else
         spice_server_migrate_end(spice_server, true);
     } else if (migration_has_failed(s)) {
-- 
1.7.1

  parent reply	other threads:[~2012-09-06  7:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06  7:21 [Qemu-devel] [PULL 00/14] spice patch queue Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 01/14] spice: abort on invalid streaming cmdline params Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 02/14] spice: notify spice server on vm start/stop Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 03/14] spice: notify on vm state change only via spice_server_vm_start/stop Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 04/14] spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED Gerd Hoffmann
2012-09-06  7:21 ` Gerd Hoffmann [this message]
2012-09-06  7:21 ` [Qemu-devel] [PATCH 06/14] spice: adding seamless-migration option to the command line Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 07/14] spice: increase the verbosity of spice section in "qemu --help" Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 08/14] qxl/update_area_io: guest_bug on invalid parameters Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 09/14] qxl: disallow unknown revisions Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 10/14] qxl: add QXL_IO_MONITORS_CONFIG_ASYNC Gerd Hoffmann
2012-09-28  9:51   ` Paolo Bonzini
2012-10-07  9:35     ` Alon Levy
2012-10-08 13:16       ` Paolo Bonzini
2012-09-06  7:21 ` [Qemu-devel] [PATCH 11/14] configure: print spice-protocol and spice-server versions Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 12/14] spice: make number of surfaces runtime-configurable Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 13/14] qxl: Add set_client_capabilities() interface to QXLInterface Gerd Hoffmann
2012-09-06  7:21 ` [Qemu-devel] [PATCH 14/14] Remove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP Gerd Hoffmann
2012-09-10 13:33 ` [Qemu-devel] [PULL 00/14] spice patch queue Aurelien Jarno

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=1346916100-12958-6-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.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 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.