Acceptance test: provides to use different transport for migration
v3 cover Acceptance test: provides to use different transport for migration
This series makes refactoring to migration test and adds new tests with EXEC and UNIX protocols
---
v2:
- Removes unnecessary symbols and unused method
v3:
- Makes refactoring and split into 2 patches
- Provides TCP and EXEC migration
Oksana Vohchana (2):
Acceptance test: provides to use different transport for migration Acceptance test: provides to use different transport for migration
tests/acceptance/migration.py | 52 +++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 15 deletions(-)
Signature · 1 line
2.21.1
PATCH v3 1/2 Acceptance test: provides to use different transport for migration
Along with VM migration via TCP, we can use migration through EXEC and UNIX transport protocol
---
v2:
- Removes unnecessary symbols and unused method
v3:
- Makes refactoring and split into 2 patches
--- tests/acceptance/migration.py | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
tests/acceptance/migration.py +21 -15
@@ -24,6 +24,26 @@ class Migration(Test): def migration_finished(vm): return vm.command('query-migrate')['status'] in ('completed', 'failed') + def assert_migration(self, source_vm, dest_vm): + 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-migrate')['status'], 'completed') + self.assertEqual(dest_vm.command('query-status')['status'], 'running') + self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate') + + def do_migrate(self, dest_uri, src_uri=None): + source_vm = self.get_vm() + dest_vm = self.get_vm('-incoming', dest_uri) + dest_vm.launch() + if src_uri is None: + src_uri = dest_uri + source_vm.launch() + source_vm.qmp('migrate', uri=src_uri) + self.assert_migration(source_vm, dest_vm) + def _get_free_port(self): port = network.find_free_port() if port is None:
@@ -32,19 +52,5 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): - source_vm = self.get_vm() dest_uri = 'tcp:localhost:%u' % self._get_free_port() - dest_vm = self.get_vm('-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(dest_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.do_migrate(dest_uri)
Signature · 1 line
2.21.1
Hi Oksana,
Quoted 34 lines · Oksana Vohchana
Along with VM migration via TCP, we can use migration through EXEC and UNIX transport protocol
Signed-off-by Oksana Vohchana <[email protected]>---
v2:
- Removes unnecessary symbols and unused methodv3:
- Makes refactoring and split into 2 patchesSigned-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)tests/acceptance/migration.py +10
-0@@ -24,6 +24,26 @@ class Migration(Test): def migration_finished(vm): return vm.command('query-migrate')['status'] in ('completed', 'failed') + def assert_migration(self, source_vm, dest_vm): + 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-migrate')['status'], 'completed') + self.assertEqual(dest_vm.command('query-status')['status'], 'running') + self.assertEqual(source_vm.command('query-status')['status'], 'postmigrate') +
tests/acceptance/migration.py class Migration(Test): · line 46
Quoted 10 lines
tests/acceptance/migration.py +10
-0+ def do_migrate(self, dest_uri, src_uri=None): + source_vm = self.get_vm() + dest_vm = self.get_vm('-incoming', dest_uri) + dest_vm.launch() + if src_uri is None: + src_uri = dest_uri + source_vm.launch() + source_vm.qmp('migrate', uri=src_uri) + self.assert_migration(source_vm, dest_vm) +
Do you mind if I split this patch in 2 when applying to python-next, and change the subjects as "Extract Migration::assert_migration" and "Extract Migration::do_migrate"?
Meanwhile:
Quoted 25 lines
tests/acceptance/migration.py +1
-15def _get_free_port(self): port = network.find_free_port() if port is None:@@ -32,19 +52,5 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): - source_vm = self.get_vm() dest_uri = 'tcp:localhost:%u' % self._get_free_port() - dest_vm = self.get_vm('-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(dest_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.do_migrate(dest_uri)
PATCH v3 2/2 Acceptance test: provides to use different transport for migration
In reply to Oksana VohchanaAlong with VM migration via TCP, we can use migration through EXEC and UNIX transport protocol
---
v2:
- Removes unnecessary symbols and unused method
v3:
- Makes refactoring and split into 2 patches
- Provides TCP and EXEC migration
--- tests/acceptance/migration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tests/acceptance/migration.py +16 -0
@@ -10,10 +10,13 @@ # later. See the COPYING file in the top-level directory. +import tempfile from avocado_qemu import Test +from avocado import skipUnless from avocado.utils import network from avocado.utils import wait +from avocado.utils.path import find_command class Migration(Test):
@@ -54,3 +57,16 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port() self.do_migrate(dest_uri) + + def test_migration_with_unix(self): + with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: + dest_uri = 'unix:%s/qemu-test.sock' % socket_path + self.do_migrate(dest_uri) + + @skipUnless(find_command('nc', default=False), "nc command not found on the system") + def test_migration_with_exec(self): + """ + The test works for both netcat-traditional and netcat-openbsd packages + """ + free_port = self._get_free_port() + dest_uri = 'exec:nc -l localhost %u' % free_port
+ src_uri = 'exec:nc localhost %u' % free_port
+ self.do_migrate(dest_uri, src_uri)
Signature · 1 line
2.21.1
Quoted 35 lines · Oksana Vohchana
Along with VM migration via TCP, we can use migration through EXEC and UNIX transport protocol
Signed-off-by Oksana Vohchana <[email protected]>---
v2:
- Removes unnecessary symbols and unused methodv3:
- Makes refactoring and split into 2 patches
- Provides TCP and EXEC migrationSigned-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)tests/acceptance/migration.py +3
-0@@ -10,10 +10,13 @@ # later. See the COPYING file in the top-level directory. +import tempfile from avocado_qemu import Test +from avocado import skipUnless from avocado.utils import network from avocado.utils import wait +from avocado.utils.path import find_command class Migration(Test):
tests/acceptance/migration.py class Migration(Test): · line 64
Quoted 8 lines
tests/acceptance/migration.py +5
-0@@ -54,3 +57,16 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port() self.do_migrate(dest_uri) + + def test_migration_with_unix(self): + with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: + dest_uri = 'unix:%s/qemu-test.sock' % socket_path + self.do_migrate(dest_uri)
Similarly, do you mind if I split and update subjects to "Test the UNIX transport when migrating" and "Test the TCP transport when migrating"?
Meanwhile:
Quoted 11 lines
tests/acceptance/migration.py +10
-0+ + @skipUnless(find_command('nc', default=False), "nc command not found on the system") + def test_migration_with_exec(self): + """ + The test works for both netcat-traditional and netcat-openbsd packages + """ + free_port = self._get_free_port() + dest_uri = 'exec:nc -l localhost %u' % free_port + src_uri = 'exec:nc localhost %u' % free_port + self.do_migrate(dest_uri, src_uri)
Hi Philippe
You can do whatever it takes
I appreciate you for a review
Thanks
Quoted 68 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Oksana Vohchana
Along with VM migration via TCP, we can use migration through EXEC and UNIX transport protocol
Signed-off-by Oksana Vohchana <[email protected]>---
v2:
- Removes unnecessary symbols and unused methodv3:
- Makes refactoring and split into 2 patches
- Provides TCP and EXEC migrationReview
Quoted 6 lines
Signed-off-by Oksana Vohchana <[email protected]>--- tests/acceptance/migration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)(quoted diff) +0
-0
b/tests/acceptance/migration.pyQuoted 18 lines
index
34263d8eeb..4419e38384100644tests/acceptance/migration.py +3
-0@@ -10,10 +10,13 @@ # later. See the COPYING file in the top-level directory. +import tempfile from avocado_qemu import Test +from avocado import skipUnless from avocado.utils import network from avocado.utils import wait +from avocado.utils.path import find_command class Migration(Test):tests/acceptance/migration.py class Migration(Test): · line 62
Quoted 6 lines
tests/acceptance/migration.py +3
-0@@ -54,3 +57,16 @@ class Migration(Test): def test_migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port() self.do_migrate(dest_uri) + + def test_migration_with_unix(self): + with tempfile.TemporaryDirectory(prefix='socket_') as
socket_path:tests/acceptance/migration.py class Migration(Test): · line 64
Quoted 2 lines
tests/acceptance/migration.py +2
-0+ dest_uri = 'unix:%s/qemu-test.sock' % socket_path + self.do_migrate(dest_uri)Similarly, do you mind if I split and update subjects to "Test the UNIX transport when migrating" and "Test the TCP transport when migrating"?
Meanwhile:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>tests/acceptance/migration.py class Migration(Test): · line 66
Quoted 2 lines
tests/acceptance/migration.py +2
-0+ + @skipUnless(find_command('nc', default=False), "nc command notfound on the system")
tests/acceptance/migration.py class Migration(Test):
Quoted 3 lines
tests/acceptance/migration.py +3
-0+ def test_migration_with_exec(self): + """ + The test works for both netcat-traditional and netcat-openbsdpackages
Quoted 6 lines
tests/acceptance/migration.py +5
-0+ """ + free_port = self._get_free_port() + dest_uri = 'exec:nc -l localhost %u' % free_port + src_uri = 'exec:nc localhost %u' % free_port + self.do_migrate(dest_uri, src_uri)
Quoted 4 lines · Oksana Voshchana
Hi Philippe
You can do whatever it takes
I appreciate you for a review
Thanks
OK I'll split as suggested then.
Quoted 73 lines · On Tue, Feb 4, 2020 at 4:12 PM Philippe Mathieu-Daudé <[email protected]…
On 2/3/20 12:16 PM, Oksana Vohchana wrote:
> Along with VM migration via TCP, we can use migration through EXEC > and UNIX transport protocol
>
> Signed-off-by: Oksana Vohchana <[email protected]
<mailto:[email protected]>>
> ---
> v2:
> - Removes unnecessary symbols and unused method
>
> v3:
> - Makes refactoring and split into 2 patches
> - Provides TCP and EXEC migration
> Signed-off-by: Oksana Vohchana <[email protected]
<mailto:[email protected]>>
> ---
> tests/acceptance/migration.py | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+)
>
> diff --gita/tests/acceptance/migration.py
b/tests/acceptance/migration.py
> index34263d8eeb..4419e38384100644
> ---a/tests/acceptance/migration.py
> +++b/tests/acceptance/migration.py
> @@ -10,10 +10,13 @@
> # later. See the COPYING file in the top-level directory. >
>
> +import tempfile
> fromavocado_qemuimport Test
> +from avocado import skipUnless
>
> from avocado.utils import network
> from avocado.utils import wait
> +from avocado.utils.path importfind_command
>
>
> class Migration(Test):
> @@ -54,3 +57,16 @@ class Migration(Test):
> deftest_migration_with_tcp_localhost(self):
> dest_uri = 'tcp:localhost:%u' %self._get_free_port()> self.do_migrate(dest_uri)
> +
> + deftest_migration_with_unix(self):
> + withtempfile.TemporaryDirectory(prefix='socket_')as
socket_path:
> +dest_uri= 'unix:%s/qemu-test.sock' %socket_path> +self.do_migrate(dest_uri)Similarly, do you mind if I split and update subjects to "Test the UNIX transport when migrating" and "Test the TCP transport when migrating"?
Meanwhile:
Reviewed-by Philippe Mathieu-Daudé <[email protected]<mailto:[email protected]>>
> +
> + @skipUnless(find_command('nc', default=False), "nc command
not found on the system")
> + deftest_migration_with_exec(self):
> + """
> + The test works for both netcat-traditional and
netcat-openbsd packages
> + """
> +free_port=self._get_free_port()
> +dest_uri= 'exec:nc -l localhost %u' %free_port> +src_uri= 'exec:nc localhost %u' %free_port> +self.do_migrate(dest_uri, src_uri)
>
Quoted 11 lines · Oksana Vohchana
This series makes refactoring to migration test and adds new tests with EXEC and UNIX protocols
---
v2:
- Removes unnecessary symbols and unused methodv3:
- Makes refactoring and split into 2 patches
- Provides TCP and EXEC migration
Quoted 7 lines
Oksana Vohchana (2):
Acceptance test: provides to use different transport for migration Acceptance test: provides to use different transport for migrationtests/acceptance/migration.py | 52 +++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 15 deletions(-)
Series applied to my python-next tree (splitting each patch in 2):
https://gitlab.com/philmd/qemu/commits/python-next