Skip to contentSkip to conversation

Add acceptance test for migration

PATCH In review Balamuruhan S 3 participants 11 messages Sep 16, 2019 – Sep 18, 2019

lore
Share & tools
lore
#0 lore raw

cover Add acceptance test for migration

Add new test for migration that bringup vm with different machine types and migrate it, introduce new API in avocado_qemu to query all the machine types supported by qemu.

Test run:

# avocado run migration.py
JOB ID     : ef54f57a073eb267d2347e32225f2adbe27969de
JOB LOG    : 
/home/bala/avocado-fvt-wrapper/results/job-2019-08-05T13.54-ef54f57/job.log
 (1/2) migration.py:Migration.test_migration_with_tcp_localhost: PASS
(0.54 s)
 (2/2) migration.py:Migration.test_migration_with_machine_types: PASS
(5.21 s)
RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME   : 5.86 s

Currently acceptance test for migration error out as we check query-migrate in target after migration which is not appropriate.

Balamuruhan S (3):
tests/acceptance/migration: fix post migration check tests/acceptance/avocado_qemu: add method to get supported machine
types
tests/acceptance/migration: test to migrate will all machine types

 tests/acceptance/avocado_qemu/__init__.py |  6 ++++++
 tests/acceptance/migration.py             | 27 ++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.5
#5 lore raw

PATCH 2/3 tests/acceptance/avocado_qemu: add method to get supported machine types

add get_machine_types() to return list of supported machine types by the qemu binary.

---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++++
 1 file changed, 6 insertions(+)
tests/acceptance/avocado_qemu/__init__.py +6 -0
index bd41e0443c..42a1b572bd 100644
@@ -85,6 +85,12 @@ class Test(avocado.Test):
             self._vms[name] = self._new_vm(*args)
         return self._vms[name]
 
+    def get_machine_types(self):
+        cmd = "%s -machine ?" % self.qemu_bin
+        output = avocado.utils.process.getoutput(cmd).split("\n")
+        output.remove("Supported machines are:")
+        return [each.split()[0] for each in output]
+
     def tearDown(self):
         for vm in self._vms.values():
             vm.shutdown()
Signature · 1 line
2.14.5
#6 lore raw

PATCH 3/3 tests/acceptance/migration: test to migrate will all machine types

In reply to Balamuruhan S

add migration test to query machine types supported by qemu binary and migrate vm will all supported type.

---
 tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/acceptance/migration.py +26 -0
index 0f3553c8f0..74416ccc21 100644
@@ -49,3 +49,29 @@ class Migration(Test):
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
         self.assertEqual(source_vm.command('query-status')['status'],
                          'postmigrate')
+
+
+    def test_migration_with_machine_types(self):
+        migration_port = self._get_free_port()
+        for machine in self.get_machine_types():
+            if 'pseries' in machine:
+                print("migrating with machine type - {}".format(machine))
+                source_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine))
+                dest_uri = 'tcp:localhost:%u' % migration_port
+                dest_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine),
+                                      '-incoming', dest_uri)
+                dest_vm.launch()
+                source_vm.launch()
+                source_vm.qmp('migrate', uri=dest_uri)
+                wait.wait_for(
+                    self.migration_finished,
+                    timeout=self.timeout,
+                    step=0.1,
+                    args=(source_vm,)
+                )
+                self.assertEqual(source_vm.command('query-migrate')['status'],
+                                                   'completed')
+                self.assertEqual(dest_vm.command('query-status')['status'],
+                                                 'running')
+                self.assertEqual(source_vm.command('query-status')['status'],
+                                                   'postmigrate')
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/3 tests/acceptance/migration: fix post migration check

In reply to Balamuruhan S

assert query-migrate in target doesn't give migration status and test errors even if migration succeeds.

In target:
{'execute': 'query-migrate'}
{"return": {}}

---
 tests/acceptance/migration.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/acceptance/migration.py +4 -3
index a44c1ae58f..0f3553c8f0 100644
@@ -44,7 +44,8 @@ class Migration(Test):
             step=0.1,
             args=(source_vm,)
         )
-        self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
-        self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
+        self.assertEqual(source_vm.command('query-migrate')['status'],
+                         'completed')
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
-        self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
+        self.assertEqual(source_vm.command('query-status')['status'],
+                         'postmigrate')
Signature · 1 line
2.14.5
#7 lore raw

