From: Caio Carrara <ccarrara@redhat.com>
To: qemu-devel@nongnu.org
Cc: wainersm@redhat.com, ehabkost@redhat.com, philmd@redhat.com,
crosa@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/2] Acceptance tests: add simple migration test
Date: Mon, 28 Jan 2019 15:47:25 -0200 [thread overview]
Message-ID: <20190128174725.8809-3-ccarrara@redhat.com> (raw)
In-Reply-To: <20190128174725.8809-1-ccarrara@redhat.com>
From: Cleber Rosa <crosa@redhat.com>
This is the simplest possible migration test, exercising the multi
VM capabilities of the test class.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/migration.py | 45 +++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 tests/acceptance/migration.py
diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
new file mode 100644
index 0000000000..973ae0ab4b
--- /dev/null
+++ b/tests/acceptance/migration.py
@@ -0,0 +1,45 @@
+# Migration test
+#
+# Copyright (c) 2019 Red Hat, Inc.
+#
+# Author:
+# Cleber Rosa <crosa@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+
+from avocado_qemu import Test
+
+from avocado.utils import network
+from avocado.utils import wait
+
+
+class Migration(Test):
+ """
+ :avocado: enable
+ """
+
+ timeout = 10
+
+ @staticmethod
+ def migration_completed(vm):
+ cmd_result = vm.qmp('query-migrate')
+ if cmd_result is not None:
+ result = cmd_result.get('return')
+ if result is not None:
+ return result.get('status') == 'completed'
+ return False
+
+ def test_tcp(self):
+ source = self.get_vm()
+ port = network.find_free_port()
+ if port is None:
+ self.cancel('Failed to find a free port')
+ dest_uri = 'tcp:localhost:%u' % port
+ dest = self.get_vm('-incoming', dest_uri)
+ dest.launch()
+ source.launch()
+ source.qmp('migrate', uri=dest_uri)
+ wait.wait_for(self.migration_completed, timeout=self.timeout,
+ step=0.1, args=(source,))
--
2.20.1
next prev parent reply other threads:[~2019-01-28 18:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 17:47 [Qemu-devel] [PATCH v2 0/2] Acceptance tests: adds multi vm capability and basic migration test Caio Carrara
2019-01-28 17:47 ` [Qemu-devel] [PATCH v2 1/2] tests.acceptance: adds multi vm capability for acceptance tests Caio Carrara
2019-01-28 19:42 ` Wainer dos Santos Moschetta
2019-01-29 11:30 ` Caio Carrara
2019-01-29 17:48 ` Wainer dos Santos Moschetta
2019-01-28 17:47 ` Caio Carrara [this message]
2019-01-29 18:46 ` [Qemu-devel] [PATCH v2 2/2] Acceptance tests: add simple migration test Wainer dos Santos Moschetta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190128174725.8809-3-ccarrara@redhat.com \
--to=ccarrara@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).