Skip to contentSkip to conversation

Add make check tests for Migration

PATCH Superseded Juan Quintela 2 participants 6 messages May 9, 2018 – Jul 31, 2018

v9 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

v9 cover Add make check tests for Migration

Hi

In v9:
- Dropp Export SocketAddress_to_str
just create the functions where I need them.
- drop precopy test and xbzrle (on pull requset)
Use 100M for cache as dave suggests
- drop ppc improvemnet (on pull request)
- drop RFH, will work on tha later
- move socket_address to info migrate

Please, review

v8:
- just rebase to make things continue to wonk

New in the other v7:
- SocketAddress is now a list (a.k.a make happy danp)
- Rebase on top of upstream
network listener is *interesting*
- *HACK* to make SocketAddress list in common see patch: create-socket-paramenter

Please review, Juan.

[v7]
This is v6, it differest from the patches that I sent with previous multifd post:
- Rename x-tcp-port to x-socket-address
This is more *complicated* that it looks as:

* it is a pointer, so I need to use QAPI_CLONE() to make info migrate work

* this is an union of structs. In QAPI. So, a dict of strings. The only way that I was able to make things work is parsing the qdict to a SocketAddress and then output a SocketAddress as an str. It needs to be an easier way, for sure.

* Cleanups here andthere.

Please, review, Juan.

[v5]
- Several patches moved to pull request
- merge info_migrate and migration_tests
only missing bit is tcp_port, needed for tcp tests
- Rename tcp-port to x-tcp-port
We will get better naming from David at some point, and we will use that bit
- ppc: use inline code as suggested by lvivier

Please, review.

It is based on my previous pull request

Based-on: [email protected]

[v4]
- rebase on top on v4 info_migrate patches
- Tune sleeps to make patches fast
- Create a deprecated test for deprecated commands (i.e. make peterxu happy)
- create migrate_start_postcopy function
- fix naming/sizes between power and x86
- cleanup comments to match code

[v3]

- No more tests for deprecated parameters. Now I only use migrate_set_parameter. If there is a deprecated command for that, we tests it there.
- free "result" string, always good to return memory (Peter found it)
- use the new tcp_port parameter from info migrate. So we are handling well the tcp case.
- lots of code movement around to make everything consistent.
- Several patches already integrated upstream.

[v2]
- to make review easier, I started renaming postcopy-test.c to migration-test.c
- Did cleanups/refactoring there
- Don't use global-qtest anymore
- check that the parameters that we sent got really set
- RFH: comrpress threads tests is not working for some weird reason. Using the same code on command line works. still investigating why.

ToDoo:

- tcp: after discussions with dave, we ended in conclusion that we need to use the 0 port and let the system gives us a free one

But .... that means that we need to be able to get that port back somehow. "info migrate" woring on destination side?

- compression threads. There is some weird interaction with the test hardness and every migration thread get waiting in a different semaphore. Investigating if it is a race/bug/whateverr

- deprecated commands: There was a suggestion to make migrate_set_parameter look at the parameter name and test old/new depending on something. Not sure what to do here.

- testing commands: Is there a way to launch qemu and just sent qmp/hmp commands without having to really run anything else?

[v1]
- add test for precopy for unix/tcp
exec and fd to came, don't know how to test rdma without hardware
- add tests using deprecated interfaces
- add test for xbzrle
Note to myself, there is no way to set the cache size with migraton_set_parameters
- Add test for compress threads
disabled on the series, right now it appears that compression is not working at all
- Move postcopy to use new results
Idea is to move it on top of migration-test.c, but first I want some reviews on basic idea

Juan Quintela (3):
migration: Create socket-address parameter
tests: Add basic migration precopy tcp test
migration: Add multifd test

 hmp.c                  |  31 +++++++++
 migration/migration.c  |  23 +++++++
 migration/migration.h  |   4 ++
 migration/socket.c     |  11 +++
 qapi/migration.json    |   6 +-
 qapi/sockets.json      |  13 ++++
 tests/migration-test.c | 150 ++++++++++++++++++++++++++++++++++++++++-
 7 files changed, 234 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH v9 1/3 migration: Create socket-address parameter

