9ae3a8
From b436b4fc9924560ab70e2ab45361de7054ddb052 Mon Sep 17 00:00:00 2001
9ae3a8
From: Nigel Croxon <ncroxon@redhat.com>
9ae3a8
Date: Wed, 31 Jul 2013 15:12:18 +0200
9ae3a8
Subject: Add 'auto-converge' migration capability
9ae3a8
9ae3a8
RH-Author: Nigel Croxon <ncroxon@redhat.com>
9ae3a8
Message-id: <1375283539-18714-3-git-send-email-ncroxon@redhat.com>
9ae3a8
Patchwork-id: 52875
9ae3a8
O-Subject: [RHEL7 PATCH 2/3] Add 'auto-converge' migration capability
9ae3a8
Bugzilla: 985958
9ae3a8
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 985958 - Throttle-down guest to help with live migration convergence (backport to RHEL7.0)
9ae3a8
https://bugzilla.redhat.com/show_bug.cgi?id=985958
9ae3a8
9ae3a8
Backported from the following upstream commit with 1 merge conflict.
9ae3a8
Hand merge qapi-schema.json.
9ae3a8
9ae3a8
commit bde1e2ec2176c363c1783bf8887b6b1beb08dfee
9ae3a8
Author: Chegu Vinod <chegu_vinod@hp.com>
9ae3a8
Date:   Mon Jun 24 03:49:42 2013 -0600
9ae3a8
9ae3a8
    Add 'auto-converge' migration capability
9ae3a8
9ae3a8
    The auto-converge migration capability allows the user to specify if they
9ae3a8
    choose live migration seqeunce to automatically detect and force convergence.
9ae3a8
9ae3a8
    Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>
9ae3a8
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
    Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
    Signed-off-by: Juan Quintela <quintela@redhat.com>
9ae3a8
9ae3a8
diff --git a/include/migration/migration.h b/include/migration/migration.h
9ae3a8
index e2acec6..1fc2666 100644
9ae3a8
--- a/include/migration/migration.h
9ae3a8
+++ b/include/migration/migration.h
9ae3a8
@@ -119,6 +119,8 @@ void migrate_add_blocker(Error *reason);
9ae3a8
  */
9ae3a8
 void migrate_del_blocker(Error *reason);
9ae3a8
 
9ae3a8
+bool migrate_auto_converge(void);
9ae3a8
+
9ae3a8
 int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
9ae3a8
                          uint8_t *dst, int dlen);
9ae3a8
 int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
9ae3a8
diff --git a/migration.c b/migration.c
9ae3a8
index bfbc345..6e29f72 100644
9ae3a8
--- a/migration.c
9ae3a8
+++ b/migration.c
9ae3a8
@@ -474,6 +474,15 @@ void qmp_migrate_set_downtime(double value, Error **errp)
9ae3a8
     max_downtime = (uint64_t)value;
9ae3a8
 }
9ae3a8
 
9ae3a8
+bool migrate_auto_converge(void)
9ae3a8
+{
9ae3a8
+    MigrationState *s;
9ae3a8
+
9ae3a8
+    s = migrate_get_current();
9ae3a8
+
9ae3a8
+    return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
9ae3a8
+}
9ae3a8
+
9ae3a8
 int migrate_use_xbzrle(void)
9ae3a8
 {
9ae3a8
     MigrationState *s;
9ae3a8
diff --git a/qapi-schema.json b/qapi-schema.json
9ae3a8
index 9302e7d..537f1d1 100644
9ae3a8
--- a/qapi-schema.json
9ae3a8
+++ b/qapi-schema.json
9ae3a8
@@ -602,10 +602,13 @@
9ae3a8
 #          This feature allows us to minimize migration traffic for certain work
9ae3a8
 #          loads, by sending compressed difference of the pages
9ae3a8
 #
9ae3a8
+# @auto-converge: If enabled, QEMU will automatically throttle down the guest
9ae3a8
+#          to speed up convergence of RAM migration. (since 1.6)
9ae3a8
+#
9ae3a8
 # Since: 1.2
9ae3a8
 ##
9ae3a8
 { 'enum': 'MigrationCapability',
9ae3a8
-  'data': ['xbzrle'] }
9ae3a8
+  'data': ['xbzrle', 'auto-converge'] }
9ae3a8
 
9ae3a8
 ##
9ae3a8
 # @MigrationCapabilityStatus