aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2016-06-13 12:16:45 +0100
committerAmit Shah <amit.shah@redhat.com>2016-06-16 09:50:07 +0530
commit096631bd95ac8f873fed9f62c4a57076ffcdb54d (patch)
tree7db34f6be7763d38791ce7fb8570e12a5959081d
parentf5d457917817d7bfd2424bb88314eaf16b5ec9d6 (diff)
Postcopy: Check for support when setting the capability
Knowing whether the destination host supports migration with postcopy can be tricky. The destination doesn't need the capability set, however if we set it then use the opportunity to do the test and tell the user/management layer early. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1465816605-29488-7-git-send-email-dgilbert@redhat.com Message-Id: <1465816605-29488-7-git-send-email-dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--migration/migration.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 7bc406a870..253395c3c2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -720,6 +720,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
{
MigrationState *s = migrate_get_current();
MigrationCapabilityStatusList *cap;
+ bool old_postcopy_cap = migrate_postcopy_ram();
if (migration_is_setup_or_active(s->state)) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
@@ -742,6 +743,19 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] =
false;
}
+ /* This check is reasonably expensive, so only when it's being
+ * set the first time, also it's only the destination that needs
+ * special support.
+ */
+ if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) &&
+ !postcopy_ram_supported_by_host()) {
+ /* postcopy_ram_supported_by_host will have emitted a more
+ * detailed message
+ */
+ error_report("Postcopy is not supported");
+ s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] =
+ false;
+ }
}
}