From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Andrew Jones" <drjones@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com, "Markus Armbruster" <armbru@redhat.com>,
"Leonardo Bras Soares Passos" <lsoaresp@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH v2 2/3] migration: Add migrate_add_blocker_internal()
Date: Thu, 26 Aug 2021 14:58:12 -0400 [thread overview]
Message-ID: <20210826185813.248441-3-peterx@redhat.com> (raw)
In-Reply-To: <20210826185813.248441-1-peterx@redhat.com>
An internal version that removes -only-migratable implications. It can be used
for temporary migration blockers like dump-guest-memory.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/migration/blocker.h | 16 ++++++++++++++++
migration/migration.c | 21 +++++++++++++--------
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/include/migration/blocker.h b/include/migration/blocker.h
index acd27018e9..9cebe2ba06 100644
--- a/include/migration/blocker.h
+++ b/include/migration/blocker.h
@@ -25,6 +25,22 @@
*/
int migrate_add_blocker(Error *reason, Error **errp);
+/**
+ * @migrate_add_blocker_internal - prevent migration from proceeding without
+ * only-migrate implications
+ *
+ * @reason - an error to be returned whenever migration is attempted
+ *
+ * @errp - [out] The reason (if any) we cannot block migration right now.
+ *
+ * @returns - 0 on success, -EBUSY on failure, with errp set.
+ *
+ * Some of the migration blockers can be temporary (e.g., for a few seconds),
+ * so it shouldn't need to conflict with "-only-migratable". For those cases,
+ * we can call this function rather than @migrate_add_blocker().
+ */
+int migrate_add_blocker_internal(Error *reason, Error **errp);
+
/**
* @migrate_del_blocker - remove a blocking error from migration
*
diff --git a/migration/migration.c b/migration/migration.c
index f476e2101e..2aaf2fd449 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2053,15 +2053,8 @@ void migrate_init(MigrationState *s)
s->threshold_size = 0;
}
-int migrate_add_blocker(Error *reason, Error **errp)
+int migrate_add_blocker_internal(Error *reason, Error **errp)
{
- if (only_migratable) {
- error_propagate_prepend(errp, error_copy(reason),
- "disallowing migration blocker "
- "(--only-migratable) for: ");
- return -EACCES;
- }
-
/* Snapshots are similar to migrations, so check RUN_STATE_SAVE_VM too. */
if (runstate_check(RUN_STATE_SAVE_VM) || !migration_is_idle()) {
error_propagate_prepend(errp, error_copy(reason),
@@ -2074,6 +2067,18 @@ int migrate_add_blocker(Error *reason, Error **errp)
return 0;
}
+int migrate_add_blocker(Error *reason, Error **errp)
+{
+ if (only_migratable) {
+ error_propagate_prepend(errp, error_copy(reason),
+ "disallowing migration blocker "
+ "(--only-migratable) for: ");
+ return -EACCES;
+ }
+
+ return migrate_add_blocker_internal(reason, errp);
+}
+
void migrate_del_blocker(Error *reason)
{
migration_blockers = g_slist_remove(migration_blockers, reason);
--
2.31.1
next prev parent reply other threads:[~2021-08-26 19:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 18:58 [PATCH v2 0/3] dump-guest-memory: Add blocker for migration Peter Xu
2021-08-26 18:58 ` [PATCH v2 1/3] migration: Make migration blocker work for snapshots too Peter Xu
2021-09-22 15:05 ` Marc-André Lureau
2021-08-26 18:58 ` Peter Xu [this message]
2021-08-26 18:58 ` [PATCH v2 3/3] dump-guest-memory: Block live migration Peter Xu
2021-08-27 7:44 ` Marc-André Lureau
2021-08-27 7:51 ` Marc-André Lureau
2021-08-27 14:50 ` Peter Xu
2021-09-22 15:18 ` Marc-André Lureau
2021-09-22 16:00 ` Peter Xu
2021-09-22 14:33 ` [PATCH v2 0/3] dump-guest-memory: Add blocker for migration 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=20210826185813.248441-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=drjones@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=marcandre.lureau@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).