It will be used to store the uri parameters. We want this only for tcp, so we don't set it for other uris. We need it to know what port is migration running.

--

This used to be uri parameter, but it has so many troubles to reproduce that it don't just make sense.

This used to be a port parameter. I was asked to move to SocketAddress, done.
I also merged the setting of the migration tcp port in this one because now I need to free the address, and this makes it easier. This used to be x-socket-address with a single direction, now it is a list of addresses.
Move SocketAddress_to_str here. I used to try to generalize the one in chardev/char-socket.c, but it is not worth it.

---
 hmp.c                 | 31 +++++++++++++++++++++++++++++++
 migration/migration.c | 23 +++++++++++++++++++++++
 migration/migration.h |  4 ++++
 migration/socket.c    | 11 +++++++++++
 qapi/migration.json   |  6 +++++-
 qapi/sockets.json     | 13 +++++++++++++
 6 files changed, 87 insertions(+), 1 deletion(-)
hmp.c +31 -0
index 35a23d8cb8..63e718bd69 100644
@@ -166,6 +166,26 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
     qapi_free_MouseInfoList(mice_list);
 }
 
+static char *SocketAddress_to_str(SocketAddress *addr)
+{
+    switch (addr->type) {
+    case SOCKET_ADDRESS_TYPE_INET:
+        return g_strdup_printf("tcp:%s:%s",
+                               addr->u.inet.host,
+                               addr->u.inet.port);
+        break;
+    case SOCKET_ADDRESS_TYPE_UNIX:
+        return g_strdup_printf("unix:%s",
+                               addr->u.q_unix.path);
+        break;
+    case SOCKET_ADDRESS_TYPE_FD:
+        return g_strdup_printf("fd:%s", addr->u.fd.str);
+        break;
+    default:
+        abort();
+    }
+}
+
 void hmp_info_migrate(Monitor *mon, const QDict *qdict)
 {
     MigrationInfo *info;
@@ -289,6 +309,17 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
         g_free(str);
         visit_free(v);
     }
+    if (info->has_socket_address) {
+        SocketAddressList *addr;
+
+        monitor_printf(mon, "socket address: [\n");
+
+        for (addr = info->socket_address; addr; addr = addr->next) {
+            char *s = SocketAddress_to_str(addr->value);
+            monitor_printf(mon, "\t%s\n", s);
+        }
+        monitor_printf(mon, "]\n");
+    }
     qapi_free_MigrationInfo(info);
     qapi_free_MigrationCapabilityStatusList(caps);
 }
migration/migration.c +23 -0
index 05aec2c905..11d16a80c7 100644
@@ -31,6 +31,8 @@
 #include "migration/vmstate.h"
 #include "block/block.h"
 #include "qapi/error.h"
+#include "qapi/clone-visitor.h"
+#include "qapi/qapi-visit-sockets.h"
 #include "qapi/qapi-commands-migration.h"
 #include "qapi/qapi-events-migration.h"
 #include "qapi/qmp/qerror.h"
@@ -193,6 +195,11 @@ void migration_incoming_state_destroy(void)
     }
 
     qemu_event_reset(&mis->main_thread_load_event);
+
+    if (mis->socket_address) {
+        qapi_free_SocketAddressList(mis->socket_address);
+        mis->socket_address = NULL;
+    }
 }
 
 static void migrate_generate_event(int new_state)
@@ -282,6 +289,17 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis, const char *rbname,
     return migrate_send_rp_message(mis, msg_type, msglen, bufc);
 }
 
