From: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Sanidhya Kashyap <sanidhya.iiith@gmail.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH v2 4/8] bitmap dump process with runstates
Date: Wed, 4 Jun 2014 12:08:27 +0530 [thread overview]
Message-ID: <1401863911-5947-5-git-send-email-sanidhya.iiith@gmail.com> (raw)
In-Reply-To: <1401863911-5947-1-git-send-email-sanidhya.iiith@gmail.com>
Introduced both runstates: RUN_STATE_MIGRATE and RUN_STATE_DUMP_BITMAP to
both migration and bitmap dump process.
I want the bitmap dump process to get canceled so whenever the state changes
from RUN_STATE_BITMAP to something else. But, this does not happen when I stop
the guest via stop qmp interface as the current_run_state variable is not updated.
Any thoughts on that? Do I need to make the changes there as well or is there any
simple way to do it?
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
migration.c | 7 +++++++
savevm.c | 26 +++++++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/migration.c b/migration.c
index 3fc03d6..d91dd4c 100644
--- a/migration.c
+++ b/migration.c
@@ -436,6 +436,13 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
return;
}
+ if (runstate_check(RUN_STATE_DUMP_BITMAP)) {
+ error_setg(errp, "bitmap dump in progress");
+ return;
+ }
+
+ runstate_set(RUN_STATE_MIGRATE);
+
s = migrate_init(¶ms);
if (strstart(uri, "tcp:", &p)) {
diff --git a/savevm.c b/savevm.c
index 525b388..675c8e5 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1163,7 +1163,8 @@ static void *bitmap_logging_thread(void *opaque)
* using the FILE pointer f.
*/
while (epoch_count < total_epochs) {
- if (!runstate_is_running() || b->state != LOG_BITMAP_STATE_ACTIVE) {
+ if (!runstate_check(RUN_STATE_DUMP_BITMAP) ||
+ b->state != LOG_BITMAP_STATE_ACTIVE) {
goto log_thread_end;
}
bitmap_zero(logging_bitmap, ram_bitmap_pages);
@@ -1193,6 +1194,7 @@ static void *bitmap_logging_thread(void *opaque)
logging_state_set_status(b, LOG_BITMAP_STATE_ERROR,
LOG_BITMAP_STATE_COMPLETED);
}
+ runstate_set(RUN_STATE_RUNNING);
return NULL;
}
@@ -1203,18 +1205,26 @@ void qmp_log_dirty_bitmap(const char *filename, bool has_epochs,
int fd = -1;
BitmapLogState *b = logging_current_state();
Error *local_err = NULL;
- if (b->state == LOG_BITMAP_STATE_ACTIVE ||
- b->state == LOG_BITMAP_STATE_SETUP ||
- b->state == LOG_BITMAP_STATE_CANCELING) {
+
+ if (runstate_check(RUN_STATE_DUMP_BITMAP) ||
+ b->state == LOG_BITMAP_STATE_ACTIVE ||
+ b->state == LOG_BITMAP_STATE_SETUP ||
+ b->state == LOG_BITMAP_STATE_CANCELING) {
b = NULL;
error_setg(errp, "dirty bitmap dump in progress");
return;
}
- if (b->state == LOG_BITMAP_STATE_COMPLETED) {
- b->state = LOG_BITMAP_STATE_NONE;
+ if (!runstate_is_running()) {
+ b = NULL;
+ error_setg(errp, "Guest is not in a running state");
+ return;
}
+ runstate_set(RUN_STATE_DUMP_BITMAP);
+
+ b->state = LOG_BITMAP_STATE_NONE;
+
if (!has_epochs) {
epochs = MIN_EPOCH_VALUE;
}
@@ -1227,14 +1237,16 @@ void qmp_log_dirty_bitmap(const char *filename, bool has_epochs,
if (local_err) {
b = NULL;
error_propagate(errp, local_err);
+ runstate_set(RUN_STATE_RUNNING);
return;
}
}
fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
if (fd < 0) {
- error_setg_file_open(errp, errno, filename);
b = NULL;
+ error_setg_file_open(errp, errno, filename);
+ runstate_set(RUN_STATE_RUNNING);
return;
}
--
1.8.3.1
next prev parent reply other threads:[~2014-06-04 6:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 6:38 [Qemu-devel] [PATCH v2 0/8] Obtain dirty bitmap via VM logging Sanidhya Kashyap
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 1/8] enable sharing of the function between migration and bitmap dump Sanidhya Kashyap
2014-06-04 10:07 ` Juan Quintela
2014-06-04 10:16 ` Sanidhya Kashyap
2014-06-04 11:29 ` Juan Quintela
2014-06-04 11:43 ` Sanidhya Kashyap
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 2/8] bitmap dump code via QAPI framework Sanidhya Kashyap
2014-06-04 10:12 ` Dr. David Alan Gilbert
2014-06-04 10:18 ` Juan Quintela
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 3/8] RunState: added two new flags for bitmap dump and migration process Sanidhya Kashyap
2014-06-04 10:08 ` Dr. David Alan Gilbert
2014-06-04 6:38 ` Sanidhya Kashyap [this message]
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 5/8] hmp interface for dirty bitmap dump Sanidhya Kashyap
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 6/8] cancel mechanism for an already running dump bitmap process Sanidhya Kashyap
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 7/8] set the frequency of the " Sanidhya Kashyap
2014-06-04 6:38 ` [Qemu-devel] [PATCH v2 8/8] python script for extracting bitmap from a binary file Sanidhya Kashyap
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=1401863911-5947-5-git-send-email-sanidhya.iiith@gmail.com \
--to=sanidhya.iiith@gmail.com \
--cc=dgilbert@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).