Skip to contentSkip to conversation

Add make check tests for Migration

PATCH Superseded Juan Quintela 5 participants 28 messages Dec 1, 2017 – Jan 5, 2018

v3 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add make check tests for Migration

Hi

This is on top of my info_migrate series.

CHanges:

- 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.

Later, Juan.

[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?

Please review,.

Later, Juan.

[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

Please, review.

Juan.

Juan Quintela (6):
migration: free result string
tests: migration test deprecated commands
tests: Add migration precopy test
tests: Add basic migration precopy tcp test
tests: Add migration xbzrle test
[RFH] tests: Add migration compress threads tests

 tests/migration-test.c | 257 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 247 insertions(+), 10 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH v3 1/6 migration: free result string

---
 tests/migration-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/migration-test.c +2 -1
index be598d3257..799e24ebc6 100644
@@ -358,13 +358,14 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
                                     const char *value)
 {
     QDict *rsp, *rsp_return;
-    const char *result;
+    char *result;
 
     rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");
     rsp_return = qdict_get_qdict(rsp, "return");
     result = g_strdup_printf("%" PRId64,
                              qdict_get_try_int(rsp_return,  parameter, -1));
     g_assert_cmpstr(result, ==, value);
+    g_free(result);
     QDECREF(rsp);
 }
 
Signature · 1 line
2.14.3
Reviewed-by on v3 1/6
#2 lore raw

Re: [Qemu-devel] [PATCH v3 1/6] migration: free result string

Quoted 2 lines · * Juan Quintela ([email protected]) wrote:

(same as Marc-André's)

Quoted 27 lines
---
 tests/migration-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/migration-test.c +2 -1
index be598d3257..799e24ebc6 100644
@@ -358,13 +358,14 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
                                     const char *value)
 {
     QDict *rsp, *rsp_return;
-    const char *result;
+    char *result;
 
     rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");
     rsp_return = qdict_get_qdict(rsp, "return");
     result = g_strdup_printf("%" PRId64,
                              qdict_get_try_int(rsp_return,  parameter, -1));
     g_assert_cmpstr(result, ==, value);
+    g_free(result);
     QDECREF(rsp);
 }
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#3 lore raw

PATCH v3 2/6 tests: migration test deprecated commands

In reply to Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +28 -4
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, parameter, value);
+}
+
 static void migrate_set_capability(QTestState *who, const char *capability,
                                    const char *value)
 {
@@ -530,8 +554,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
Signature · 1 line
2.14.3
#4 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 37 lines · Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +5 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 10 lines
tests/migration-test.c +10 -0
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I'm fine with current approach, but I would really prefer to put them all into a standalone test, by just calling them one by one with some specific numbers and that's all.

(luckily we only have two deprecated commands and limited tests,
otherwise extra commands will be M*N, say "number of deprecated command" * "number of test mirations")

Thanks,

Quoted 28 lines
tests/migration-test.c +13 -2
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, parameter, value);
+}
+
 static void migrate_set_capability(QTestState *who, const char *capability,
                                    const char *value)
 {
@@ -530,8 +554,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
Signature · 1 line
2.14.3
Signature · 1 line
Peter Xu
#5 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 44 lines · Peter Xu
Quoted 43 lines · Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +11 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
Quoted 8 lines

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 4 lines
tests/migration-test.c +4 -0
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I'm fine with current approach, but I would really prefer to put them all into a standalone test, by just calling them one by one with some specific numbers and that's all.

That means another test (at least), and we have, also at least three deprecated comands:
- migrate_set_speed
- migrate_set_downtime
- migrate_set_cache_size

And each test makes things slower. So I *thought* it would we wiser to just check _always_ use the deprecated an the not deprecated one.

Quoted 3 lines

(luckily we only have two deprecated commands and limited tests,
otherwise extra commands will be M*N, say "number of deprecated command" * "number of test mirations")

Each test takes time, so adding tests make everything much slower. Notice that setting a new setting is fast.

This was the way that I understood Dave he wanted.

Later, Juan.

Quoted 31 lines

Thanks,

Quoted 28 lines
tests/migration-test.c +13 -2
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, parameter, value);
+}
+
 static void migrate_set_capability(QTestState *who, const char *capability,
                                    const char *value)
 {
@@ -530,8 +554,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
Signature · 1 line
2.14.3
#6 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 63 lines · Juan Quintela
Quoted 44 lines · Peter Xu
Quoted 43 lines · Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +11 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
Quoted 8 lines

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 4 lines
tests/migration-test.c +4 -0
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I'm fine with current approach, but I would really prefer to put them all into a standalone test, by just calling them one by one with some specific numbers and that's all.

That means another test (at least), and we have, also at least three deprecated comands:
- migrate_set_speed
- migrate_set_downtime
- migrate_set_cache_size

And each test makes things slower. So I *thought* it would we wiser to just check _always_ use the deprecated an the not deprecated one.

Quoted 8 lines
Quoted 3 lines

(luckily we only have two deprecated commands and limited tests,
otherwise extra commands will be M*N, say "number of deprecated command" * "number of test mirations")

Each test takes time, so adding tests make everything much slower. Notice that setting a new setting is fast.

This was the way that I understood Dave he wanted.

Do you mean every test is slow, or just migration tests? Here I mean to only test setting the parameters without doing real migration tests (then query to make sure the settings were taking effect). I assume that should be fast too? Thanks,

Signature · 1 line
Peter Xu
#7 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 68 lines · Peter Xu
Quoted 67 lines · Juan Quintela
Quoted 44 lines · Peter Xu
Quoted 43 lines · Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +11 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
Quoted 8 lines

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 4 lines
tests/migration-test.c +4 -0
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I'm fine with current approach, but I would really prefer to put them all into a standalone test, by just calling them one by one with some specific numbers and that's all.

That means another test (at least), and we have, also at least three deprecated comands:
- migrate_set_speed
- migrate_set_downtime
- migrate_set_cache_size

And each test makes things slower. So I *thought* it would we wiser to just check _always_ use the deprecated an the not deprecated one.

Quoted 3 lines

(luckily we only have two deprecated commands and limited tests,
otherwise extra commands will be M*N, say "number of deprecated command" * "number of test mirations")

Quoted 6 lines
Quoted 4 lines

Each test takes time, so adding tests make everything much slower. Notice that setting a new setting is fast.

This was the way that I understood Dave he wanted.

Do you mean every test is slow, or just migration tests?

Each migration test adds around 2 seconds on my machine. So I decided that it was easier that each time that we check one command, we test the deprecated and non-deprecated versions of the command. Amount of time added to the test is negigible, and we are sure that we always test both functions.

If we ever remove the deprecated method, we can always remove only that part of th etest.

Quoted 4 lines

Here I mean
to only test setting the parameters without doing real migration tests (then query to make sure the settings were taking effect). I assume that should be fast too? Thanks,

We could create a new test for that, but we need to start in on source/destination, I thought it just made things more complicated.

If your preffer that way, please suggest how/what?

Thanks, Juan.

#8 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 91 lines · Juan Quintela
Quoted 68 lines · Peter Xu
Quoted 67 lines · Juan Quintela
Quoted 44 lines · Peter Xu
Quoted 43 lines · Juan Quintela

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +11 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
Quoted 8 lines

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 4 lines
tests/migration-test.c +4 -0
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I'm fine with current approach, but I would really prefer to put them all into a standalone test, by just calling them one by one with some specific numbers and that's all.

That means another test (at least), and we have, also at least three deprecated comands:
- migrate_set_speed
- migrate_set_downtime
- migrate_set_cache_size

And each test makes things slower. So I *thought* it would we wiser to just check _always_ use the deprecated an the not deprecated one.

Quoted 3 lines

(luckily we only have two deprecated commands and limited tests,
otherwise extra commands will be M*N, say "number of deprecated command" * "number of test mirations")

Quoted 6 lines
Quoted 4 lines

Each test takes time, so adding tests make everything much slower. Notice that setting a new setting is fast.

This was the way that I understood Dave he wanted.

Do you mean every test is slow, or just migration tests?

Each migration test adds around 2 seconds on my machine. So I decided that it was easier that each time that we check one command, we test the deprecated and non-deprecated versions of the command. Amount of time added to the test is negigible, and we are sure that we always test both functions.

If we ever remove the deprecated method, we can always remove only that part of th etest.

Quoted 4 lines

Here I mean
to only test setting the parameters without doing real migration tests (then query to make sure the settings were taking effect). I assume that should be fast too? Thanks,

Quoted 4 lines

We could create a new test for that, but we need to start in on source/destination, I thought it just made things more complicated.

If your preffer that way, please suggest how/what?

I mean, an isolated test that only runs a single VM instance rather than two (so no test_migrate_start() at all), but only: qtest_init(), then qmp() to send the deprecated commands, then query to see whether the values are set. That's all. Can that work for us?

Signature · 1 line
Peter Xu
#9 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

In reply to Juan Quintela
Quoted 37 lines · * Juan Quintela ([email protected]) wrote:

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +5 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 10 lines
tests/migration-test.c +10 -0
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I find that odd; you call migrate_set_parameter to set a particular value, but we set them to a different arbitrary value first?

Dave

Quoted 27 lines
tests/migration-test.c +12 -2
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, parameter, value);
+}
+
 static void migrate_set_capability(QTestState *who, const char *capability,
                                    const char *value)
 {
@@ -530,8 +554,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#10 lore raw

Re: [Qemu-devel] [PATCH v3 2/6] tests: migration test deprecated commands

Quoted 35 lines · Dr. David Alan Gilbert
Quoted 34 lines · * Juan Quintela ([email protected]) wrote:

We now test the deprecated commands everytime that we test the new commands. This makes unnecesary to add tests for deprecated commands.

---
 tests/migration-test.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)
