[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/2] Acceptance tests: add simple migration test
From: |
Caio Carrara |
Subject: |
[Qemu-devel] [PATCH v2 2/2] Acceptance tests: add simple migration test |
Date: |
Mon, 28 Jan 2019 15:47:25 -0200 |
From: Cleber Rosa <address@hidden>
This is the simplest possible migration test, exercising the multi
VM capabilities of the test class.
Signed-off-by: Cleber Rosa <address@hidden>
---
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 <address@hidden>
+#
+# 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