[PATCH 31/42] migration-test: Preffer to->uri to uri parameter for migration

Juan Quintela posted 42 patches 2 years, 8 months ago
Maintainers: Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Leonardo Bras <leobras@redhat.com>
[PATCH 31/42] migration-test: Preffer to->uri to uri parameter for migration
Posted by Juan Quintela 2 years, 8 months ago
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 tests/qtest/migration-test.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 6438379dcf..0afe871cfb 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -667,12 +667,22 @@ static void migrate_postcopy_start(GuestState *from, GuestState *to)
 
 static void do_migrate(GuestState *from, GuestState *to, const gchar *uri)
 {
-    if (!uri) {
-        g_autofree char *tcp_uri =
-            migrate_get_socket_address(to->qs, "socket-address");
-        migrate_qmp(from->qs, tcp_uri, "{}");
+    if (to->uri) {
+        if (strncmp(to->uri, "tcp:", strlen("tcp:")) == 0) {
+            g_autofree char *tcp_uri =
+                migrate_get_socket_address(to->qs, "socket-address");
+            migrate_qmp(from->qs, tcp_uri, "{}");
+        } else {
+            migrate_qmp(from->qs, to->uri, "{}");
+        }
     } else {
-        migrate_qmp(from->qs, uri, "{}");
+        if (!uri) {
+            g_autofree char *tcp_uri =
+                migrate_get_socket_address(to->qs, "socket-address");
+            migrate_qmp(from->qs, tcp_uri, "{}");
+        } else {
+            migrate_qmp(from->qs, uri, "{}");
+        }
     }
 }
 
-- 
2.40.1