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