+void migrate_add_address(SocketAddress *address)
+{
+    MigrationIncomingState *mis = migration_incoming_get_current();
+    SocketAddressList *addrs;
+
+    addrs = g_new0(SocketAddressList, 1);
+    addrs->next = mis->socket_address;
+    mis->socket_address = addrs;
+    addrs->value = QAPI_CLONE(SocketAddress, address);
+}
+
 void qemu_start_incoming_migration(const char *uri, Error **errp)
 {
     const char *p;
@@ -843,6 +861,11 @@ static void fill_destination_migration_info(MigrationInfo *info)
 {
     MigrationIncomingState *mis = migration_incoming_get_current();
 
+    if (mis->socket_address) {
+        info->has_socket_address = true;
+        info->socket_address =  QAPI_CLONE(SocketAddressList, mis->socket_address);
+    }
+
     switch (mis->state) {
     case MIGRATION_STATUS_NONE:
         return;
migration/migration.h +4 -0
index 8f0c82159b..16c26600e2 100644
@@ -80,6 +80,9 @@ struct MigrationIncomingState {
     bool postcopy_recover_triggered;
     QemuSemaphore postcopy_pause_sem_dst;
     QemuSemaphore postcopy_pause_sem_fault;
+
+    /* List of listening socket addresses  */
+    SocketAddressList *socket_address;
 };
 
 MigrationIncomingState *migration_incoming_get_current(void);
@@ -276,5 +279,6 @@ void migrate_send_rp_resume_ack(MigrationIncomingState *mis, uint32_t value);
 
 void dirty_bitmap_mig_before_vm_start(void);
 void init_dirty_bitmap_incoming_migration(void);
+void migrate_add_address(SocketAddress *address);
 
 #endif
migration/socket.c +11 -0
index 3456eb76e9..0eb9b53f81 100644
@@ -15,6 +15,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 
 #include "qemu-common.h"
 #include "qemu/error-report.h"
@@ -182,6 +183,7 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
                                             Error **errp)
 {
     QIONetListener *listener = qio_net_listener_new();
+    size_t i;
 
     qio_net_listener_set_name(listener, "migration-socket-listener");
 
@@ -194,6 +196,15 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
                                           socket_accept_incoming_migration,
                                           NULL, NULL,
                                           g_main_context_get_thread_default());
+
+    for (i = 0; i < listener->nsioc; i++)  {
+        SocketAddress *address =
+            qio_channel_socket_get_local_address(listener->sioc[i], errp);
+        if (!address) {
+            return;
+        }
+        migrate_add_address(address);
+    }
 }
 
 void tcp_start_incoming_migration(const char *host_port, Error **errp)
qapi/migration.json +5 -1
index 66c6b38f88..9085007ff8 100644
@@ -6,6 +6,7 @@
 ##
 
 { 'include': 'common.json' }
+{ 'include': 'sockets.json' }
 
 ##
 # @MigrationStats:
@@ -169,6 +170,7 @@
 #           only present when the postcopy-blocktime migration capability
 #           is enabled. (Since 2.13)
 #
+# @socket-address: Only used for tcp, to know what the real port is (Since 2.13)
 #
 # Since: 0.14.0
 ##
@@ -183,7 +185,8 @@
            '*cpu-throttle-percentage': 'int',
            '*error-desc': 'str',
            '*postcopy-blocktime' : 'uint32',
-           '*postcopy-vcpu-blocktime': ['uint32']} }
+           '*postcopy-vcpu-blocktime': ['uint32'],
+           '*socket-address': ['SocketAddress'] } }
 
 ##
 # @query-migrate:
@@ -690,6 +693,7 @@
 #                     needs to be a multiple of the target page size
 #                     and a power of 2
 #                     (Since 2.11)
+#
 # Since: 2.4
 ##
 { 'struct': 'MigrationParameters',
qapi/sockets.json +13 -0
index fc81d8d5e8..f1ca09a927 100644
@@ -152,3 +152,16 @@
             'unix': 'UnixSocketAddress',
             'vsock': 'VsockSocketAddress',
             'fd': 'String' } }
+
+##
+# @DummyStruct:
+#
+# Both block-core and migration needs SocketAddressList
+# I am open to comments about how to share it
+#
+# @dummy-list: A dummy list
+#
+# Since: 2.13
+##
+{ 'struct': 'DummyStruct',
+  'data': { 'dummy-list': ['SocketAddress'] } }
Signature · 1 line
2.17.0
#2 lore raw

Re: [Qemu-devel] [PATCH v9 1/3] migration: Create socket-address parameter

Quoted 19 lines · Juan Quintela

It will be used to store the uri parameters. We want this only for tcp, so we don't set it for other uris. We need it to know what port is migration running.

--

+++ b/qapi/migration.json

qapi/migration.json +1 -0
@@ -6,6 +6,7 @@
  ##
 
  { 'include': 'common.json' }
+{ 'include': 'sockets.json' }
 
  ##
  # @MigrationStats:

qapi/migration.json line 173

Quoted 4 lines
qapi/migration.json +1 -0
@@ -169,6 +170,7 @@
  #           only present when the postcopy-blocktime migration capability
  #           is enabled. (Since 2.13)
  #
+# @socket-address: Only used for tcp, to know what the real port is (Since 2.13)

Maybe s/real port is/real ports are/, since...

qapi/migration.json line 189

Quoted 10 lines
qapi/migration.json +2 -1
  #
  # Since: 0.14.0
  ##
@@ -183,7 +185,8 @@
             '*cpu-throttle-percentage': 'int',
             '*error-desc': 'str',
             '*postcopy-blocktime' : 'uint32',
-           '*postcopy-vcpu-blocktime': ['uint32']} }
+           '*postcopy-vcpu-blocktime': ['uint32'],
+           '*socket-address': ['SocketAddress'] } }

...an array is potentially plural.

qapi/migration.json line 699

Quoted 11 lines
qapi/migration.json +1 -0
  ##
  # @query-migrate:
@@ -690,6 +693,7 @@
  #                     needs to be a multiple of the target page size
  #                     and a power of 2
  #                     (Since 2.11)
+#
  # Since: 2.4
  ##
  { 'struct': 'MigrationParameters',

Spurious hunk? Although it looks reasonable, it could be a separate trivial cleanup patch.

qapi/sockets.json line 159

Quoted 13 lines
qapi/sockets.json +5 -0
index fc81d8d5e8..f1ca09a927 100644
@@ -152,3 +152,16 @@
              'unix': 'UnixSocketAddress',
              'vsock': 'VsockSocketAddress',
              'fd': 'String' } }
+
+##
+# @DummyStruct:
+#
+# Both block-core and migration needs SocketAddressList

s/needs/need/

qapi/sockets.json line 160

Quoted 1 line
qapi/sockets.json +1 -0
+# I am open to comments about how to share it

Since this is two sentences, trailing '.' would help.

qapi/sockets.json line 167

Quoted 8 lines
qapi/sockets.json +7 -0
+#
+# @dummy-list: A dummy list
+#
+# Since: 2.13
+##
+{ 'struct': 'DummyStruct',
+  'data': { 'dummy-list': ['SocketAddress'] } }

We've used this idiom elsewhere; it might be better to amend DummyForceArrays in qapi/misc.json, except then misc.json might need to include sockets.json for the definition of SocketAddress.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw

Re: [Qemu-devel] [PATCH v9 1/3] migration: Create socket-address parameter

Quoted 6 lines · Eric Blake
Quoted 6 lines

+++ b/qapi/migration.json

qapi/migration.json +1 -0
@@ -6,6 +6,7 @@
  ##
    { 'include': 'common.json' }
+{ 'include': 'sockets.json' }
    ##
Quoted 8 lines

qapi/migration.json line 173

Quoted 6 lines
qapi/migration.json +1 -0
  # @MigrationStats:
@@ -169,6 +170,7 @@
  #           only present when the postcopy-blocktime migration capability
  #           is enabled. (Since 2.13)
  #
+# @socket-address: Only used for tcp, to know what the real port is (Since 2.13)

Maybe s/real port is/real ports are/, since...

done.

Quoted 13 lines

qapi/migration.json line 189

Quoted 11 lines
qapi/migration.json +2 -1
  #
  # Since: 0.14.0
  ##
@@ -183,7 +185,8 @@
             '*cpu-throttle-percentage': 'int',
             '*error-desc': 'str',
             '*postcopy-blocktime' : 'uint32',
-           '*postcopy-vcpu-blocktime': ['uint32']} }
+           '*postcopy-vcpu-blocktime': ['uint32'],
+           '*socket-address': ['SocketAddress'] } }

...an array is potentially plural.

done. (didn't like to put so many s's, but ...)

Quoted 5 lines
Quoted 5 lines
qapi/migration.json +0 -0
    ##
  # @query-migrate:
@@ -690,6 +693,7 @@
  #                     needs to be a multiple of the target page size
  #                     and a power of 2
Quoted 8 lines

qapi/migration.json line 699

Quoted 5 lines
qapi/migration.json +1 -0
  #                     (Since 2.11)
+#
  # Since: 2.4
  ##
  { 'struct': 'MigrationParameters',

Spurious hunk? Although it looks reasonable, it could be a separate trivial cleanup patch.

Fixed thanks.

Quoted 16 lines
Quoted 6 lines
qapi/sockets.json +0 -0
index fc81d8d5e8..f1ca09a927 100644

qapi/sockets.json line 159

Quoted 8 lines
qapi/sockets.json +5 -0
@@ -152,3 +152,16 @@
              'unix': 'UnixSocketAddress',
              'vsock': 'VsockSocketAddress',
              'fd': 'String' } }
+
+##
+# @DummyStruct:
+#
+# Both block-core and migration needs SocketAddressList

s/needs/need/

done

Quoted 3 lines

qapi/sockets.json line 160

Quoted 1 line
qapi/sockets.json +1 -0
+# I am open to comments about how to share it

Since this is two sentences, trailing '.' would help.

done

Quoted 4 lines
Quoted 4 lines
qapi/sockets.json +4 -0
+#
+# @dummy-list: A dummy list
+#
+# Since: 2.13
Quoted 8 lines

qapi/sockets.json line 167

Quoted 4 lines
qapi/sockets.json +3 -0
+##
+{ 'struct': 'DummyStruct',
+  'data': { 'dummy-list': ['SocketAddress'] } }

We've used this idiom elsewhere; it might be better to amend DummyForceArrays in qapi/misc.json, except then misc.json might need to include sockets.json for the definition of SocketAddress.

Not done. It needs more qapi magic that puttingthe socket.json include there, so this one stays. Putting it there means including qapi/<vhateve>-misc.h in several places, I think it is easier this way (famous last words).

Later, Juan.

#4 lore raw

PATCH v9 2/3 tests: Add basic migration precopy tcp test

In reply to Juan Quintela

Not sharing code from precopy/unix because we have to read back the tcp parameter.

---
 tests/migration-test.c | 102 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 99 insertions(+), 3 deletions(-)
tests/migration-test.c +99 -3
index 994ba86e3b..27a7c2dbf0 100644
@@ -19,6 +19,9 @@
 #include "qemu/sockets.h"
 #include "chardev/char.h"
 #include "sysemu/sysemu.h"
+#include "qapi/qapi-visit-sockets.h"
+#include "qapi/qobject-input-visitor.h"
+#include "qapi/qobject-output-visitor.h"
 
 const unsigned start_address = 1024 * 1024;
 const unsigned end_address = 100 * 1024 * 1024;
@@ -289,8 +292,51 @@ static void cleanup(const char *filename)
     g_free(path);
 }
 
