[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/30] tests: Move MigrateCommon upper
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 20/30] tests: Move MigrateCommon upper |
Date: |
Wed, 20 Jul 2022 12:19:16 +0100 |
From: Peter Xu <peterx@redhat.com>
So that it can be used in postcopy tests too soon.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220707185522.27638-1-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tests/qtest/migration-test.c | 144 +++++++++++++++++------------------
1 file changed, 72 insertions(+), 72 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index db4dcc5b31..f3931e0a92 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -503,6 +503,78 @@ typedef struct {
const char *opts_target;
} MigrateStart;
+/*
+ * A hook that runs after the src and dst QEMUs have been
+ * created, but before the migration is started. This can
+ * be used to set migration parameters and capabilities.
+ *
+ * Returns: NULL, or a pointer to opaque state to be
+ * later passed to the TestMigrateFinishHook
+ */
+typedef void * (*TestMigrateStartHook)(QTestState *from,
+ QTestState *to);
+
+/*
+ * A hook that runs after the migration has finished,
+ * regardless of whether it succeeded or failed, but
+ * before QEMU has terminated (unless it self-terminated
+ * due to migration error)
+ *
+ * @opaque is a pointer to state previously returned
+ * by the TestMigrateStartHook if any, or NULL.
+ */
+typedef void (*TestMigrateFinishHook)(QTestState *from,
+ QTestState *to,
+ void *opaque);
+
+typedef struct {
+ /* Optional: fine tune start parameters */
+ MigrateStart start;
+
+ /* Required: the URI for the dst QEMU to listen on */
+ const char *listen_uri;
+
+ /*
+ * Optional: the URI for the src QEMU to connect to
+ * If NULL, then it will query the dst QEMU for its actual
+ * listening address and use that as the connect address.
+ * This allows for dynamically picking a free TCP port.
+ */
+ const char *connect_uri;
+
+ /* Optional: callback to run at start to set migration parameters */
+ TestMigrateStartHook start_hook;
+ /* Optional: callback to run at finish to cleanup */
+ TestMigrateFinishHook finish_hook;
+
+ /*
+ * Optional: normally we expect the migration process to complete.
+ *
+ * There can be a variety of reasons and stages in which failure
+ * can happen during tests.
+ *
+ * If a failure is expected to happen at time of establishing
+ * the connection, then MIG_TEST_FAIL will indicate that the dst
+ * QEMU is expected to stay running and accept future migration
+ * connections.
+ *
+ * If a failure is expected to happen while processing the
+ * migration stream, then MIG_TEST_FAIL_DEST_QUIT_ERR will indicate
+ * that the dst QEMU is expected to quit with non-zero exit status
+ */
+ enum {
+ /* This test should succeed, the default */
+ MIG_TEST_SUCCEED = 0,
+ /* This test should fail, dest qemu should keep alive */
+ MIG_TEST_FAIL,
+ /* This test should fail, dest qemu should fail with abnormal status */
+ MIG_TEST_FAIL_DEST_QUIT_ERR,
+ } result;
+
+ /* Optional: set number of migration passes to wait for */
+ unsigned int iterations;
+} MigrateCommon;
+
static int test_migrate_start(QTestState **from, QTestState **to,
const char *uri, MigrateStart *args)
{
@@ -1120,78 +1192,6 @@ static void test_baddest(void)
test_migrate_end(from, to, false);
}
-/*
- * A hook that runs after the src and dst QEMUs have been
- * created, but before the migration is started. This can
- * be used to set migration parameters and capabilities.
- *
- * Returns: NULL, or a pointer to opaque state to be
- * later passed to the TestMigrateFinishHook
- */
-typedef void * (*TestMigrateStartHook)(QTestState *from,
- QTestState *to);
-
-/*
- * A hook that runs after the migration has finished,
- * regardless of whether it succeeded or failed, but
- * before QEMU has terminated (unless it self-terminated
- * due to migration error)
- *
- * @opaque is a pointer to state previously returned
- * by the TestMigrateStartHook if any, or NULL.
- */
-typedef void (*TestMigrateFinishHook)(QTestState *from,
- QTestState *to,
- void *opaque);
-
-typedef struct {
- /* Optional: fine tune start parameters */
- MigrateStart start;
-
- /* Required: the URI for the dst QEMU to listen on */
- const char *listen_uri;
-
- /*
- * Optional: the URI for the src QEMU to connect to
- * If NULL, then it will query the dst QEMU for its actual
- * listening address and use that as the connect address.
- * This allows for dynamically picking a free TCP port.
- */
- const char *connect_uri;
-
- /* Optional: callback to run at start to set migration parameters */
- TestMigrateStartHook start_hook;
- /* Optional: callback to run at finish to cleanup */
- TestMigrateFinishHook finish_hook;
-
- /*
- * Optional: normally we expect the migration process to complete.
- *
- * There can be a variety of reasons and stages in which failure
- * can happen during tests.
- *
- * If a failure is expected to happen at time of establishing
- * the connection, then MIG_TEST_FAIL will indicate that the dst
- * QEMU is expected to stay running and accept future migration
- * connections.
- *
- * If a failure is expected to happen while processing the
- * migration stream, then MIG_TEST_FAIL_DEST_QUIT_ERR will indicate
- * that the dst QEMU is expected to quit with non-zero exit status
- */
- enum {
- /* This test should succeed, the default */
- MIG_TEST_SUCCEED = 0,
- /* This test should fail, dest qemu should keep alive */
- MIG_TEST_FAIL,
- /* This test should fail, dest qemu should fail with abnormal status */
- MIG_TEST_FAIL_DEST_QUIT_ERR,
- } result;
-
- /* Optional: set number of migration passes to wait for */
- unsigned int iterations;
-} MigrateCommon;
-
static void test_precopy_common(MigrateCommon *args)
{
QTestState *from, *to;
--
2.36.1
- [PULL 07/30] softmmu/dirtylimit: Implement dirty page rate limit, (continued)
- [PULL 07/30] softmmu/dirtylimit: Implement dirty page rate limit, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 12/30] migration: Postcopy preemption enablement, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 14/30] migration: Create the postcopy preempt channel asynchronously, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 11/30] migration: Postcopy preemption preparation on channel creation, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 16/30] migration: Add helpers to detect TLS capability, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 15/30] migration: Add property x-postcopy-preempt-break-huge, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 19/30] migration: Respect postcopy request order in preemption mode, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 22/30] tests: Add postcopy tls recovery migration test, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 18/30] migration: Enable TLS for preempt channel, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 09/30] multifd: Copy pages before compressing them with zlib, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 20/30] tests: Move MigrateCommon upper,
Dr. David Alan Gilbert (git) <=
- [PULL 24/30] migration: remove unreachable code after reading data, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 17/30] migration: Export tls-[creds|hostname|authz] params to cmdline too, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 26/30] Add dirty-sync-missed-zero-copy migration stat, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 21/30] tests: Add postcopy tls migration test, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 23/30] tests: Add postcopy preempt tests, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 30/30] Revert "gitlab: disable accelerated zlib for s390x", Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 27/30] migration/multifd: Report to user when zerocopy not working, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 28/30] multifd: Document the locking of MultiFD{Send/Recv}Params, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 25/30] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 29/30] migration: Avoid false-positive on non-supported scenarios for zero-copy-send, Dr. David Alan Gilbert (git), 2022/07/20