tests/migration-test.c +2 -2
index 799e24ebc6..51f49c74e9 100644
@@ -369,7 +369,7 @@ static void migrate_check_parameter(QTestState *who, const char *parameter,
     QDECREF(rsp);
 }
 
-static void migrate_set_downtime(QTestState *who, const double value)
+static void deprecated_set_downtime(QTestState *who, const double value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -388,7 +388,7 @@ static void migrate_set_downtime(QTestState *who, const double value)
     g_free(expected);
 }
 
-static void migrate_set_speed(QTestState *who, const char *value)
+static void deprecated_set_speed(QTestState *who, const char *value)
 {
     QDict *rsp;
     gchar *cmd;
@@ -402,6 +402,30 @@ static void migrate_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
Quoted 16 lines

tests/migration-test.c static void migrate_set_speed(QTestState *who, const char *value) · line 417

Quoted 13 lines
tests/migration-test.c +13 -0
+static void migrate_set_parameter(QTestState *who, const char *parameter,
+                                  const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    if (strcmp(parameter, "downtime-limit") == 0) {
+        deprecated_set_downtime(who, 0.12345);
+    }
+
+    if (strcmp(parameter, "max-bandwidth") == 0) {
+        deprecated_set_speed(who, "12345");
+    }

I find that odd; you call migrate_set_parameter to set a particular value, but we set them to a different arbitrary value first?

If I do:

migrate_deprecated_command(real_value) migrate_non_deprecated_command(real_value)
here the value is already set, so I am not sure that it is working.

This other way, if there is a _deprecated_ command, I set it to a known value, check that it was set correctly, and then set the real value.

Later, Juan.

Quoted 32 lines

Dave

Quoted 27 lines
tests/migration-test.c +12 -2
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+                          "'arguments': { '%s': %s } }",
+                          parameter, value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, parameter, value);
+}
+
 static void migrate_set_capability(QTestState *who, const char *capability,
                                    const char *value)
 {
@@ -530,8 +554,8 @@ static void test_migrate(void)
      * quickly, but that it doesn't complete precopy even on a slow
      * machine, so also set the downtime.
      */
-    migrate_set_speed(from, "100000000");
-    migrate_set_downtime(from, 0.001);
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+    migrate_set_parameter(from, "downtime-limit", "1");
 
     /* Wait for the first serial output from the source */
     wait_for_serial("src_serial");
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#11 lore raw

PATCH v3 3/6 tests: Add migration precopy test

In reply to Juan Quintela
---
 tests/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tests/migration-test.c +42 -2
index 51f49c74e9..3f3f056be6 100644
@@ -539,7 +539,7 @@ static void test_migrate_end(QTestState *from, QTestState *to)
     cleanup("dest_serial");
 }
 
