[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v0 2/4] migration: add background snapshot capability
From: |
Denis Plotnikov |
Subject: |
[PATCH v0 2/4] migration: add background snapshot capability |
Date: |
Wed, 22 Jul 2020 11:11:31 +0300 |
The capability is used for background snapshot enabling.
The background snapshot logic is going to be added in the following
patch.
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
qapi/migration.json | 7 ++++++-
migration/migration.h | 1 +
migration/migration.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/qapi/migration.json b/qapi/migration.json
index d5000558c6..46681a5c3c 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -424,6 +424,11 @@
# @validate-uuid: Send the UUID of the source to allow the destination
# to ensure it is the same. (since 4.2)
#
+# @background-snapshot: If enabled, the migration stream will be a snapshot
+# of the VM exactly at the point when the migration
+# procedure starts. The VM RAM is saved with running VM.
+# (since 5.2)
+#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
@@ -431,7 +436,7 @@
'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
'block', 'return-path', 'pause-before-switchover', 'multifd',
'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
- 'x-ignore-shared', 'validate-uuid' ] }
+ 'x-ignore-shared', 'validate-uuid', 'background-snapshot' ] }
##
# @MigrationCapabilityStatus:
diff --git a/migration/migration.h b/migration/migration.h
index f617960522..63f2fde9a3 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -322,6 +322,7 @@ int migrate_compress_wait_thread(void);
int migrate_decompress_threads(void);
bool migrate_use_events(void);
bool migrate_postcopy_blocktime(void);
+bool migrate_background_snapshot(void);
/* Sending on the return path - generic and then for each message type */
void migrate_send_rp_shut(MigrationIncomingState *mis,
diff --git a/migration/migration.c b/migration/migration.c
index 2ed9923227..2ec0451abe 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1086,6 +1086,32 @@ static bool migrate_caps_check(bool *cap_list,
error_setg(errp, "Postcopy is not compatible with ignore-shared");
return false;
}
+
+ if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) {
+ error_setg(errp, "Postcopy is not compatible "
+ "with background snapshot");
+ return false;
+ }
+ }
+
+ if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) {
+ if (cap_list[MIGRATION_CAPABILITY_RELEASE_RAM]) {
+ error_setg(errp, "Background snapshot is not compatible "
+ "with release ram capability");
+ return false;
+ }
+
+ if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) {
+ error_setg(errp, "Background snapshot is not "
+ "currently compatible with compression");
+ return false;
+ }
+
+ if (cap_list[MIGRATION_CAPABILITY_XBZRLE]) {
+ error_setg(errp, "Background snapshot is not "
+ "currently compatible with XBZLRE");
+ return false;
+ }
}
return true;
@@ -2390,6 +2416,15 @@ bool migrate_use_block_incremental(void)
return s->parameters.block_incremental;
}
+bool migrate_background_snapshot(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
+}
+
/* migration thread support */
/*
* Something bad happened to the RP stream, mark an error
--
2.17.0