qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: quintela@redhat.com, amit.shah@redhat.com
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, wency@cn.fujitsu.com,
	lizhijian@cn.fujitsu.com, xiecl.fnst@cn.fujitsu.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH COLO-Frame (Base) v23 10/18] COLO: Add checkpoint-delay parameter for migrate-set-parameters
Date: Thu, 27 Oct 2016 14:43:01 +0800	[thread overview]
Message-ID: <1477550589-16288-11-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1477550589-16288-1-git-send-email-zhang.zhanghailiang@huawei.com>

Add checkpoint-delay parameter for migrate-set-parameters, so that
we can control the checkpoint frequency when COLO is in periodic mode.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
---
v23:
- Add Reviewed-by tag
v22:
- Add Reviewed-by tag
v21:
- Rebase to master
v12:
- Change checkpoint-delay to x-checkpoint-delay (Dave's suggestion)
- Add Reviewed-by tag
v11:
- Move this patch ahead of the patch where uses 'checkpoint_delay'
 (Dave's suggestion)
v10:
- Fix related qmp command
---
 docs/qmp-commands.txt |  2 ++
 hmp.c                 |  8 ++++++++
 migration/migration.c | 16 ++++++++++++++++
 qapi-schema.json      | 12 ++++++++++--
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/docs/qmp-commands.txt b/docs/qmp-commands.txt
index 9bdbbfe..2e42929 100644
--- a/docs/qmp-commands.txt
+++ b/docs/qmp-commands.txt
@@ -2916,6 +2916,8 @@ Set migration parameters
 - "max-bandwidth": set maximum speed for migrations (in bytes/sec) (json-int)
 - "downtime-limit": set maximum tolerated downtime (in milliseconds) for
                     migrations (json-int)
+- "x-checkpoint-delay": set the delay time for periodic checkpoint (json-int)
+
 Arguments:
 
 Example:
diff --git a/hmp.c b/hmp.c
index 3d60259..f2b831a 100644
--- a/hmp.c
+++ b/hmp.c
@@ -318,6 +318,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, " %s: %" PRId64 " milliseconds",
             MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
             params->downtime_limit);
+        monitor_printf(mon, " %s: %" PRId64,
+            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
+            params->x_checkpoint_delay);
         monitor_printf(mon, "\n");
     }
 
@@ -1386,6 +1389,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
                 p.has_downtime_limit = true;
                 use_int_value = true;
                 break;
+            case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
+                p.has_x_checkpoint_delay = true;
+                use_int_value = true;
+                break;
             }
 
             if (use_int_value) {
@@ -1402,6 +1409,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
                 p.cpu_throttle_initial = valueint;
                 p.cpu_throttle_increment = valueint;
                 p.downtime_limit = valueint;
+                p.x_checkpoint_delay = valueint;
             }
 
             qmp_migrate_set_parameters(&p, &err);
diff --git a/migration/migration.c b/migration/migration.c
index 13ea7e9..c44e129 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -63,6 +63,11 @@
 /* Migration XBZRLE default cache size */
 #define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
 
+/* The delay time (in ms) between two COLO checkpoints
+ * Note: Please change this default value to 10000 when we support hybrid mode.
+ */
+#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY 200
+
 static NotifierList migration_state_notifiers =
     NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
 
@@ -95,6 +100,7 @@ MigrationState *migrate_get_current(void)
             .cpu_throttle_increment = DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT,
             .max_bandwidth = MAX_THROTTLE,
             .downtime_limit = DEFAULT_MIGRATE_SET_DOWNTIME,
+            .x_checkpoint_delay = DEFAULT_MIGRATE_X_CHECKPOINT_DELAY,
         },
     };
 
@@ -587,6 +593,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
     params->max_bandwidth = s->parameters.max_bandwidth;
     params->has_downtime_limit = true;
     params->downtime_limit = s->parameters.downtime_limit;
+    params->x_checkpoint_delay = s->parameters.x_checkpoint_delay;
 
     return params;
 }
@@ -845,6 +852,11 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
                    "an integer in the range of 0 to 2000000 milliseconds");
         return;
     }
+    if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+                    "x_checkpoint_delay",
+                    "is invalid, it should be positive");
+    }
 
     if (params->has_compress_level) {
         s->parameters.compress_level = params->compress_level;
@@ -879,6 +891,10 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
     if (params->has_downtime_limit) {
         s->parameters.downtime_limit = params->downtime_limit;
     }
+
+    if (params->has_x_checkpoint_delay) {
+        s->parameters.x_checkpoint_delay = params->x_checkpoint_delay;
+    }
 }
 
 
diff --git a/qapi-schema.json b/qapi-schema.json
index ee58fe6..05fed9a 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -674,19 +674,24 @@
 # @downtime-limit: set maximum tolerated downtime for migration. maximum
 #                  downtime in milliseconds (Since 2.8)
 #
+# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
+#          periodic mode. (Since 2.8)
+#
 # Since: 2.4
 ##
 { 'enum': 'MigrationParameter',
   'data': ['compress-level', 'compress-threads', 'decompress-threads',
            'cpu-throttle-initial', 'cpu-throttle-increment',
            'tls-creds', 'tls-hostname', 'max-bandwidth',
-           'downtime-limit'] }
+           'downtime-limit', 'x-checkpoint-delay' ] }
 
 #
 # @migrate-set-parameters
 #
 # Set various migration parameters.  See MigrationParameters for details.
 #
+# @x-checkpoint-delay: the delay time between two checkpoints. (Since 2.8)
+#
 # Since: 2.4
 ##
 { 'command': 'migrate-set-parameters', 'boxed': true,
@@ -735,6 +740,8 @@
 # @downtime-limit: set maximum tolerated downtime for migration. maximum
 #                  downtime in milliseconds (Since 2.8)
 #
+# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
+#
 # Since: 2.4
 ##
 { 'struct': 'MigrationParameters',
@@ -746,7 +753,8 @@
             '*tls-creds': 'str',
             '*tls-hostname': 'str',
             '*max-bandwidth': 'int',
-            '*downtime-limit': 'int'} }
+            '*downtime-limit': 'int',
+            '*x-checkpoint-delay': 'int'} }
 
 ##
 # @query-migrate-parameters
-- 
1.8.3.1

  parent reply	other threads:[~2016-10-27  6:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27  6:42 [Qemu-devel] [PATCH COLO-Frame (Base) v23 00/18] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 01/18] migration: Introduce capability 'x-colo' to migration zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 02/18] COLO: migrate COLO related info to secondary node zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 03/18] migration: Enter into COLO mode after migration if COLO is enabled zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 04/18] migration: Switch to COLO process after finishing loadvm zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 05/18] COLO: Establish a new communicating path for COLO zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 06/18] COLO: Introduce checkpointing protocol zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 07/18] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2016-10-27  6:42 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 08/18] COLO: Send PVM state to secondary side when do checkpoint zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 09/18] COLO: Load VMState into QIOChannelBuffer before restore it zhanghailiang
2016-10-27  6:43 ` zhanghailiang [this message]
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 11/18] COLO: Synchronize PVM's state to SVM periodically zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 12/18] COLO: Add 'x-colo-lost-heartbeat' command to trigger failover zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 13/18] COLO: Introduce state to record failover process zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 14/18] COLO: Implement the process of failover for primary VM zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 15/18] COLO: Implement failover work for secondary VM zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 16/18] docs: Add documentation for COLO feature zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 17/18] configure: Support enable/disable " zhanghailiang
2016-10-27  6:43 ` [Qemu-devel] [PATCH COLO-Frame (Base) v23 18/18] MAINTAINERS: Add maintainer for COLO framework related files zhanghailiang
2016-10-27  7:34   ` Amit Shah
2016-10-28  1:42     ` Hailiang Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477550589-16288-11-git-send-email-zhang.zhanghailiang@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).