aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-04-28 22:49:20 +0300
committerJuan Quintela <quintela@redhat.com>2023-05-10 18:48:11 +0200
commit4332ffcd7b21f7391fef1d916e1e3cd5b4bdd268 (patch)
tree789ce2e5d0a1d3b6448e421d29dd8f60e3eecab2 /migration
parent43c71fe3b846222154a99a02b17818fe54c1edaf (diff)
downloadqemu-4332ffcd7b21f7391fef1d916e1e3cd5b4bdd268.zip
qemu-4332ffcd7b21f7391fef1d916e1e3cd5b4bdd268.tar.gz
qemu-4332ffcd7b21f7391fef1d916e1e3cd5b4bdd268.tar.bz2
colo: make colo_checkpoint_notify static and provide simpler API
colo_checkpoint_notify() is mostly used in colo.c. Outside we use it once when x-checkpoint-delay migration parameter is set. So, let's simplify the external API to only that function - notify COLO that parameter was set. This make external API more robust and hides implementation details from external callers. Also this helps us to make COLO module optional in further patch (i.e. we are going to add possibility not build the COLO module). Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Zhang Chen <chen.zhang@intel.com> Message-Id: <20230428194928.1426370-3-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/colo.c29
-rw-r--r--migration/options.c4
2 files changed, 19 insertions, 14 deletions
diff --git a/migration/colo.c b/migration/colo.c
index 07bfa21..c9e0b90 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -65,6 +65,24 @@ static bool colo_runstate_is_stopped(void)
return runstate_check(RUN_STATE_COLO) || !runstate_is_running();
}
+static void colo_checkpoint_notify(void *opaque)
+{
+ MigrationState *s = opaque;
+ int64_t next_notify_time;
+
+ qemu_event_set(&s->colo_checkpoint_event);
+ s->colo_checkpoint_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
+ next_notify_time = s->colo_checkpoint_time + migrate_checkpoint_delay();
+ timer_mod(s->colo_delay_timer, next_notify_time);
+}
+
+void colo_checkpoint_delay_set(void)
+{
+ if (migration_in_colo_state()) {
+ colo_checkpoint_notify(migrate_get_current());
+ }
+}
+
static void secondary_vm_do_failover(void)
{
/* COLO needs enable block-replication */
@@ -644,17 +662,6 @@ out:
}
}
-void colo_checkpoint_notify(void *opaque)
-{
- MigrationState *s = opaque;
- int64_t next_notify_time;
-
- qemu_event_set(&s->colo_checkpoint_event);
- s->colo_checkpoint_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
- next_notify_time = s->colo_checkpoint_time + migrate_checkpoint_delay();
- timer_mod(s->colo_delay_timer, next_notify_time);
-}
-
void migrate_start_colo_process(MigrationState *s)
{
qemu_mutex_unlock_iothread();
diff --git a/migration/options.c b/migration/options.c
index 2e759cc..9d92b15 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -1253,9 +1253,7 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
if (params->has_x_checkpoint_delay) {
s->parameters.x_checkpoint_delay = params->x_checkpoint_delay;
- if (migration_in_colo_state()) {
- colo_checkpoint_notify(s);
- }
+ colo_checkpoint_delay_set();
}
if (params->has_block_incremental) {