From nobody Sun Nov 9 15:06:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550864919935769.606158224816; Fri, 22 Feb 2019 11:48:39 -0800 (PST) Received: from localhost ([127.0.0.1]:56165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxGoA-0008P0-2y for importer@patchew.org; Fri, 22 Feb 2019 14:48:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxGi3-0003vU-Fd for qemu-devel@nongnu.org; Fri, 22 Feb 2019 14:42:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxGi2-0008EW-JW for qemu-devel@nongnu.org; Fri, 22 Feb 2019 14:42:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gxGi0-0008Bf-DF; Fri, 22 Feb 2019 14:42:08 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A710BA4053; Fri, 22 Feb 2019 19:42:07 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1D215D706; Fri, 22 Feb 2019 19:42:05 +0000 (UTC) From: Cleber Rosa To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 22 Feb 2019 14:41:44 -0500 Message-Id: <20190222194146.13102-6-crosa@redhat.com> In-Reply-To: <20190222194146.13102-1-crosa@redhat.com> References: <20190222194146.13102-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 22 Feb 2019 19:42:07 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/7] tests.acceptance: adds simple migration test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Caio Carrara , Markus Armbruster , Wainer dos Santos Moschetta , Max Reitz , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Caio Carrara This change adds the simplest possible migration test. Beyond the test purpose itself it's also useful to exercise the multi virtual machines capabilities from base avocado qemu test class. Signed-off-by: Cleber Rosa Signed-off-by: Caio Carrara Reviewed-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20190212193855.13223-3-ccarrara@redhat.com> Signed-off-by: Cleber Rosa --- tests/acceptance/migration.py | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 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..6115cf6c24 --- /dev/null +++ b/tests/acceptance/migration.py @@ -0,0 +1,53 @@ +# Migration test +# +# Copyright (c) 2019 Red Hat, Inc. +# +# Authors: +# Cleber Rosa +# Caio Carrara +# +# 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 =3D 10 + + @staticmethod + def migration_finished(vm): + return vm.command('query-migrate')['status'] in ('completed', 'fai= led') + + def _get_free_port(self): + port =3D network.find_free_port() + if port is None: + self.cancel('Failed to find a free port') + return port + + + def test_migration_with_tcp_localhost(self): + source_vm =3D self.get_vm() + dest_uri =3D 'tcp:localhost:%u' % self._get_free_port() + dest_vm =3D self.get_vm('-incoming', dest_uri) + dest_vm.launch() + source_vm.launch() + source_vm.qmp('migrate', uri=3Ddest_uri) + wait.wait_for( + self.migration_finished, + timeout=3Dself.timeout, + step=3D0.1, + args=3D(source_vm,) + ) + self.assertEqual(dest_vm.command('query-migrate')['status'], 'comp= leted') + self.assertEqual(source_vm.command('query-migrate')['status'], 'co= mpleted') + self.assertEqual(dest_vm.command('query-status')['status'], 'runni= ng') + self.assertEqual(source_vm.command('query-status')['status'], 'pos= tmigrate') --=20 2.20.1