All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com
Cc: aarcange@redhat.com, den@openvz.org, marcel.a@redhat.com
Subject: [Qemu-devel] [PATCH v4 6/6] Postcopy: Check for support when setting the capability
Date: Tue, 17 May 2016 13:55:55 +0100	[thread overview]
Message-ID: <1463489755-30703-7-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1463489755-30703-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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>
---
 migration/migration.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 9d41618..9e4ba8c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -675,6 +675,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);
@@ -697,6 +698,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;
+        }
     }
 }
 
-- 
2.5.5

      parent reply	other threads:[~2016-05-17 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 12:55 [Qemu-devel] [PATCH v4 0/6] postcopy (& 1 test) patch for 2.7 Dr. David Alan Gilbert (git)
2016-05-17 12:55 ` [Qemu-devel] [PATCH v4 1/6] Postcopy: Avoid 0 length discards Dr. David Alan Gilbert (git)
2016-05-17 12:55 ` [Qemu-devel] [PATCH v4 2/6] Migration: Split out ram part of qmp_query_migrate Dr. David Alan Gilbert (git)
2016-05-23  7:02   ` Amit Shah
2016-05-31 16:10     ` Dr. David Alan Gilbert
2016-06-01  3:48       ` Amit Shah
2016-05-17 12:55 ` [Qemu-devel] [PATCH v4 3/6] Postcopy: Add stats on page requests Dr. David Alan Gilbert (git)
2016-05-17 12:55 ` [Qemu-devel] [PATCH v4 4/6] test: Postcopy Dr. David Alan Gilbert (git)
2016-05-17 12:55 ` [Qemu-devel] [PATCH v4 5/6] tests: fix libqtest socket timeouts Dr. David Alan Gilbert (git)
2016-05-17 12:55 ` Dr. David Alan Gilbert (git) [this message]

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=1463489755-30703-7-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=den@openvz.org \
    --cc=marcel.a@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.