-static void migrate_check_parameter(QTestState *who, const char *parameter,
-                                    const char *value)
+static char *SocketAddress_to_str(SocketAddress *addr)
+{
+    switch (addr->type) {
+    case SOCKET_ADDRESS_TYPE_INET:
+        return g_strdup_printf("tcp:%s:%s",
+                               addr->u.inet.host,
+                               addr->u.inet.port);
+        break;
+    case SOCKET_ADDRESS_TYPE_UNIX:
+        return g_strdup_printf("unix:%s",
+                               addr->u.q_unix.path);
+        break;
+    case SOCKET_ADDRESS_TYPE_FD:
+        return g_strdup_printf("fd:%s", addr->u.fd.str);
+        break;
+    default:
+        abort();
+    }
+}
+
+static char *migrate_get_socket_address(QTestState *who, const char *parameter)
+{
+    QDict *rsp, *rsp_return;
+    char *result;
+    Error *local_err = NULL;
+    SocketAddressList *addrs;
+    Visitor *iv = NULL;
+    QObject *object;
+
+    rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
+    rsp_return = qdict_get_qdict(rsp, "return");
+    object = qdict_get(rsp_return, parameter);
+
+    iv = qobject_input_visitor_new(object);
+    visit_type_SocketAddressList(iv, NULL, &addrs, &local_err);
+
+    /* we are only using a single address */
+    result = g_strdup_printf("%s", SocketAddress_to_str(addrs->value));
+
+    qapi_free_SocketAddressList(addrs);
+    qobject_unref(rsp);
+    return result;
+}
+
+static char *migrate_get_parameter(QTestState *who, const char *parameter)
 {
     QDict *rsp, *rsp_return;
     char *result;
@@ -299,9 +345,18 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     rsp_return = qdict_get_qdict(rsp, "return");
     result = g_strdup_printf("%" PRId64,
                              qdict_get_try_int(rsp_return,  parameter, -1));
+    qobject_unref(rsp);
+    return result;
+}
+
+static void migrate_check_parameter(QTestState *who, const char *parameter,
+                                    const char *value)
+{
+    char *result;
+
+    result = migrate_get_parameter(who, parameter);
     g_assert_cmpstr(result, ==, value);
     g_free(result);
-    qobject_unref(rsp);
 }
 
 static void migrate_set_parameter(QTestState *who, const char *parameter,
@@ -682,6 +737,46 @@ static void test_xbzrle_unix(void)
     g_free(uri);
 }
 
+static void test_precopy_tcp(void)
+{
+    char *uri;
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false);
+
+    /* We want to pick a speed slow enough that the test completes
+     * quickly, but that it doesn't complete precopy even on a slow
+     * machine, so also set the downtime.
+     */
+    /* 1 ms should make it not converge*/
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s */
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    uri = migrate_get_socket_address(to, "socket-address");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");
+
+    if (!got_stop) {
+        qtest_qmp_eventwait(from, "STOP");
+    }
+    qtest_qmp_eventwait(to, "RESUME");
+
+    wait_for_serial("dest_serial");
+    wait_for_migration_complete(from);
+
+    test_migrate_end(from, to, true);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -705,6 +800,7 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/deprecated", test_deprecated);
     qtest_add_func("/migration/bad_dest", test_baddest);
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
Signature · 1 line
2.17.0
#5 lore raw

PATCH v9 3/3 migration: Add multifd test

In reply to Juan Quintela

We set the x-multifd-page-count and x-multifd-channels.

---
 tests/migration-test.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
tests/migration-test.c +48 -0
index 27a7c2dbf0..dab1f1705f 100644
@@ -777,6 +777,53 @@ static void test_precopy_tcp(void)
     g_free(uri);
 }
 
+static void test_multifd_tcp(void)
+{
+    char *uri;
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false);
+
+    /* We want to pick a speed slow enough that the test completes
+     * quickly, but that it doesn't complete precopy even on a slow
+     * machine, so also set the downtime.
+     */
+    /* 1 ms should make it not converge*/
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s */
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    migrate_set_parameter(from, "x-multifd-channels", "4");
+    migrate_set_parameter(to, "x-multifd-channels", "4");
+
+    migrate_set_parameter(from, "x-multifd-page-count", "64");
+    migrate_set_parameter(to, "x-multifd-page-count", "64");
+
+    migrate_set_capability(from, "x-multifd", "true");
+    migrate_set_capability(to, "x-multifd", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    uri = migrate_get_socket_address(to, "socket-address");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms it should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");
+
+    if (!got_stop) {
+        qtest_qmp_eventwait(from, "STOP");
+    }
+    qtest_qmp_eventwait(to, "RESUME");
+
+    wait_for_serial("dest_serial");
+    wait_for_migration_complete(from);
+
+    test_migrate_end(from, to, true);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -802,6 +849,7 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
     qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
+    qtest_add_func("/migration/multifd/tcp", test_multifd_tcp);
 
     ret = g_test_run();
 
Signature · 1 line
2.17.0