diff options
author | Peter Xu <peterx@redhat.com> | 2017-07-18 11:39:05 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-07-18 17:36:22 +0200 |
commit | 476c72aa918d583a5c9c105bf764f0bec650fbc9 (patch) | |
tree | 63ddf2ffbe101e3d2de45f1578c267fa1e481001 /migration | |
parent | 16d063bc2a8baeb5466bc5b0fa9b0dbb59b3b08b (diff) |
migration: provide migrate_params_apply()
Abstracted from qmp_migrate_set_parameters().
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1500349150-13240-6-git-send-email-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/migration/migration.c b/migration/migration.c index 02d6987b5c..13d9f007f2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -717,38 +717,40 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp) return true; } -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +static void migrate_params_apply(MigrationParameters *params) { MigrationState *s = migrate_get_current(); - if (!migrate_params_check(params, errp)) { - /* Invalid parameter */ - return; - } - if (params->has_compress_level) { s->parameters.compress_level = params->compress_level; } + if (params->has_compress_threads) { s->parameters.compress_threads = params->compress_threads; } + if (params->has_decompress_threads) { s->parameters.decompress_threads = params->decompress_threads; } + if (params->has_cpu_throttle_initial) { s->parameters.cpu_throttle_initial = params->cpu_throttle_initial; } + if (params->has_cpu_throttle_increment) { s->parameters.cpu_throttle_increment = params->cpu_throttle_increment; } + if (params->has_tls_creds) { g_free(s->parameters.tls_creds); s->parameters.tls_creds = g_strdup(params->tls_creds); } + if (params->has_tls_hostname) { g_free(s->parameters.tls_hostname); s->parameters.tls_hostname = g_strdup(params->tls_hostname); } + if (params->has_max_bandwidth) { s->parameters.max_bandwidth = params->max_bandwidth; if (s->to_dst_file) { @@ -756,6 +758,7 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) s->parameters.max_bandwidth / XFER_LIMIT_RATIO); } } + if (params->has_downtime_limit) { s->parameters.downtime_limit = params->downtime_limit; } @@ -766,11 +769,22 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) colo_checkpoint_notify(s); } } + if (params->has_block_incremental) { s->parameters.block_incremental = params->block_incremental; } } +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +{ + if (!migrate_params_check(params, errp)) { + /* Invalid parameter */ + return; + } + + migrate_params_apply(params); +} + void qmp_migrate_start_postcopy(Error **errp) { |