From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Tian Kevin <kevin.tian@intel.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com, Juan Quintela <quintela@redhat.com>
Subject: [PATCH RFC 2/4] migration: Introduce migrate_is_precopy()
Date: Tue, 28 Apr 2020 15:42:17 -0400 [thread overview]
Message-ID: <20200428194219.10963-3-peterx@redhat.com> (raw)
In-Reply-To: <20200428194219.10963-1-peterx@redhat.com>
Export a helper globally to check whether we're during a precopy.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/migration/misc.h | 1 +
migration/migration.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index e338be8c30..b4f6bf7842 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -61,6 +61,7 @@ void migration_shutdown(void);
void qemu_start_incoming_migration(const char *uri, Error **errp);
bool migration_is_idle(void);
bool migration_is_active(MigrationState *);
+bool migration_is_precopy(void);
void add_migration_state_change_notifier(Notifier *notify);
void remove_migration_state_change_notifier(Notifier *notify);
bool migration_in_setup(MigrationState *);
diff --git a/migration/migration.c b/migration/migration.c
index 187ac0410c..0082880279 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1795,6 +1795,13 @@ bool migration_is_active(MigrationState *s)
s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
}
+bool migration_is_precopy(void)
+{
+ MigrationState *s = migrate_get_current();
+
+ return s && s->state == MIGRATION_STATUS_ACTIVE;
+}
+
void migrate_init(MigrationState *s)
{
/*
--
2.24.1
next prev parent reply other threads:[~2020-04-28 19:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 19:42 [PATCH RFC 0/4] vl: Sync dirty bitmap when system resets Peter Xu
2020-04-28 19:42 ` [PATCH RFC 1/4] migration: Export migration_bitmap_sync_precopy() Peter Xu
2020-05-06 9:58 ` Dr. David Alan Gilbert
2020-04-28 19:42 ` Peter Xu [this message]
2020-05-06 10:05 ` [PATCH RFC 2/4] migration: Introduce migrate_is_precopy() Dr. David Alan Gilbert
2020-05-06 14:52 ` Peter Xu
2020-04-28 19:42 ` [PATCH RFC 3/4] vl: Sync dirty bits for system resets during precopy Peter Xu
2020-05-06 10:53 ` Dr. David Alan Gilbert
2020-05-06 15:38 ` Peter Xu
2020-04-28 19:42 ` [PATCH RFC 4/4] kvm: No need to sync dirty bitmap before memslot removal any more Peter Xu
2020-04-29 13:26 ` [PATCH RFC 0/4] vl: Sync dirty bitmap when system resets Dr. David Alan Gilbert
2020-04-29 14:32 ` Peter Xu
2020-05-02 21:04 ` Peter Xu
2020-05-23 22:49 ` Peter Xu
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=20200428194219.10963-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kevin.tian@intel.com \
--cc=pbonzini@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).