diff mbox series

[v3,10/33] migration/postcopy: Recognise the recovery states as 'in_postcopy'

Message ID 20190924210106.27117-11-alex.bennee@linaro.org
State New
Headers show
Series testing/next (docker,tcg, alpha ;-) | expand

Commit Message

Alex Bennée Sept. 24, 2019, 9 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>


Various parts of the migration code do different things when they're
in postcopy mode; prior to this patch this has been 'postcopy-active'.
This patch extends 'in_postcopy' to include 'postcopy-paused' and
'postcopy-recover'.

In particular, when you set the max-postcopy-bandwidth parameter, this
only affects the current migration fd if we're 'in_postcopy';
this leads to a race in the postcopy recovery test where it increases
the speed from 4k/sec to unlimited, but that increase can get ignored
if the change is made between the point at which the reconnection
happens and it transitions back to active.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20190923174942.12182-1-dgilbert@redhat.com>
---
 migration/migration.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.20.1
diff mbox series

Patch

diff --git a/migration/migration.c b/migration/migration.c
index 01863a95f5f..5f7e4d15e95 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1659,7 +1659,14 @@  bool migration_in_postcopy(void)
 {
     MigrationState *s = migrate_get_current();
 
-    return (s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
+    switch (s->state) {
+    case MIGRATION_STATUS_POSTCOPY_ACTIVE:
+    case MIGRATION_STATUS_POSTCOPY_PAUSED:
+    case MIGRATION_STATUS_POSTCOPY_RECOVER:
+        return true;
+    default:
+        return false;
+    }
 }
 
 bool migration_in_postcopy_after_devices(MigrationState *s)