Re: [Qemu-devel] [PATCH 3/3] tests/acceptance/migration: test to migrate will all machine types

In reply to Balamuruhan S
Quoted 4 lines · * Balamuruhan S ([email protected]) wrote:

add migration test to query machine types supported by qemu binary and migrate vm will all supported type.

Depending on the architecture you might find that some machine types aren't migratable while some are.

Dave

Quoted 42 lines
---
 tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/acceptance/migration.py +26 -0
index 0f3553c8f0..74416ccc21 100644
@@ -49,3 +49,29 @@ class Migration(Test):
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
         self.assertEqual(source_vm.command('query-status')['status'],
                          'postmigrate')
+
+
+    def test_migration_with_machine_types(self):
+        migration_port = self._get_free_port()
+        for machine in self.get_machine_types():
+            if 'pseries' in machine:
+                print("migrating with machine type - {}".format(machine))
+                source_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine))
+                dest_uri = 'tcp:localhost:%u' % migration_port
+                dest_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine),
+                                      '-incoming', dest_uri)
+                dest_vm.launch()
+                source_vm.launch()
+                source_vm.qmp('migrate', uri=dest_uri)
+                wait.wait_for(
+                    self.migration_finished,
+                    timeout=self.timeout,
+                    step=0.1,
+                    args=(source_vm,)
+                )
+                self.assertEqual(source_vm.command('query-migrate')['status'],
+                                                   'completed')
+                self.assertEqual(dest_vm.command('query-status')['status'],
+                                                 'running')
+                self.assertEqual(source_vm.command('query-status')['status'],
+                                                   'postmigrate')
Signature · 1 line
2.14.5

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

#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] tests/acceptance/migration: fix post migration check

In reply to Balamuruhan S
Quoted 6 lines · * Balamuruhan S ([email protected]) wrote:

assert query-migrate in target doesn't give migration status and test errors even if migration succeeds.

In target:
{'execute': 'query-migrate'}
{"return": {}}

On which version of qemu?

On the current version I see:

{"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, "package": "v4.1.0-852-g1a0b66e787"}, "capabilities": ["oob"]}} { "execute": "qmp_capabilities" }
{"return": {}}
{'execute': 'query-migrate'}
{"return": {"status": "completed"}}

Dave

Quoted 25 lines
---
 tests/acceptance/migration.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/acceptance/migration.py +4 -3
index a44c1ae58f..0f3553c8f0 100644
@@ -44,7 +44,8 @@ class Migration(Test):
             step=0.1,
             args=(source_vm,)
         )
-        self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
-        self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
+        self.assertEqual(source_vm.command('query-migrate')['status'],
+                         'completed')
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
-        self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
+        self.assertEqual(source_vm.command('query-status')['status'],
+                         'postmigrate')
Signature · 1 line
2.14.5

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

#8 lore raw

Re: [Qemu-devel] [PATCH 3/3] tests/acceptance/migration: test to migrate will all machine types

In reply to Dr. David Alan Gilbert
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Balamuruhan S ([email protected]) wrote:

add migration test to query machine types supported by qemu binary and migrate vm will all supported type.

Depending on the architecture you might find that some machine types aren't migratable while some are.

Thanks Dave, is there a way to query/check whether a machine type on the architecture is migratable or should we try migrating and handle exception on failure ?

-- Bala

Quoted 47 lines

Dave

Quoted 42 lines
---
 tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/acceptance/migration.py +26 -0
index 0f3553c8f0..74416ccc21 100644
@@ -49,3 +49,29 @@ class Migration(Test):
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
         self.assertEqual(source_vm.command('query-status')['status'],
                          'postmigrate')
