[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v18 14/34] COLO: Add checkpoint-delay par
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v18 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters |
Date: |
Wed, 3 Aug 2016 20:25:52 +0800 |
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 <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
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
---
hmp.c | 7 +++++++
migration/migration.c | 18 ++++++++++++++++++
qapi-schema.json | 17 ++++++++++++++---
qmp-commands.hx | 3 ++-
4 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/hmp.c b/hmp.c
index cc2056e..38b4a51 100644
--- a/hmp.c
+++ b/hmp.c
@@ -304,6 +304,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict
*qdict)
monitor_printf(mon, " %s: '%s'",
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
params->tls_hostname ? : "");
+ monitor_printf(mon, " %s: %" PRId64,
+ MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
+ params->x_checkpoint_delay);
monitor_printf(mon, "\n");
}
@@ -1261,6 +1264,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
bool has_tls_creds = false;
bool has_tls_hostname = false;
bool use_int_value = false;
+ bool has_x_checkpoint_delay = false;
int i;
for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
@@ -1284,6 +1288,8 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
break;
case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
has_cpu_throttle_increment = true;
+ case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
+ has_x_checkpoint_delay = true;
break;
case MIGRATION_PARAMETER_TLS_CREDS:
has_tls_creds = true;
@@ -1308,6 +1314,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
*qdict)
has_cpu_throttle_increment, valueint,
has_tls_creds, valuestr,
has_tls_hostname, valuestr,
+ has_x_checkpoint_delay, valueint,
&err);
break;
}
diff --git a/migration/migration.c b/migration/migration.c
index e5f47d0..3358980 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -59,6 +59,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);
@@ -90,6 +95,7 @@ MigrationState *migrate_get_current(void)
.decompress_threads = DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT,
.cpu_throttle_initial = DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL,
.cpu_throttle_increment = DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT,
+ .x_checkpoint_delay = DEFAULT_MIGRATE_X_CHECKPOINT_DELAY,
},
};
@@ -582,6 +588,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error
**errp)
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
params->tls_creds = g_strdup(s->parameters.tls_creds);
params->tls_hostname = g_strdup(s->parameters.tls_hostname);
+ params->x_checkpoint_delay = s->parameters.x_checkpoint_delay;
return params;
}
@@ -801,6 +808,8 @@ void qmp_migrate_set_parameters(bool has_compress_level,
const char *tls_creds,
bool has_tls_hostname,
const char *tls_hostname,
+ bool has_x_checkpoint_delay,
+ int64_t x_checkpoint_delay,
Error **errp)
{
MigrationState *s = migrate_get_current();
@@ -836,6 +845,11 @@ void qmp_migrate_set_parameters(bool has_compress_level,
"cpu_throttle_increment",
"an integer in the range of 1 to 99");
}
+ if (has_x_checkpoint_delay && (x_checkpoint_delay < 0)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "x_checkpoint_delay",
+ "is invalid, it should be positive");
+ }
if (has_compress_level) {
s->parameters.compress_level = compress_level;
@@ -860,6 +874,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
g_free(s->parameters.tls_hostname);
s->parameters.tls_hostname = g_strdup(tls_hostname);
}
+
+ if (has_x_checkpoint_delay) {
+ s->parameters.x_checkpoint_delay = x_checkpoint_delay;
+ }
}
diff --git a/qapi-schema.json b/qapi-schema.json
index 0ff1a63..7c0639d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -646,12 +646,16 @@
# hostname must be provided so that the server's x509
# certificate identity can be validated. (Since 2.7)
#
+# @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'] }
+ 'tls-creds', 'tls-hostname',
+ 'x-checkpoint-delay' ] }
#
# @migrate-set-parameters
@@ -687,6 +691,8 @@
# hostname must be provided so that the server's x509
# certificate identity can be validated. (Since 2.7)
#
+# @x-checkpoint-delay: the delay time between two checkpoints. (Since 2.8)
+#
# Since: 2.4
##
{ 'command': 'migrate-set-parameters',
@@ -696,7 +702,8 @@
'*cpu-throttle-initial': 'int',
'*cpu-throttle-increment': 'int',
'*tls-creds': 'str',
- '*tls-hostname': 'str'} }
+ '*tls-hostname': 'str',
+ '*x-checkpoint-delay': 'int' } }
#
# @MigrationParameters
@@ -730,6 +737,8 @@
# hostname must be provided so that the server's x509
# certificate identity can be validated. (Since 2.7)
#
+# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
+#
# Since: 2.4
##
{ 'struct': 'MigrationParameters',
@@ -739,7 +748,9 @@
'cpu-throttle-initial': 'int',
'cpu-throttle-increment': 'int',
'tls-creds': 'str',
- 'tls-hostname': 'str'} }
+ 'tls-hostname': 'str',
+ 'x-checkpoint-delay': 'int'} }
+
##
# @query-migrate-parameters
#
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 6a470d3..88e3870 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3790,6 +3790,7 @@ Set migration parameters
throttled for auto-converge (json-int)
- "cpu-throttle-increment": set throttle increasing percentage for
auto-converge (json-int)
+- "x-checkpoint-delay": set the delay time for periodic checkpoint (json-int)
Arguments:
@@ -3803,7 +3804,7 @@ EQMP
{
.name = "migrate-set-parameters",
.args_type =
-
"compress-level:i?,compress-threads:i?,decompress-threads:i?,cpu-throttle-initial:i?,cpu-throttle-increment:i?",
+
"compress-level:i?,compress-threads:i?,decompress-threads:i?,cpu-throttle-initial:i?,cpu-throttle-increment:i?,x-checkpoint-delay:i?",
.mhandler.cmd_new = qmp_marshal_migrate_set_parameters,
},
SQMP
--
1.8.3.1
- [Qemu-devel] [PATCH COLO-Frame v18 00/34] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT), zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 08/34] COLO: Add a new RunState RUN_STATE_COLO, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 01/34] configure: Add parameter for configure to enable/disable COLO support, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 07/34] COLO: Implement COLO checkpoint protocol, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 19/34] COLO: Implement failover work for Secondary VM, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 13/34] COLO: Flush PVM's cached RAM into SVM's memory, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 22/34] COLO failover: Don't do failover during loading VM's state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v18 26/34] migration/savevm: Add new helpers to process the different stages of loadvm, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 21/34] COLO failover: Shutdown related socket fd when do failover, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 18/34] COLO: Implement failover work for Primary VM, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 12/34] COLO: Load VMState into buffer before restore it, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 28/34] COLO: Separate the process of saving/loading ram and device state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 10/34] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 24/34] COLO: Update the global runstate after going into colo state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 20/34] qmp event: Add COLO_EXIT event to notify users while exited from COLO, zhanghailiang, 2016/08/03