qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yonit Halperin <yhalperi@redhat.com>
To: qemu-devel@nongnu.org
Cc: mprivozn@redhat.com, Yonit Halperin <yhalperi@redhat.com>,
	kraxel@redhat.com
Subject: [Qemu-devel] [PATCH v3 3/5] spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED
Date: Tue, 21 Aug 2012 11:51:57 +0300	[thread overview]
Message-ID: <1345539119-26196-4-git-send-email-yhalperi@redhat.com> (raw)
In-Reply-To: <1345539119-26196-1-git-send-email-yhalperi@redhat.com>

When migrating, libvirt queries the migration status, and upon migration
completions, it closes the migration src. On the other hand, when
migration is completed, spice transfers data from the src to destination
via the client. This data is required for keeping the spice session
after migration, without suffering from data loss and inconsistencies.
In order to allow this data transfer, we add QEVENT for signaling
libvirt that spice migration has completed, and libvirt needs to wait
for this event before quitting the src process.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
---
 monitor.c       |    1 +
 monitor.h       |    1 +
 ui/spice-core.c |    9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index ce42466..584efe0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -455,6 +455,7 @@ static const char *monitor_event_names[] = {
     [QEVENT_SUSPEND_DISK] = "SUSPEND_DISK",
     [QEVENT_WAKEUP] = "WAKEUP",
     [QEVENT_BALLOON_CHANGE] = "BALLOON_CHANGE",
+    [QEVENT_SPICE_MIGRATE_COMPLETED] = "SPICE_MIGRATE_COMPLETED",
 };
 QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX)
 
diff --git a/monitor.h b/monitor.h
index 47d556b..5fc2983 100644
--- a/monitor.h
+++ b/monitor.h
@@ -43,6 +43,7 @@ typedef enum MonitorEvent {
     QEVENT_SUSPEND_DISK,
     QEVENT_WAKEUP,
     QEVENT_BALLOON_CHANGE,
+    QEVENT_SPICE_MIGRATE_COMPLETED,
 
     /* Add to 'monitor_event_names' array in monitor.c when
      * defining new events here */
diff --git a/ui/spice-core.c b/ui/spice-core.c
index fa78cc3..73f8a95 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -285,6 +285,7 @@ typedef struct SpiceMigration {
 } SpiceMigration;
 
 static void migrate_connect_complete_cb(SpiceMigrateInstance *sin);
+static void migrate_end_complete_cb(SpiceMigrateInstance *sin);
 
 static const SpiceMigrateInterface migrate_interface = {
     .base.type = SPICE_INTERFACE_MIGRATION,
@@ -292,7 +293,7 @@ static const SpiceMigrateInterface migrate_interface = {
     .base.major_version = SPICE_INTERFACE_MIGRATION_MAJOR,
     .base.minor_version = SPICE_INTERFACE_MIGRATION_MINOR,
     .migrate_connect_complete = migrate_connect_complete_cb,
-    .migrate_end_complete = NULL,
+    .migrate_end_complete = migrate_end_complete_cb,
 };
 
 static SpiceMigration spice_migrate;
@@ -305,6 +306,11 @@ static void migrate_connect_complete_cb(SpiceMigrateInstance *sin)
     }
     sm->connect_complete.cb = NULL;
 }
+
+static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
+{
+    monitor_protocol_event(QEVENT_SPICE_MIGRATE_COMPLETED, NULL);
+}
 #endif
 
 /* config string parsing */
@@ -488,6 +494,7 @@ static void migration_state_notifier(Notifier *notifier, void *data)
     } else if (migration_has_finished(s)) {
 #ifndef SPICE_INTERFACE_MIGRATION
         spice_server_migrate_switch(spice_server);
+        monitor_protocol_event(QEVENT_SPICE_MIGRATE_COMPLETED, NULL);
 #else
         spice_server_migrate_end(spice_server, true);
     } else if (migration_has_failed(s)) {
-- 
1.7.7.6

  parent reply	other threads:[~2012-08-21  8:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  8:51 [Qemu-devel] [PATCH v3 0/5] add support for spice migration v3 Yonit Halperin
2012-08-21  8:51 ` [Qemu-devel] [PATCH v3 1/5] spice: notify spice server on vm start/stop Yonit Halperin
2012-08-21  8:51 ` [Qemu-devel] [PATCH v3 2/5] spice: notify on vm state change only via spice_server_vm_start/stop Yonit Halperin
2012-08-21  8:51 ` Yonit Halperin [this message]
2012-08-21 14:09   ` [Qemu-devel] [PATCH v3 3/5] spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED Luiz Capitulino
2012-08-21  8:51 ` [Qemu-devel] [PATCH v3 4/5] spice: add 'migrated' flag to spice info Yonit Halperin
2012-08-21 14:10   ` Luiz Capitulino
2012-08-21  8:51 ` [Qemu-devel] [PATCH v3 5/5] spice: adding seamless-migration option to the command line Yonit Halperin
2012-08-21  9:20 ` [Qemu-devel] [PATCH v3 0/5] add support for spice migration v3 Michal Privoznik
2012-08-21 10:35 ` Gerd Hoffmann

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=1345539119-26196-4-git-send-email-yhalperi@redhat.com \
    --to=yhalperi@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mprivozn@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).