+
+
+    def test_migration_with_machine_types(self):
+        migration_port = self._get_free_port()
+        for machine in self.get_machine_types():
+            if 'pseries' in machine:
+                print("migrating with machine type - {}".format(machine))
+                source_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine))
+                dest_uri = 'tcp:localhost:%u' % migration_port
+                dest_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine),
+                                      '-incoming', dest_uri)
+                dest_vm.launch()
+                source_vm.launch()
+                source_vm.qmp('migrate', uri=dest_uri)
+                wait.wait_for(
+                    self.migration_finished,
+                    timeout=self.timeout,
+                    step=0.1,
+                    args=(source_vm,)
+                )
+                self.assertEqual(source_vm.command('query-migrate')['status'],
+                                                   'completed')
+                self.assertEqual(dest_vm.command('query-status')['status'],
+                                                 'running')
+                self.assertEqual(source_vm.command('query-status')['status'],
+                                                   'postmigrate')
Signature · 1 line
2.14.5

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

#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] tests/acceptance/migration: fix post migration check

In reply to Dr. David Alan Gilbert
Quoted 9 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Balamuruhan S ([email protected]) wrote:

assert query-migrate in target doesn't give migration status and test errors even if migration succeeds.

In target:
{'execute': 'query-migrate'}
{"return": {}}

On which version of qemu?

sorry I worked on this earlier and I haven't notice the version, I re-tried the same in upstream Qemu and observed the one you have posted. Thanks, I will remove this change in the next version.

But I am observing the error often while executing query-migrate from test,

2019-09-17 03:15:34,797 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,798 qmp              L0175 DEBUG| <<< {'return': {'expected-downtime': 300, 'status': 'active', 'setup-time': 1, 'total-time': 102, 'ram': {'total': 536870912, 'postcopy-requests': 0, 'dirty-sync-count': 1, 'multifd-bytes': 0, 'pages-per-second': 0, 'page-size': 4096, 'remaining': 4521984, 'mbps': 0, 'transferred': 3372844, 'duplicate': 129430, 'dirty-pages-rate': 0, 'skipped': 0, 'normal-bytes': 2203648, 'normal': 538}}}
2019-09-17 03:15:34,899 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,899 qmp              L0087 DEBUG| <<< {'timestamp': {'seconds': 1568704534, 'microseconds': 802440}, 'event': 'STOP'}
2019-09-17 03:15:34,900 qmp              L0175 DEBUG| <<< {'return': {'status': 'completed', 'setup-time': 1, 'downtime': 30, 'total-time': 137, 'ram': {'total': 536870912, 'postcopy-requests': 0, 'dirty-sync-count': 4, 'multifd-bytes': 0, 'pages-per-second': 1299680, 'page-size': 4096, 'remaining': 0, 'mbps': 474.753235, 'transferred': 4548090, 'duplicate': 133244, 'dirty-pages-rate': 0, 'skipped': 0, 'normal-bytes': 3342336, 'normal': 816}}}
2019-09-17 03:15:34,900 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,900 qmp              L0087 DEBUG| <<< {'timestamp': {'seconds': 1568704534, 'microseconds': 832595}, 'event': 'RESUME'}
2019-09-17 03:15:35,545 stacktrace       L0039 ERROR|
2019-09-17 03:15:35,545 stacktrace       L0042 ERROR| Reproduced traceback from: /usr/local/lib/python3.6/site-packages/avocado/core/test.py:853
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR| Traceback (most recent call last):
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/migration.py", line 47, in test_migration_with_tcp_localhost
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|     self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/machine.py", line 378, in command
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|     reply = self.qmp(cmd, conv_keys, **args)
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/machine.py", line 370, in qmp
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self._qmp.cmd(cmd, args=qmp_args)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 191, in cmd
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self.cmd_obj(qmp_cmd)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 174, in cmd_obj
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     resp = self.__json_read()
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 82, in __json_read
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     data = self.__sockfile.readline()
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/usr/lib64/python3.6/socket.py", line 586, in readinto
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self._sock.recv_into(b)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR| ConnectionResetError: [Errno 104] Connection reset by peer

could you help me on what do I miss here ?

-- Bala

Quoted 37 lines

On the current version I see:

{"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, "package": "v4.1.0-852-g1a0b66e787"}, "capabilities": ["oob"]}} { "execute": "qmp_capabilities" }
{"return": {}}
{'execute': 'query-migrate'}
{"return": {"status": "completed"}}

Dave

Quoted 25 lines
---
 tests/acceptance/migration.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/acceptance/migration.py +4 -3
index a44c1ae58f..0f3553c8f0 100644
@@ -44,7 +44,8 @@ class Migration(Test):
             step=0.1,
             args=(source_vm,)
         )