-static void test_migrate(void)
+static void test_postcopy(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
     QTestState *from, *to;
@@ -582,6 +582,45 @@ static void test_migrate(void)
     test_migrate_end(from, to);
 }
 
+static void test_precopy_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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 */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms 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);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -601,7 +640,8 @@ int main(int argc, char **argv)
 
     module_call_init(MODULE_INIT_QOM);
 
-    qtest_add_func("/migration/postcopy/unix", test_migrate);
+    qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3
Reviewed-by on v3 3/6
#12 lore raw

Re: [Qemu-devel] [PATCH v3 3/6] tests: Add migration precopy test

Quoted 1 line · * Juan Quintela ([email protected]) wrote:

OK, although you seem to have chosen a bandwidth 10x what I use in the postcopy test but for the same reason.

Quoted 76 lines
---
 tests/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tests/migration-test.c +42 -2
index 51f49c74e9..3f3f056be6 100644
@@ -539,7 +539,7 @@ static void test_migrate_end(QTestState *from, QTestState *to)
     cleanup("dest_serial");
 }
 
-static void test_migrate(void)
+static void test_postcopy(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
     QTestState *from, *to;
@@ -582,6 +582,45 @@ static void test_migrate(void)
     test_migrate_end(from, to);
 }
 
+static void test_precopy_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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 */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms 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);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -601,7 +640,8 @@ int main(int argc, char **argv)
 
     module_call_init(MODULE_INIT_QOM);
 
-    qtest_add_func("/migration/postcopy/unix", test_migrate);
+    qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#13 lore raw

Re: [Qemu-devel] [PATCH v3 3/6] tests: Add migration precopy test

Quoted 5 lines · Dr. David Alan Gilbert
Quoted 1 line · * Juan Quintela ([email protected]) wrote:

OK, although you seem to have chosen a bandwidth 10x what I use in the postcopy test but for the same reason.

I tried to make it as fast as possible while making sure that we wait
enough time. In my home machine each test takes around 2-3 seconds,
and I want to add tests, so better that they are fast.

Later, Juan.

Quoted 1 line

Thanks, Juan.

Quoted 79 lines
Quoted 77 lines
---
 tests/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
tests/migration-test.c +42 -2
index 51f49c74e9..3f3f056be6 100644
@@ -539,7 +539,7 @@ static void test_migrate_end(QTestState *from, QTestState *to)
     cleanup("dest_serial");
 }
 
-static void test_migrate(void)
+static void test_postcopy(void)
 {
     char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
     QTestState *from, *to;
@@ -582,6 +582,45 @@ static void test_migrate(void)
     test_migrate_end(from, to);
 }
 
+static void test_precopy_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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 */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms 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);
+    g_free(uri);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -601,7 +640,8 @@ int main(int argc, char **argv)
 
     module_call_init(MODULE_INIT_QOM);
 
-    qtest_add_func("/migration/postcopy/unix", test_migrate);
+    qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#14 lore raw

PATCH v3 4/6 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 | 59 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 56 insertions(+), 3 deletions(-)
tests/migration-test.c +56 -3
index 3f3f056be6..841c89e28a 100644
@@ -354,8 +354,7 @@ static void cleanup(const char *filename)
     g_free(path);
 }
 
-static void migrate_check_parameter(QTestState *who, const char *parameter,
-                                    const char *value)
+static char *migrate_get_parameter(QTestState *who, const char *parameter)
 {
     QDict *rsp, *rsp_return;
     char *result;
@@ -364,9 +363,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));
+    QDECREF(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);
-    QDECREF(rsp);
 }
 
 static void deprecated_set_downtime(QTestState *who, const double value)
@@ -621,6 +629,50 @@ static void test_precopy_unix(void)
     g_free(uri);
 }
 
+static void test_precopy_tcp(void)
+{
+    char *uri;
+    char *port;
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, "tcp:127.0.0.1:0");
+
+    /* 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 */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    port = migrate_get_parameter(to, "tcp-port");
+    uri = g_strdup_printf("tcp:127.0.0.1:%s", port);
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms 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);
+    g_free(uri);
+    g_free(port);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -641,6 +693,7 @@ int main(int argc, char **argv)
     module_call_init(MODULE_INIT_QOM);
 
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
Signature · 1 line
2.14.3
Reviewed-by on v3 4/6
#15 lore raw

Re: [Qemu-devel] [PATCH v3 4/6] tests: Add basic migration precopy tcp test

Quoted 4 lines · * Juan Quintela ([email protected]) wrote:

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

Quoted 100 lines
---
 tests/migration-test.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 56 insertions(+), 3 deletions(-)
tests/migration-test.c +56 -3
index 3f3f056be6..841c89e28a 100644
@@ -354,8 +354,7 @@ static void cleanup(const char *filename)
     g_free(path);
 }
 
-static void migrate_check_parameter(QTestState *who, const char *parameter,
-                                    const char *value)
+static char *migrate_get_parameter(QTestState *who, const char *parameter)
 {
     QDict *rsp, *rsp_return;
     char *result;
@@ -364,9 +363,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));
+    QDECREF(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);
-    QDECREF(rsp);
 }
 
 static void deprecated_set_downtime(QTestState *who, const double value)
@@ -621,6 +629,50 @@ static void test_precopy_unix(void)
     g_free(uri);
 }
 
+static void test_precopy_tcp(void)
+{
+    char *uri;
+    char *port;
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, "tcp:127.0.0.1:0");
+
+    /* 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 */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1GB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    port = migrate_get_parameter(to, "tcp-port");
+    uri = g_strdup_printf("tcp:127.0.0.1:%s", port);
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300 ms 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);
+    g_free(uri);
+    g_free(port);
+}
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -641,6 +693,7 @@ int main(int argc, char **argv)
     module_call_init(MODULE_INIT_QOM);
 
     qtest_add_func("/migration/precopy/unix", test_precopy_unix);
+    qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
 
     ret = g_test_run();
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#16 lore raw

PATCH v3 5/6 tests: Add migration xbzrle test

In reply to Juan Quintela
---
 tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/migration-test.c +68 -0
index 841c89e28a..41dee78a9a 100644
@@ -410,6 +410,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void migrate_set_parameter(QTestState *who, const char *parameter,
                                   const char *value)
 {
@@ -424,6 +438,10 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
         deprecated_set_speed(who, "12345");
     }
 
+    if (strcmp(parameter, "xbzrle-cache-size") == 0) {
+        deprecated_set_cache_size(who, "4096");
+    }
+
     cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
                           "'arguments': { '%s': %s } }",
                           parameter, value);
@@ -673,6 +691,55 @@ static void test_precopy_tcp(void)
     g_free(port);
 }
 
+static void test_xbzrle(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");
+
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");
+
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    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);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -695,6 +762,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/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3
#17 lore raw

Re: [Qemu-devel] [PATCH v3 5/6] tests: Add migration xbzrle test

Quoted 47 lines · * Juan Quintela ([email protected]) wrote:
---
 tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/migration-test.c +20 -0
index 841c89e28a..41dee78a9a 100644
@@ -410,6 +410,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void migrate_set_parameter(QTestState *who, const char *parameter,
                                   const char *value)
 {
@@ -424,6 +438,10 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
         deprecated_set_speed(who, "12345");
     }
 
+    if (strcmp(parameter, "xbzrle-cache-size") == 0) {
+        deprecated_set_cache_size(who, "4096");
+    }
+
     cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
                           "'arguments': { '%s': %s } }",
                           parameter, value);
@@ -673,6 +691,55 @@ static void test_precopy_tcp(void)
     g_free(port);
 }
 
+static void test_xbzrle(const char *uri)
+{

tests/migration-test.c static void test_precopy_tcp(void) · line 705

Quoted 10 lines
tests/migration-test.c +10 -0
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");

? That's 1 ms not 100ms as the comment says?

tests/migration-test.c static void test_precopy_tcp(void) · line 707

Quoted 2 lines
tests/migration-test.c +2 -0
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");

That's still 1GB/s isn't it?
Don't you need to reduce that if xbzrle is actually working otherwise it'll complete?

tests/migration-test.c static void test_precopy_tcp(void) · line 709

Quoted 1 line
tests/migration-test.c +1 -0
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");

That's 32M - why?
The test continually rewrites 100M of data; only changing one byte/page
- so actually the fun way to do the xbzrle test is to leave this as 32M here.....

tests/migration-test.c static void test_precopy_tcp(void) · line 721

Quoted 11 lines
tests/migration-test.c +11 -0
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms it should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");

but first increase the xvzrle cache to 120M and give it a couple of seconds delay; you might even find it completes without the downtime limit schange; but you should still do that after a few seconds. You can check the stats as well, you should get some xbzrle cache hits as long as you raised the cache size.

Dave

Quoted 34 lines
tests/migration-test.c +21 -0
+    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);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -695,6 +762,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/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#18 lore raw

Re: [Qemu-devel] [PATCH v3 5/6] tests: Add migration xbzrle test

Quoted 46 lines · Dr. David Alan Gilbert
Quoted 45 lines · * Juan Quintela ([email protected]) wrote:
---
 tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/migration-test.c +18 -0
index 841c89e28a..41dee78a9a 100644
@@ -410,6 +410,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void migrate_set_parameter(QTestState *who, const char *parameter,
                                   const char *value)
 {
@@ -424,6 +438,10 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
         deprecated_set_speed(who, "12345");
     }
 
+    if (strcmp(parameter, "xbzrle-cache-size") == 0) {
+        deprecated_set_cache_size(who, "4096");
+    }
+
     cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
                           "'arguments': { '%s': %s } }",
                           parameter, value);
@@ -673,6 +691,55 @@ static void test_precopy_tcp(void)
     g_free(port);
 }
 
Quoted 14 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 705

Quoted 12 lines
tests/migration-test.c +12 -0
+static void test_xbzrle(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");

? That's 1 ms not 100ms as the comment says?

You are right, fixed all the comments and forget this one. Fixed.

Quoted 6 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 707

Quoted 2 lines
tests/migration-test.c +2 -0
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");

That's still 1GB/s isn't it?
Don't you need to reduce that if xbzrle is actually working otherwise it'll complete?

I was doing it differently before:

300ms downtime
1MB/s

But this was not reliable to make me wait for it.

So, I changed it to be:

1GB/s (always full speed)
1ms downtime (so it never converge)

and I change the downtime to something higher later.

Quoted 4 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 709

Quoted 2 lines
tests/migration-test.c +1 -0
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");

That's 32M - why?

It is a value smaller than the full amount of memory. I want to test the xbzrle cache size command. I don't care about *which* value we are using, really.

Quoted 13 lines

The test continually rewrites 100M of data; only changing one byte/page
- so actually the fun way to do the xbzrle test is to leave this as 32M here.....

Quoted 9 lines
tests/migration-test.c +9 -0
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
Quoted 8 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 721

Quoted 2 lines
tests/migration-test.c +2 -0
+    /* 300ms it should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");

but first increase the xvzrle cache to 120M and give it a couple of seconds delay; you might even find it completes without the downtime limit schange; but you should still do that after a few seconds. You can check the stats as well, you should get some xbzrle cache hits as long as you raised the cache size.

ok, will think something more about this.

Thanks, Juan.

Quoted 38 lines

Dave

Quoted 34 lines
tests/migration-test.c +21 -0
+    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);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -695,6 +762,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/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#19 lore raw

Re: [Qemu-devel] [PATCH v3 5/6] tests: Add migration xbzrle test

In reply to Dr. David Alan Gilbert
Quoted 46 lines · Dr. David Alan Gilbert
Quoted 45 lines · * Juan Quintela ([email protected]) wrote:
---
 tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/migration-test.c +18 -0
index 841c89e28a..41dee78a9a 100644
@@ -410,6 +410,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void migrate_set_parameter(QTestState *who, const char *parameter,
                                   const char *value)
 {
@@ -424,6 +438,10 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
         deprecated_set_speed(who, "12345");
     }
 
+    if (strcmp(parameter, "xbzrle-cache-size") == 0) {
+        deprecated_set_cache_size(who, "4096");
+    }
+
     cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
                           "'arguments': { '%s': %s } }",
                           parameter, value);
@@ -673,6 +691,55 @@ static void test_precopy_tcp(void)
     g_free(port);
 }
 
Quoted 14 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 705

Quoted 12 lines
tests/migration-test.c +12 -0
+static void test_xbzrle(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");

? That's 1 ms not 100ms as the comment says?

Changed comment.

Quoted 5 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 707

Quoted 3 lines
tests/migration-test.c +2 -0
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");

That's still 1GB/s isn't it?

Changed also.

Quoted 2 lines

Don't you need to reduce that if xbzrle is actually working otherwise it'll complete?

It don't complete on my setup (dunno with a faster machine).

Quoted 3 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 709

Quoted 1 line
tests/migration-test.c +1 -0
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");

That's 32M - why?

I need to check that the command is running, no clue about _which_ one is better here.

Quoted 3 lines

The test continually rewrites 100M of data; only changing one byte/page
- so actually the fun way to do the xbzrle test is to leave this as 32M here.....

My idea here is that we somke test all the transports/commands. Not that I fully test everything.

See on my next series, It already takes around 15 seconds, just adding stuff will make things go longer really fast.

BTW, is there a trivial way to convince qtest/getestr whatevre to run all the migration tests in parallel?

Later, Juan.

Quoted 56 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 721

Quoted 11 lines
tests/migration-test.c +11 -0
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms it should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");

but first increase the xvzrle cache to 120M and give it a couple of seconds delay; you might even find it completes without the downtime limit schange; but you should still do that after a few seconds. You can check the stats as well, you should get some xbzrle cache hits as long as you raised the cache size.

Dave

Quoted 34 lines
tests/migration-test.c +21 -0
+    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);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -695,6 +762,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/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#20 lore raw

Re: [Qemu-devel] [PATCH v3 5/6] tests: Add migration xbzrle test

Quoted 84 lines · * Juan Quintela ([email protected]) wrote:
Quoted 46 lines · Dr. David Alan Gilbert
Quoted 45 lines · * Juan Quintela ([email protected]) wrote:
---
 tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
tests/migration-test.c +18 -0
index 841c89e28a..41dee78a9a 100644
@@ -410,6 +410,20 @@ static void deprecated_set_speed(QTestState *who, const char *value)
     migrate_check_parameter(who, "max-bandwidth", value);
 }
 
+static void deprecated_set_cache_size(QTestState *who, const char *value)
+{
+    QDict *rsp;
+    gchar *cmd;
+
+    cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size',"
+                          "'arguments': { 'value': %s } }", value);
+    rsp = qtest_qmp(who, cmd);
+    g_free(cmd);
+    g_assert(qdict_haskey(rsp, "return"));
+    QDECREF(rsp);
+    migrate_check_parameter(who, "xbzrle-cache-size", value);
+}
+
 static void migrate_set_parameter(QTestState *who, const char *parameter,
                                   const char *value)
 {
@@ -424,6 +438,10 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
         deprecated_set_speed(who, "12345");
     }
 
+    if (strcmp(parameter, "xbzrle-cache-size") == 0) {
+        deprecated_set_cache_size(who, "4096");
+    }
+
     cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
                           "'arguments': { '%s': %s } }",
                           parameter, value);
@@ -673,6 +691,55 @@ static void test_precopy_tcp(void)
     g_free(port);
 }
 
Quoted 14 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 705

Quoted 12 lines
tests/migration-test.c +12 -0
+static void test_xbzrle(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");

? That's 1 ms not 100ms as the comment says?

Changed comment.

Quoted 5 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 707

Quoted 3 lines
tests/migration-test.c +2 -0
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "1000000000");

That's still 1GB/s isn't it?

Changed also.

Quoted 2 lines

Don't you need to reduce that if xbzrle is actually working otherwise it'll complete?

It don't complete on my setup (dunno with a faster machine).

Quoted 3 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 709

Quoted 1 line
tests/migration-test.c +1 -0
+    migrate_set_parameter(from, "xbzrle-cache-size", "33554432");

That's 32M - why?

I need to check that the command is running, no clue about _which_ one is better here.

Quoted 6 lines
Quoted 3 lines

The test continually rewrites 100M of data; only changing one byte/page
- so actually the fun way to do the xbzrle test is to leave this as 32M here.....

My idea here is that we somke test all the transports/commands. Not that I fully test everything.

OK, but if you set the cache size to 150M instead of 32M then xbzrle should actually kick in and be tested; at 32M very little is being tested.

Quoted 5 lines

See on my next series, It already takes around 15 seconds, just adding stuff will make things go longer really fast.

BTW, is there a trivial way to convince qtest/getestr whatevre to run all the migration tests in parallel?

Not that I know of.

Dave

Quoted 60 lines

Later, Juan.

Quoted 56 lines

tests/migration-test.c static void test_precopy_tcp(void) · line 721

Quoted 11 lines
tests/migration-test.c +11 -0
+    migrate_set_capability(from, "xbzrle", "true");
+    migrate_set_capability(to, "xbzrle", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    migrate(from, uri);
+
+    wait_for_migration_pass(from);
+
+    /* 300ms it should converge */
+    migrate_set_parameter(from, "downtime-limit", "300");

but first increase the xvzrle cache to 120M and give it a couple of seconds delay; you might even find it completes without the downtime limit schange; but you should still do that after a few seconds. You can check the stats as well, you should get some xbzrle cache hits as long as you raised the cache size.

Dave

Quoted 34 lines
tests/migration-test.c +21 -0
+    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);
+}
+
+static void test_xbzrle_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_xbzrle(uri);
+    g_free(uri);
+}
+
+
 int main(int argc, char **argv)
 {
     char template[] = "/tmp/migration-test-XXXXXX";
@@ -695,6 +762,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/postcopy/unix", test_postcopy);
+    qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#21 lore raw

PATCH v3 6/6 tests: Add migration compress threads tests

In reply to Juan Quintela

Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness.

For some reason, compression is not working at the moment, test is disabled until I found why.

---
 tests/migration-test.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
tests/migration-test.c +51 -0
index 41dee78a9a..eab3b146a4 100644
@@ -739,6 +739,54 @@ static void test_xbzrle_unix(void)
     g_free(uri);
 }
 
