* [PATCH] Acceptance test: provides to use different transport for migration
@ 2020-01-23 14:09 Oksana Vohchana
0 siblings, 0 replies; 3+ messages in thread
From: Oksana Vohchana @ 2020-01-23 14:09 UTC (permalink / raw)
To: qemu-devel
Along with VM migration via TCP, we can use migration through EXEC
and UNIX transport protocol
Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
---
tests/acceptance/migration.py | 50 ++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index a44c1ae58f..8bbe28d52d 100644
--- 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
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, CmdNotFoundError
class Migration(Test):
@@ -24,6 +27,26 @@ class Migration(Test):
def migration_finished(vm):
return vm.command('query-migrate')['status'] in ('completed', 'failed')
+ 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 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 _get_free_port(self):
port = network.find_free_port()
if port is None:
@@ -32,19 +55,16 @@ 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)
+
+ 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):
+ 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)
--
2.21.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] Acceptance test: provides to use different transport for migration
@ 2020-01-23 12:30 Oksana Vohchana
2020-01-28 18:36 ` Wainer dos Santos Moschetta
0 siblings, 1 reply; 3+ messages in thread
From: Oksana Vohchana @ 2020-01-23 12:30 UTC (permalink / raw)
To: qemu-devel
Along with VM migration via TCP, we can use migration through EXEC
and UNIX transport protocol
Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
---
tests/acceptance/migration.py | 50 ++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index a44c1ae58f..8bbe28d52d 100644
--- 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
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, CmdNotFoundError
class Migration(Test):
@@ -24,6 +27,26 @@ class Migration(Test):
def migration_finished(vm):
return vm.command('query-migrate')['status'] in ('completed', 'failed')
+ 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 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 _get_free_port(self):
port = network.find_free_port()
if port is None:
@@ -32,19 +55,16 @@ 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)
+
+ 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):
+ 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)
--
2.21.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Acceptance test: provides to use different transport for migration
2020-01-23 12:30 Oksana Vohchana
@ 2020-01-28 18:36 ` Wainer dos Santos Moschetta
0 siblings, 0 replies; 3+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-01-28 18:36 UTC (permalink / raw)
To: Oksana Vohchana, qemu-devel
Hi Oksana,
Thanks for your first contribution to QEMU. Some comments below.
On 1/23/20 10:30 AM, Oksana Vohchana wrote:
> Along with VM migration via TCP, we can use migration through EXEC
> and UNIX transport protocol
>
> Signed-off-by: Oksana Vohchana <ovoshcha@redhat.com>
> ---
> tests/acceptance/migration.py | 50 ++++++++++++++++++++++++-----------
> 1 file changed, 35 insertions(+), 15 deletions(-)
>
> diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
> index a44c1ae58f..8bbe28d52d 100644
> --- 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
> from avocado_qemu import Test
> +from avocado import skipUnless\
Remove the trailing '\'.
>
> from avocado.utils import network
> from avocado.utils import wait
> +from avocado.utils.path import find_command, CmdNotFoundError
CmdNotFoundError is never used.
>
>
> class Migration(Test):
> @@ -24,6 +27,26 @@ class Migration(Test):
> def migration_finished(vm):
> return vm.command('query-migrate')['status'] in ('completed', 'failed')
>
> + 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 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 _get_free_port(self):
> port = network.find_free_port()
> if port is None:
> @@ -32,19 +55,16 @@ 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)
> +
> + 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):
Please add a blank line between the two methods.
> + 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-28 19:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-23 14:09 [PATCH] Acceptance test: provides to use different transport for migration Oksana Vohchana
-- strict thread matches above, loose matches on Subject: below --
2020-01-23 12:30 Oksana Vohchana
2020-01-28 18:36 ` Wainer dos Santos Moschetta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).