From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] migration: store globalstate in pre_safe
Date: Fri, 10 Jul 2015 14:58:26 +0200 [thread overview]
Message-ID: <1436533106-17011-3-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1436533106-17011-1-git-send-email-quintela@redhat.com>
We use global state in both savevm & migration. The easiest way is to
put the setup in a single place.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index ba82ff6..d1421fe 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -110,17 +110,6 @@ typedef struct {
static GlobalState global_state;
-static int global_state_store(void)
-{
- if (!runstate_store((char *)global_state.runstate,
- sizeof(global_state.runstate))) {
- error_report("runstate name too big: %s", global_state.runstate);
- trace_migrate_state_too_big();
- return -EINVAL;
- }
- return 0;
-}
-
static bool global_state_received(void)
{
return global_state.received;
@@ -187,6 +176,14 @@ static void global_state_pre_save(void *opaque)
GlobalState *s = opaque;
trace_migrate_global_state_pre_save((char *)s->runstate);
+
+ if (!runstate_store((char *)global_state.runstate,
+ sizeof(global_state.runstate))) {
+ error_report("runstate name too big: %s", global_state.runstate);
+ trace_migrate_state_too_big();
+ exit(EXIT_FAILURE);
+ }
+
s->size = strlen((char *)s->runstate) + 1;
}
@@ -940,13 +937,10 @@ static void *migration_thread(void *opaque)
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
old_vm_running = runstate_is_running();
- ret = global_state_store();
- if (!ret) {
- ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
- if (ret >= 0) {
- qemu_file_set_rate_limit(s->file, INT64_MAX);
- qemu_savevm_state_complete(s->file);
- }
+ ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
+ if (ret >= 0) {
+ qemu_file_set_rate_limit(s->file, INT64_MAX);
+ qemu_savevm_state_complete(s->file);
}
qemu_mutex_unlock_iothread();
--
2.4.3
next prev parent reply other threads:[~2015-07-10 12:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 12:58 [Qemu-devel] [PATCH 0/2] Fix global state with savevm Juan Quintela
2015-07-10 12:58 ` [Qemu-devel] [PATCH 1/2] migration: Register global state section before loadvm Juan Quintela
2015-07-10 12:58 ` Juan Quintela [this message]
2015-07-10 14:29 ` [Qemu-devel] [PATCH 2/2] migration: store globalstate in pre_safe Dr. David Alan Gilbert
2015-07-13 8:06 ` Juan Quintela
2015-07-10 13:21 ` [Qemu-devel] [PATCH 0/2] Fix global state with savevm Christian Borntraeger
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=1436533106-17011-3-git-send-email-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=amit.shah@redhat.com \
--cc=dgilbert@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).