data_hook = args->start_hook(from, to);
}
- migrate_incoming_qmp(to, args->listen_uri, NULL, "{}");
+ migrate_incoming_qmp(to, args->uri, NULL, "{}");
migrate_ensure_converge(from);
wait_for_serial("src_serial");
- migrate_qmp(from, to, args->connect_uri, NULL, "{}");
+ migrate_qmp(from, to, NULL, NULL, "{}");
wait_for_migration_status(from, "colo", NULL);
wait_for_resume(to, get_dst());
bool failover_during_checkpoint,
bool primary_failover)
{
- args->listen_uri = "tcp:127.0.0.1:0";
+ args->uri = "tcp:127.0.0.1:0";
test_colo_common(args, failover_during_checkpoint, primary_failover);
}
bool failover_during_checkpoint,
bool primary_failover)
{
- args->listen_uri = "tcp:127.0.0.1:0";
+ args->uri = "tcp:127.0.0.1:0";
args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
test_colo_common(args, failover_during_checkpoint, primary_failover);
}
g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
FILE_TEST_FILENAME);
- args->connect_uri = uri;
+ args->uri = uri;
args->start_hook = migrate_hook_start_mode_reboot;
args->start.mem_type = MEM_TYPE_SHMEM;
{
QTestState *from, *to;
void *data_hook = NULL;
- g_autofree char *connect_uri = g_strdup(args->connect_uri);
+ g_autofree char *connect_uri = g_strdup(args->uri);
g_autofree char *filename = g_strdup_printf("%s/%s", tmpfs,
FILE_TEST_FILENAME);
{
g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
FILE_TEST_FILENAME);
- args->connect_uri = uri;
+ args->uri = uri;
args->start_hook = test_mode_exec_start;
args->start.only_source = true;
{
g_autofree char *uri = g_strdup_printf("file:/dev/fdset/1,offset=%d",
FILE_TEST_OFFSET);
- args->connect_uri = uri;
+ args->uri = uri;
args->start_hook = migrate_hook_start_file_offset_fdset;
test_file_common(args, false);
FILE_TEST_FILENAME,
FILE_TEST_OFFSET);
- args->connect_uri = uri;
+ args->uri = uri;
test_file_common(args, false);
}
g_autofree char *uri = g_strdup_printf("file:%s/%s,offset=0x20M",
tmpfs, FILE_TEST_FILENAME);
- args->connect_uri = uri;
+ args->uri = uri;
args->result = MIG_TEST_QMP_ERROR;
test_file_common(args, false);
g_autofree char *uri = g_strdup_printf("file:/dev/fdset/1,offset=%d",
FILE_TEST_OFFSET);
- args->connect_uri = uri;
+ args->uri = uri;
args->start_hook = migrate_hook_start_multifd_mapped_ram_fdset;
args->end_hook = migrate_hook_end_multifd_mapped_ram_fdset;
{
g_autofree char *uri = g_strdup_printf("file:/dev/fdset/1,offset=%d",
FILE_TEST_OFFSET);
- args->connect_uri = uri;
+ args->uri = uri;
args->start_hook = migrate_hook_start_multifd_mapped_ram_fdset_dio;
args->end_hook = migrate_hook_end_multifd_mapped_ram_fdset;
QTestState *from, *to;
void *data_hook = NULL;
QObject *channels = NULL;
-
- assert(!args->connect_uri);
-
- if (args->listen_uri) {
- args->connect_uri = args->listen_uri;
- } else {
- args->listen_uri = "tcp:127.0.0.1:0";
- }
+ const char *listen_uri = args->uri ?: "tcp:127.0.0.1:0";
if (migrate_start(&from, &to, &args->start)) {
return -1;
data_hook = args->start_hook(from, to);
}
- migrate_incoming_qmp(to, args->listen_uri, NULL, "{}");
+ migrate_incoming_qmp(to, listen_uri, NULL, "{}");
/* Wait for the first serial output from the source */
if (args->result == MIG_TEST_SUCCEED) {
}
if (args->result == MIG_TEST_QMP_ERROR) {
- migrate_qmp_fail(from, args->connect_uri, channels, "{}");
+ migrate_qmp_fail(from, args->uri, channels, "{}");
goto finish;
}
- migrate_qmp(from, to, args->connect_uri, channels, "{}");
+ migrate_qmp(from, to, args->uri, channels, "{}");
if (args->result != MIG_TEST_SUCCEED) {
bool allow_active = args->result == MIG_TEST_FAIL;
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
- args->listen_uri = uri;
+ args->uri = uri;
test_precopy_common(args);
}
return;
}
- if (!args->connect_uri) {
+ if (!args->uri) {
uri = g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME);
- args->connect_uri = uri;
+ args->uri = uri;
}
/*
*/
g_assert_false(args->live);
- if (g_strrstr(args->connect_uri, "offset=")) {
+ if (g_strrstr(args->uri, "offset=")) {
check_offset = true;
/*
* This comes before the start_hook because it's equivalent to
}
if (args->result == MIG_TEST_QMP_ERROR) {
- migrate_qmp_fail(from, args->connect_uri, NULL, "{}");
+ migrate_qmp_fail(from, args->uri, NULL, "{}");
goto finish;
}
- migrate_qmp(from, to, args->connect_uri, NULL, "{}");
+ migrate_qmp(from, to, args->uri, NULL, "{}");
wait_for_migration_complete(from);
/*
* We need to wait for the source to finish before starting the
* destination.
*/
- migrate_incoming_qmp(to, args->connect_uri, NULL, "{}");
+ migrate_incoming_qmp(to, args->uri, NULL, "{}");
wait_for_migration_complete(to);
if (stop_src) {
/* 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.
+ * Optional: the migration URI. If NULL, the common code should
+ * provide a default. For socket migration, the source QEMU may
+ * query the dst QEMU for the listening address and use that as
+ * the connection address. This allows for dynamically picking a
+ * free TCP port.
*/
- const char *connect_uri;
+ const char *uri;
/*
* Optional: JSON-formatted list of src QEMU URIs. If a port is
channels = args->connect_channels ?
qobject_from_json(args->connect_channels, &error_abort) :
NULL;
- migrate_qmp_fail(from, args->connect_uri, channels, "{}");
+ migrate_qmp_fail(from, args->uri, channels, "{}");
migrate_end(from, to, false);
}
static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
{
- args->connect_uri = "tcp:127.0.0.1:0",
+ args->uri = "tcp:127.0.0.1:0",
args->connect_channels = ("[ { ""'channel-type': 'main',"
" 'addr': { 'transport': 'socket',"
" 'type': 'inet',"
**/
g_autofree char *uri = g_strdup_printf("rdma:%s:29200", buffer);
- args->listen_uri = uri;
+ args->uri = uri;
test_precopy_common(args);
}
static void test_precopy_fd_socket(char *name, MigrateCommon *args)
{
- args->listen_uri = "fd:fd-mig";
+ args->uri = "fd:fd-mig";
args->start_hook = migrate_hook_start_fd;
args->end_hook = migrate_hook_end_fd;
args->start.hide_stderr = true;
args->start.use_dirty_ring = true;
- args->connect_uri = uri;
+ args->uri = uri;
/* Start src, dst vm */
if (migrate_start(&from, &to, &args->start)) {
migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_value);
/* Start migrate */
- migrate_incoming_qmp(to, args->connect_uri, NULL, "{}");
- migrate_qmp(from, to, args->connect_uri, NULL, "{}");
+ migrate_incoming_qmp(to, args->uri, NULL, "{}");
+ migrate_qmp(from, to, args->uri, NULL, "{}");
/* Wait for dirty limit throttle begin */
throttle_us_per_full = 0;
/* Assert dirty limit is not in service */
g_assert_cmpint(throttle_us_per_full, ==, 0);
- args->listen_uri = uri;
- args->connect_uri = uri;
+ args->uri = uri;
args->start.only_target = true;
args->start.use_dirty_ring = true;
}
/* Start migrate */
- migrate_incoming_qmp(to, args->listen_uri, NULL, "{}");
- migrate_qmp(from, to, args->connect_uri, NULL, "{}");
+ migrate_incoming_qmp(to, args->uri, NULL, "{}");
+ migrate_qmp(from, to, args->uri, NULL, "{}");
/* Wait for dirty limit throttle begin */
throttle_us_per_full = 0;
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
- args->listen_uri = uri;
+ args->uri = uri;
args->start_hook = migrate_hook_start_tls_x509_default_host;
args->end_hook = migrate_hook_end_tls_x509;
args->result = MIG_TEST_FAIL;