[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/27] migration: Add blocker information
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 14/27] migration: Add blocker information |
Date: |
Thu, 4 Feb 2021 16:39:46 +0000 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Modify query-migrate so that it has a flag indicating if outbound
migration is blocked, and if it is a list of reasons.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210202135522.127380-2-dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 25 +++++++++++++++++++++++--
migration/savevm.c | 13 +++++++++++++
migration/savevm.h | 1 +
qapi/migration.json | 6 ++++++
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 38efaeee94..a5ddf43559 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -174,6 +174,8 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot,
static MigrationState *current_migration;
static MigrationIncomingState *current_incoming;
+static GSList *migration_blockers;
+
static bool migration_object_check(MigrationState *ms, Error **errp);
static int migration_maybe_pause(MigrationState *s,
int *current_active_state,
@@ -1074,6 +1076,27 @@ static void fill_source_migration_info(MigrationInfo
*info)
{
MigrationState *s = migrate_get_current();
+ info->blocked = migration_is_blocked(NULL);
+ info->has_blocked_reasons = info->blocked;
+ info->blocked_reasons = NULL;
+ if (info->blocked) {
+ GSList *cur_blocker = migration_blockers;
+
+ /*
+ * There are two types of reasons a migration might be blocked;
+ * a) devices marked in VMState as non-migratable, and
+ * b) Explicit migration blockers
+ * We need to add both of them here.
+ */
+ qemu_savevm_non_migratable_list(&info->blocked_reasons);
+
+ while (cur_blocker) {
+ QAPI_LIST_PREPEND(info->blocked_reasons,
+ g_strdup(error_get_pretty(cur_blocker->data)));
+ cur_blocker = g_slist_next(cur_blocker);
+ }
+ }
+
switch (s->state) {
case MIGRATION_STATUS_NONE:
/* no migration has happened ever */
@@ -2025,8 +2048,6 @@ void migrate_init(MigrationState *s)
s->threshold_size = 0;
}
-static GSList *migration_blockers;
-
int migrate_add_blocker(Error *reason, Error **errp)
{
if (only_migratable) {
diff --git a/migration/savevm.c b/migration/savevm.c
index d5bf53388f..1178c6ca90 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1154,6 +1154,19 @@ bool qemu_savevm_state_blocked(Error **errp)
return false;
}
+void qemu_savevm_non_migratable_list(strList **reasons)
+{
+ SaveStateEntry *se;
+
+ QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
+ if (se->vmsd && se->vmsd->unmigratable) {
+ QAPI_LIST_PREPEND(*reasons,
+ g_strdup_printf("non-migratable device: %s",
+ se->idstr));
+ }
+ }
+}
+
void qemu_savevm_state_header(QEMUFile *f)
{
trace_savevm_state_header();
diff --git a/migration/savevm.h b/migration/savevm.h
index aaee2528ed..6461342cb4 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -30,6 +30,7 @@
#define QEMU_VM_SECTION_FOOTER 0x7e
bool qemu_savevm_state_blocked(Error **errp);
+void qemu_savevm_non_migratable_list(strList **reasons);
void qemu_savevm_state_setup(QEMUFile *f);
bool qemu_savevm_state_guest_unplug_pending(void);
int qemu_savevm_state_resume_prepare(MigrationState *s);
diff --git a/qapi/migration.json b/qapi/migration.json
index 797f9edbc2..076d2d5634 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -224,6 +224,10 @@
# only returned if VFIO device is present, migration is supported by all
# VFIO devices and status is 'active' or 'completed' (since 5.2)
#
+# @blocked: True if outgoing migration is blocked (since 6.0)
+#
+# @blocked-reasons: A list of reasons an outgoing migration is blocked (since
6.0)
+#
# Since: 0.14
##
{ 'struct': 'MigrationInfo',
@@ -237,6 +241,8 @@
'*setup-time': 'int',
'*cpu-throttle-percentage': 'int',
'*error-desc': 'str',
+ 'blocked': 'bool',
+ '*blocked-reasons': ['str'],
'*postcopy-blocktime' : 'uint32',
'*postcopy-vcpu-blocktime': ['uint32'],
'*compression': 'CompressionStats',
--
2.29.2
- [PULL 03/27] vmstate: Fix memory leak in vmstate_handle_alloc(), (continued)
- [PULL 03/27] vmstate: Fix memory leak in vmstate_handle_alloc(), Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 05/27] migration: introduce 'background-snapshot' migration capability, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 06/27] migration: introduce UFFD-WP low-level interface helpers, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 07/27] migration: support UFFD write fault processing in ram_save_iterate(), Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 08/27] migration: implementation of background snapshot thread, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 09/27] migration: introduce 'userfaultfd-wrlat.py' script, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 10/27] migration: Fix migrate-set-parameters argument validation, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 11/27] migration: Clean up signed vs. unsigned XBZRLE cache-size, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 12/27] migration: Fix cache_init()'s "Failed to allocate" error messages, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 13/27] migration: Fix a few absurdly defective error messages, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 14/27] migration: Add blocker information,
Dr. David Alan Gilbert (git) <=
- [PULL 15/27] migration: Display the migration blockers, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 16/27] block: push error reporting into bdrv_all_*_snapshot functions, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 17/27] migration: Make save_snapshot() return bool, not 0/-1, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 18/27] migration: stop returning errno from load_snapshot(), Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 19/27] block: add ability to specify list of blockdevs during snapshot, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 20/27] block: allow specifying name of block device for vmstate storage, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 22/27] migration: control whether snapshots are ovewritten, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 23/27] migration: wire up support for snapshot device selection, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 21/27] block: rename and alter bdrv_all_find_snapshot semantics, Dr. David Alan Gilbert (git), 2021/02/04
- [PULL 25/27] iotests: add support for capturing and matching QMP events, Dr. David Alan Gilbert (git), 2021/02/04