blob: 770f76d5c7d16925614b061b8b9e4ea99e91fc61 [file] [log] [blame]
Nico Boehrbb8dd242022-12-12 12:17:28 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Migration-related functions
4 *
5 * Copyright IBM Corp. 2022
6 * Author: Nico Boehr <nrb@linux.ibm.com>
7 */
8#include <libcflat.h>
9#include "migrate.h"
10
Nicholas Piggin14ea7bd2024-02-21 13:27:53 +100011/*
12 * Initiate migration and wait for it to complete.
13 */
14void migrate(void)
Nico Boehrbb8dd242022-12-12 12:17:28 +010015{
16 puts("Now migrate the VM, then press a key to continue...\n");
17 (void)getchar();
18 report_info("Migration complete");
19}
20
21/*
Nicholas Piggin71e35162024-02-21 13:27:55 +100022 * Like migrate() but suppress output and logs, useful for intensive
23 * migration stress testing without polluting logs. Test cases should
24 * provide relevant information about migration in failure reports.
25 */
26void migrate_quiet(void)
27{
28 puts("Now migrate the VM (quiet)\n");
29 (void)getchar();
30}
31
32/*
Nico Boehrbb8dd242022-12-12 12:17:28 +010033 * Initiate migration and wait for it to complete.
34 * If this function is called more than once, it is a no-op.
Nico Boehrbb8dd242022-12-12 12:17:28 +010035 */
36void migrate_once(void)
37{
38 static bool migrated;
39
40 if (migrated)
41 return;
Nico Boehrbb8dd242022-12-12 12:17:28 +010042 migrated = true;
Nicholas Pigginfa8914b2024-04-05 18:35:04 +100043
Nico Boehrbb8dd242022-12-12 12:17:28 +010044 migrate();
45}
Nicholas Pigginfa8914b2024-04-05 18:35:04 +100046
47/*
48 * When the test has been started in migration mode, but the test case is
49 * skipped and no migration point is reached, this can be used to tell the
50 * harness not to mark it as a failure to migrate.
51 */
52void migrate_skip(void)
53{
54 static bool did_migrate_skip;
55
56 if (did_migrate_skip)
57 return;
58 did_migrate_skip = true;
59
60 puts("Skipped VM migration (quiet)\n");
61 (void)getchar();
62}
Nicholas Piggin956004a2024-04-05 18:35:06 +100063
64void migrate_begin_continuous(void)
65{
66 puts("Begin continuous migration\n");
67 (void)getchar();
68}
69
70void migrate_end_continuous(void)
71{
72 /*
73 * Migration can split this output between source and dest QEMU
74 * output files, print twice and match once to always cope with
75 * a split.
76 */
77 puts("End continuous migration\n");
78 puts("End continuous migration (quiet)\n");
79 (void)getchar();
80}