qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Fedin <p.fedin@samsung.com>
To: qemu-devel@nongnu.org
Cc: 'Amit Shah' <amit.shah@redhat.com>,
	'Luiz Capitulino' <lcapitulino@redhat.com>,
	'Juan Quintela' <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH] migration: Introduce migration_in_completion()
Date: Tue, 27 Oct 2015 14:01:15 +0300	[thread overview]
Message-ID: <012c01d110a6$cd61cf90$68256eb0$@samsung.com> (raw)

This allows to signal migration notifiers that the migration has entered
final phase. The condition is set after vm_stop_force_state().

This will be necessary for ITS live migration on ARM, which will have to
dump its state into guest RAM at this point.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
 include/migration/migration.h | 2 ++
 migration/migration.c         | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 8334621..51b0ea2 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -69,6 +69,7 @@ struct MigrationState
     int parameters[MIGRATION_PARAMETER_MAX];
 
     int state;
+    bool in_completion;
     MigrationParams params;
     double mbps;
     int64_t total_time;
@@ -117,6 +118,7 @@ int migrate_fd_close(MigrationState *s);
 void add_migration_state_change_notifier(Notifier *notify);
 void remove_migration_state_change_notifier(Notifier *notify);
 bool migration_in_setup(MigrationState *);
+bool migration_in_completion(MigrationState *);
 bool migration_has_finished(MigrationState *);
 bool migration_has_failed(MigrationState *);
 MigrationState *migrate_get_current(void);
diff --git a/migration/migration.c b/migration/migration.c
index b092f38..f4a2421 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -674,6 +674,11 @@ bool migration_in_setup(MigrationState *s)
     return s->state == MIGRATION_STATUS_SETUP;
 }
 
+bool migration_in_completion(MigrationState *s)
+{
+    return s->in_completion;
+}
+
 bool migration_has_finished(MigrationState *s)
 {
     return s->state == MIGRATION_STATUS_COMPLETED;
@@ -996,6 +1001,8 @@ static void migration_completion(MigrationState *s, bool *old_vm_running,
     if (!ret) {
         ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
         if (ret >= 0) {
+            s->in_completion = true;
+            notifier_list_notify(&migration_state_notifiers, s);
             qemu_file_set_rate_limit(s->file, INT64_MAX);
             qemu_savevm_state_complete(s->file);
         }
-- 
1.9.5.msysgit.0

             reply	other threads:[~2015-10-27 11:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 11:01 Pavel Fedin [this message]
2015-10-27 13:41 ` [Qemu-devel] [PATCH] migration: Introduce migration_in_completion() Juan Quintela
2015-10-27 14:03   ` Pavel Fedin
2015-10-28  9:58     ` Juan Quintela
2015-10-28 10:27       ` Pavel Fedin
2015-10-28 11:36       ` Pavel Fedin
2015-10-29 12:20         ` Juan Quintela
2015-10-29 13:36           ` Pavel Fedin
2015-10-29 14:37             ` Juan Quintela

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='012c01d110a6$cd61cf90$68256eb0$@samsung.com' \
    --to=p.fedin@samsung.com \
    --cc=amit.shah@redhat.com \
    --cc=lcapitulino@redhat.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 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).