+static void test_compress(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+
+    migrate_set_parameter(from, "compress-threads", "4");
+    migrate_set_parameter(to, "decompress-threads", "3");
+
+    migrate_set_capability(from, "compress", "true");
+    migrate_set_capability(to, "compress", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    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);
+}
+
+static void test_compress_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_compress(uri);
+    g_free(uri);
+}
 
 int main(int argc, char **argv)
 {
@@ -763,6 +811,9 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
     qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
+    if (0) {
+        qtest_add_func("/migration/compress/unix", test_compress_unix);
+    }
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3
#22 lore raw

Re: [Qemu-devel] [PATCH v3 6/6] [RFH] tests: Add migration compress threads tests

Quoted 5 lines · * Juan Quintela ([email protected]) wrote:

Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness.

For some reason, compression is not working at the moment, test is disabled until I found why.

How does it fail?

Dave

Quoted 77 lines
---
 tests/migration-test.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
tests/migration-test.c +51 -0
index 41dee78a9a..eab3b146a4 100644
@@ -739,6 +739,54 @@ static void test_xbzrle_unix(void)
     g_free(uri);
 }
 
+static void test_compress(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+
+    migrate_set_parameter(from, "compress-threads", "4");
+    migrate_set_parameter(to, "decompress-threads", "3");
+
+    migrate_set_capability(from, "compress", "true");
+    migrate_set_capability(to, "compress", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    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);
+}
+
+static void test_compress_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_compress(uri);
+    g_free(uri);
+}
 
 int main(int argc, char **argv)
 {
@@ -763,6 +811,9 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
     qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
+    if (0) {
+        qtest_add_func("/migration/compress/unix", test_compress_unix);
+    }
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#23 lore raw

Re: [Qemu-devel] [PATCH v3 6/6] [RFH] tests: Add migration compress threads tests

Quoted 8 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Juan Quintela ([email protected]) wrote:

Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness.

For some reason, compression is not working at the moment, test is disabled until I found why.

How does it fail?

Source and destination hang. Running exactly the same commands without the test harnness work as expected.

attaching gdb show that every thread is waiting, but haven't found anything obvious. Happens in both sides, so I am not sure really which one is not working (or if both are broken).

Later, Juan.

Quoted 82 lines

Dave

Quoted 77 lines
---
 tests/migration-test.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
tests/migration-test.c +51 -0
index 41dee78a9a..eab3b146a4 100644
@@ -739,6 +739,54 @@ static void test_xbzrle_unix(void)
     g_free(uri);
 }
 
