Introduce migration capability localhost.
Signed-off-by: Lei Li <[email protected]>
---
include/migration/migration.h | 3 +++
migration.c | 12 ++++++++++++
qapi-schema.json | 8 +++++++-
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index d2c7eff..a04f050 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -143,10 +143,13 @@ void migrate_add_blocker(Error *reason);
void migrate_del_blocker(Error *reason);
bool migrate_rdma_pin_all(void);
+
bool migrate_zero_blocks(void);
bool migrate_auto_converge(void);
+bool migrate_is_localhost(void);
+
int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
uint8_t *dst, int dlen);
int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
diff --git a/migration.c b/migration.c
index 2446a6a..2f85358 100644
--- a/migration.c
+++ b/migration.c
@@ -420,6 +420,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
} else if (strstart(uri, "exec:", &p)) {
exec_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "unix:", &p)) {
+ if (s->enabled_capabilities[MIGRATION_CAPABILITY_LOCALHOST]) {
+ local_start_outgoing_migration(s, p, &local_err);
+ }
unix_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
@@ -521,6 +524,15 @@ int migrate_use_xbzrle(void)
return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
}
+bool migrate_is_localhost(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->enabled_capabilities[MIGRATION_CAPABILITY_LOCALHOST];
+}
+
int64_t migrate_xbzrle_cache_size(void)
{
MigrationState *s;
diff --git a/qapi-schema.json b/qapi-schema.json
index a51f7d2..557337f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -629,10 +629,16 @@
# @auto-converge: If enabled, QEMU will automatically throttle down the guest
# to speed up convergence of RAM migration. (since 1.6)
#
+# @localhost: If enabled, QEMU will support localhost migration. This feature
+# allows live upgrade of a running QEMU instance by doing localhost
+# migration with page flipping. It requires the source and
destination
+# are both on localhost. Disabled by default. (since 1.7)
+#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
- 'data': ['xbzrle', 'x-rdma-pin-all', 'auto-converge', 'zero-blocks'] }
+ 'data': ['xbzrle', 'x-rdma-pin-all', 'auto-converge', 'zero-blocks',
+ 'localhost'] }
##
# @MigrationCapabilityStatus
--
1.7.7.6