Skip to content

Commit

Permalink
COLO: Add checkpoint-delay parameter for migrate-set-parameters
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: Markus Armbruster <[email protected]>
Signed-off-by: zhanghailiang <[email protected]>
Signed-off-by: Li Zhijian <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Amit Shah <[email protected]>
Signed-off-by: Amit Shah <[email protected]>
  • Loading branch information
colo-ft authored and Amit Shah committed Oct 30, 2016
1 parent 4291d37 commit 68b5359
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/qmp-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions hmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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,
},
};

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}


Expand Down
12 changes: 10 additions & 2 deletions qapi-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand All @@ -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
Expand Down

0 comments on commit 68b5359

Please sign in to comment.