+static void test_compress(const char *uri)
+{
+    QTestState *from, *to;
+
+    test_migrate_start(&from, &to, uri);
+
+    /* 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.
+     */
+    /* 100 ms */
+    migrate_set_parameter(from, "downtime-limit", "1");
+    /* 1MB/s slow*/
+    migrate_set_parameter(from, "max-bandwidth", "100000000");
+
+    migrate_set_parameter(from, "compress-threads", "4");
+    migrate_set_parameter(to, "decompress-threads", "3");
+
+    migrate_set_capability(from, "compress", "true");
+    migrate_set_capability(to, "compress", "true");
+    /* Wait for the first serial output from the source */
+    wait_for_serial("src_serial");
+
+    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);
+}
+
+static void test_compress_unix(void)
+{
+    char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+
+    test_compress(uri);
+    g_free(uri);
+}
 
 int main(int argc, char **argv)
 {
@@ -763,6 +811,9 @@ int main(int argc, char **argv)
     qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
     qtest_add_func("/migration/postcopy/unix", test_postcopy);
     qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix);
+    if (0) {
+        qtest_add_func("/migration/compress/unix", test_compress_unix);
+    }
 
     ret = g_test_run();
 
Signature · 1 line
2.14.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#24 lore raw
In reply to Juan Quintela
Quoted 3 lines · Juan Quintela

Hi

This is on top of my info_migrate series.

Let patchew know about it:

Based-on: <[email protected]> ([PATCH v3 0/2] Improve info migrate output on destination)

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

Hi

This is on top of my info_migrate series.

Let patchew know about it:

Based-on: <[email protected]> ([PATCH v3 0/2] Improve info migrate output on destination)

Is this tag documented somewhere?

Thanks,
Laurent

#26 lore raw
Quoted 4 lines · Laurent Vivier
Quoted 3 lines · Eric Blake
Quoted 2 lines · Juan Quintela

Hi

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

This is on top of my info_migrate series.

Let patchew know about it:

Based-on: <[email protected]> ([PATCH v3 0/2] Improve info migrate output on destination)

Is this tag documented somewhere?

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg01288.html

But yes, it should also be documented in the wiki and/or other places where we document patch submission guidelines.

Volunteers?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#27 lore raw
Quoted 15 lines · Eric Blake
Quoted 4 lines · Laurent Vivier
Quoted 3 lines · Eric Blake
Quoted 2 lines · Juan Quintela

Hi

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

This is on top of my info_migrate series.

Let patchew know about it:

Based-on: <[email protected]> ([PATCH v3 0/2] Improve info migrate output on destination)

Is this tag documented somewhere?

Quoted 6 lines

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg01288.html

But yes, it should also be documented in the wiki and/or other places where we document patch submission guidelines.

Volunteers?

I've updated https://wiki.qemu.org/Contribute/SubmitAPatch to mention patchew and the Based-on tag line, but there may still be other places worth updating.

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