From 93fbd0314ec060ffaf90169a06d5737fa97ffb25 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert Date: Fri, 20 Oct 2017 10:05:50 +0100 Subject: migration: Add 'pause-before-switchover' capability When 'pause-before-switchover' is enabled, the outgoing migration will pause before invalidating the block devices and serializing the device state. At this point the management layer gets the chance to clean up any device jobs or other device users before the migration completes. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- qapi/migration.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/migration.json b/qapi/migration.json index f8b365e3f5..4960231ba2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -341,6 +341,9 @@ # @return-path: If enabled, migration will use the return path even # for precopy. (since 2.10) # +# @pause-before-switchover: Pause outgoing migration before serialising device +# state and before disabling block IO (since 2.11) +# # @x-multifd: Use more than one fd for migration (since 2.11) # # Since: 1.2 @@ -348,7 +351,7 @@ { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', - 'block', 'return-path', 'x-multifd' ] } + 'block', 'return-path', 'pause-before-switchover', 'x-multifd' ] } ## # @MigrationCapabilityStatus: -- cgit v1.2.3-55-g7522 From 31e060774cf5c3b9945f6f16d6c18d6eae18e4d9 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert Date: Fri, 20 Oct 2017 10:05:51 +0100 Subject: migration: Add 'pre-switchover' and 'device' statuses Add two statuses for use when the 'pause-before-switchover' capability is enabled. 'pre-switchover' is the state that we wait in for management to allow us to continue. 'device' is the state we enter while serialising the devices after management gives us the OK. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 6 ++++++ qapi/migration.json | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/migration/migration.c b/migration/migration.c index c041ec7aed..f15372e007 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -526,6 +526,8 @@ static bool migration_is_setup_or_active(int state) case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_SETUP: + case MIGRATION_STATUS_PRE_SWITCHOVER: + case MIGRATION_STATUS_DEVICE: return true; default: @@ -600,6 +602,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_CANCELLING: case MIGRATION_STATUS_POSTCOPY_ACTIVE: + case MIGRATION_STATUS_PRE_SWITCHOVER: + case MIGRATION_STATUS_DEVICE: /* TODO add some postcopy stats */ info->has_status = true; info->has_total_time = true; @@ -1189,6 +1193,8 @@ bool migration_is_idle(void) case MIGRATION_STATUS_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_COLO: + case MIGRATION_STATUS_PRE_SWITCHOVER: + case MIGRATION_STATUS_DEVICE: return false; case MIGRATION_STATUS__MAX: g_assert_not_reached(); diff --git a/qapi/migration.json b/qapi/migration.json index 4960231ba2..b56f95db64 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -96,12 +96,18 @@ # @colo: VM is in the process of fault tolerance, VM can not get into this # state unless colo capability is enabled for migration. (since 2.8) # +# @pre-switchover: Paused before device serialisation. (since 2.11) +# +# @device: During device serialisation when pause-before-switchover is enabled +# (since 2.11) +# # Since: 2.3 # ## { 'enum': 'MigrationStatus', 'data': [ 'none', 'setup', 'cancelling', 'cancelled', - 'active', 'postcopy-active', 'completed', 'failed', 'colo' ] } + 'active', 'postcopy-active', 'completed', 'failed', 'colo', + 'pre-switchover', 'device' ] } ## # @MigrationInfo: -- cgit v1.2.3-55-g7522 From 89cfc02cb6e3fdaf8ae246493ea51e75be2818c1 Mon Sep 17 00:00:00 2001 From: Dr. David Alan Gilbert Date: Fri, 20 Oct 2017 10:05:53 +0100 Subject: migration: migrate-continue A new qmp command allows the caller to continue from a given paused state. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 11 +++++++++++ qapi/migration.json | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'qapi') diff --git a/migration/migration.c b/migration/migration.c index ef84d2c1fb..90bfdc3a7c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1374,6 +1374,17 @@ void qmp_migrate_cancel(Error **errp) migrate_fd_cancel(migrate_get_current()); } +void qmp_migrate_continue(MigrationStatus state, Error **errp) +{ + MigrationState *s = migrate_get_current(); + if (s->state != state) { + error_setg(errp, "Migration not in expected state: %s", + MigrationStatus_str(s->state)); + return; + } + qemu_sem_post(&s->pause_sem); +} + void qmp_migrate_set_cache_size(int64_t value, Error **errp) { MigrationState *s = migrate_get_current(); diff --git a/qapi/migration.json b/qapi/migration.json index b56f95db64..272f191551 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -876,6 +876,23 @@ ## { 'command': 'migrate_cancel' } +## +# @migrate-continue: +# +# Continue migration when it's in a paused state. +# +# @state: The state the migration is currently expected to be in +# +# Returns: nothing on success +# Since: 2.11 +# Example: +# +# -> { "execute": "migrate-continue" , "arguments": +# { "state": "pre-switchover" } } +# <- { "return": {} } +## +{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} } + ## # @migrate_set_downtime: # -- cgit v1.2.3-55-g7522 From 40a5532f820e26f98d081a49aff9283cd63bd5fa Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Wed, 27 Sep 2017 10:52:11 +0200 Subject: qapi: Fix grammar in x-multifd-page-count descriptions Reported-by: Eric Blake Signed-off-by: Juan Quintela --- qapi/migration.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qapi') diff --git a/qapi/migration.json b/qapi/migration.json index 272f191551..6ae866e1aa 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -480,7 +480,7 @@ # number of sockets used for migration. The # default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread +# @x-multifd-page-count: Number of pages sent together to a thread. # The default value is 16 (since 2.11) # # Since: 2.4 @@ -551,7 +551,7 @@ # number of sockets used for migration. The # default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread +# @x-multifd-page-count: Number of pages sent together to a thread. # The default value is 16 (since 2.11) # # Since: 2.4 @@ -647,7 +647,7 @@ # number of sockets used for migration. # The default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread +# @x-multifd-page-count: Number of pages sent together to a thread. # The default value is 16 (since 2.11) # # Since: 2.4 -- cgit v1.2.3-55-g7522