-        self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
-        self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
+        self.assertEqual(source_vm.command('query-migrate')['status'],
+                         'completed')
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
-        self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
+        self.assertEqual(source_vm.command('query-status')['status'],
+                         'postmigrate')
Signature · 1 line
2.14.5

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

#4 lore raw

Re: [Qemu-devel] [PATCH 1/3] tests/acceptance/migration: fix post migration check

Quoted 9 lines · * Balamuruhan S ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Balamuruhan S ([email protected]) wrote:

assert query-migrate in target doesn't give migration status and test errors even if migration succeeds.

In target:
{'execute': 'query-migrate'}
{"return": {}}

Quoted 6 lines
Quoted 1 line

On which version of qemu?

sorry I worked on this earlier and I haven't notice the version, I re-tried the same in upstream Qemu and observed the one you have posted. Thanks, I will remove this change in the next version.

Great; I don't think it always returns a status; but it should in most cases after a migration.

Quoted 30 lines

But I am observing the error often while executing query-migrate from test,

2019-09-17 03:15:34,797 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,798 qmp              L0175 DEBUG| <<< {'return': {'expected-downtime': 300, 'status': 'active', 'setup-time': 1, 'total-time': 102, 'ram': {'total': 536870912, 'postcopy-requests': 0, 'dirty-sync-count': 1, 'multifd-bytes': 0, 'pages-per-second': 0, 'page-size': 4096, 'remaining': 4521984, 'mbps': 0, 'transferred': 3372844, 'duplicate': 129430, 'dirty-pages-rate': 0, 'skipped': 0, 'normal-bytes': 2203648, 'normal': 538}}}
2019-09-17 03:15:34,899 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,899 qmp              L0087 DEBUG| <<< {'timestamp': {'seconds': 1568704534, 'microseconds': 802440}, 'event': 'STOP'}
2019-09-17 03:15:34,900 qmp              L0175 DEBUG| <<< {'return': {'status': 'completed', 'setup-time': 1, 'downtime': 30, 'total-time': 137, 'ram': {'total': 536870912, 'postcopy-requests': 0, 'dirty-sync-count': 4, 'multifd-bytes': 0, 'pages-per-second': 1299680, 'page-size': 4096, 'remaining': 0, 'mbps': 474.753235, 'transferred': 4548090, 'duplicate': 133244, 'dirty-pages-rate': 0, 'skipped': 0, 'normal-bytes': 3342336, 'normal': 816}}}
2019-09-17 03:15:34,900 qmp              L0167 DEBUG| >>> {'execute': 'query-migrate'}
2019-09-17 03:15:34,900 qmp              L0087 DEBUG| <<< {'timestamp': {'seconds': 1568704534, 'microseconds': 832595}, 'event': 'RESUME'}
2019-09-17 03:15:35,545 stacktrace       L0039 ERROR|
2019-09-17 03:15:35,545 stacktrace       L0042 ERROR| Reproduced traceback from: /usr/local/lib/python3.6/site-packages/avocado/core/test.py:853
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR| Traceback (most recent call last):
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/migration.py", line 47, in test_migration_with_tcp_localhost
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|     self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/machine.py", line 378, in command
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|     reply = self.qmp(cmd, conv_keys, **args)
2019-09-17 03:15:35,547 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/machine.py", line 370, in qmp
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self._qmp.cmd(cmd, args=qmp_args)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 191, in cmd
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self.cmd_obj(qmp_cmd)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 174, in cmd_obj
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     resp = self.__json_read()
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/home/bala/qemu/tests/acceptance/avocado_qemu/../../../python/qemu/qmp.py", line 82, in __json_read
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     data = self.__sockfile.readline()
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|   File "/usr/lib64/python3.6/socket.py", line 586, in readinto
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR|     return self._sock.recv_into(b)
2019-09-17 03:15:35,548 stacktrace       L0045 ERROR| ConnectionResetError: [Errno 104] Connection reset by peer
Quoted 1 line

could you help me on what do I miss here ?

I don't know avocado much; but that looks as though the qemu has exited on you.

Dave

Quoted 40 lines

-- Bala

Quoted 37 lines

On the current version I see:

{"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, "package": "v4.1.0-852-g1a0b66e787"}, "capabilities": ["oob"]}} { "execute": "qmp_capabilities" }
{"return": {}}
{'execute': 'query-migrate'}
{"return": {"status": "completed"}}

Dave

Quoted 25 lines
---
 tests/acceptance/migration.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/acceptance/migration.py +4 -3
index a44c1ae58f..0f3553c8f0 100644
@@ -44,7 +44,8 @@ class Migration(Test):
             step=0.1,
             args=(source_vm,)
         )
-        self.assertEqual(dest_vm.command('query-migrate')['status'], 'completed')
-        self.assertEqual(source_vm.command('query-migrate')['status'], 'completed')
+        self.assertEqual(source_vm.command('query-migrate')['status'],
+                         'completed')
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
-        self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate')
+        self.assertEqual(source_vm.command('query-status')['status'],
+                         'postmigrate')
Signature · 1 line
2.14.5

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

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

#9 lore raw

Re: [Qemu-devel] [PATCH 3/3] tests/acceptance/migration: test to migrate will all machine types

In reply to Balamuruhan S
Quoted 5 lines · * Balamuruhan S ([email protected]) wrote:
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Balamuruhan S ([email protected]) wrote:

add migration test to query machine types supported by qemu binary and migrate vm will all supported type.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Depending on the architecture you might find that some machine types aren't migratable while some are.

Thanks Dave, is there a way to query/check whether a machine type on the architecture is migratable or should we try migrating and handle exception on failure ?

I don't know a way to detect it; you can add -only-migratable to get qemu to fai early if a device is declared as being non-migratable; but that still doesn't say that all the devices have actually been tested migrating.

Dave

Quoted 49 lines

-- Bala

Quoted 47 lines

Dave

Quoted 42 lines
---
 tests/acceptance/migration.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/acceptance/migration.py +26 -0
index 0f3553c8f0..74416ccc21 100644
@@ -49,3 +49,29 @@ class Migration(Test):
         self.assertEqual(dest_vm.command('query-status')['status'], 'running')
         self.assertEqual(source_vm.command('query-status')['status'],
                          'postmigrate')
+
+
+    def test_migration_with_machine_types(self):
+        migration_port = self._get_free_port()
+        for machine in self.get_machine_types():
+            if 'pseries' in machine:
+                print("migrating with machine type - {}".format(machine))
+                source_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine))
+                dest_uri = 'tcp:localhost:%u' % migration_port
+                dest_vm = self.get_vm('-M', '{},cap-htm=off'.format(machine),
+                                      '-incoming', dest_uri)
+                dest_vm.launch()
+                source_vm.launch()
+                source_vm.qmp('migrate', uri=dest_uri)
+                wait.wait_for(
+                    self.migration_finished,
+                    timeout=self.timeout,
+                    step=0.1,
+                    args=(source_vm,)
+                )
+                self.assertEqual(source_vm.command('query-migrate')['status'],
+                                                   'completed')
+                self.assertEqual(dest_vm.command('query-status')['status'],
+                                                 'running')
+                self.assertEqual(source_vm.command('query-status')['status'],
+                                                   'postmigrate')
Signature · 1 line
2.14.5

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

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

#10 lore raw

Re: [Qemu-devel] [PATCH 3/3] tests/acceptance/migration: test to migrate will all machine types

Quoted 11 lines · Dr. David Alan Gilbert
Quoted 10 lines · * Balamuruhan S ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Balamuruhan S ([email protected]) wrote:

add migration test to query machine types supported by qemu binary and migrate vm will all supported type.

Depending on the architecture you might find that some machine types aren't migratable while some are.

Quoted 8 lines
Quoted 3 lines

Thanks Dave, is there a way to query/check whether a machine type on the architecture is migratable or should we try migrating and handle exception on failure ?

I don't know a way to detect it; you can add -only-migratable to get qemu to fai early if a device is declared as being non-migratable; but that still doesn't say that all the devices have actually been tested migrating.

At present we kind of have an informal distinction between those machine types that are mature and maintained enough to support migration (which I think is just pc, q35, pseries and arm virt) and those which aren't.

There isn't, as far as I know, a way to detect this.

I know we've mentioned at least briefly the idea of formalizing this distinction at qemu summit, but I don't think the discussion went anywhere.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson