From patchwork Fri Feb 25 21:01:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 12760947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AD8FC433EF for ; Fri, 25 Feb 2022 21:20:56 +0000 (UTC) Received: from localhost ([::1]:47054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNi1H-0004wj-MG for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 16:20:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNhkR-00072Q-QM for qemu-devel@nongnu.org; Fri, 25 Feb 2022 16:03:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNhkO-0005QP-Fm for qemu-devel@nongnu.org; Fri, 25 Feb 2022 16:03:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645823002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uOuOLyLdCnh99/oAfl/tDKSBuWvbul9urTxuUFywBmo=; b=IOfatcmg8mzGk2s0l8yb7tpTGw1V/pYJD5W3nKQozHM48jMtezHt6HQB4k/p2f2ervDvC7 aJplXYxi0LcPinqv72K4YcrPelxWVQ9d08hFwtZaS/1C4NNcM61IktCXv3TWBSV0XJV90C psjpfQaj9MJQH9l7QMiIKx8W99zRIfA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-468-UId7-3ZXMN23XF5Kag9G0Q-1; Fri, 25 Feb 2022 16:03:18 -0500 X-MC-Unique: UId7-3ZXMN23XF5Kag9G0Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7AD5D801AAD; Fri, 25 Feb 2022 21:03:15 +0000 (UTC) Received: from p50.localhost.localdomain.com (unknown [10.22.16.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60C0A2ED79; Fri, 25 Feb 2022 21:03:08 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P_?= =?utf-8?q?=2E_Berrang=C3=A9?= , Peter Maydell Subject: [PATCH 3/9] Avocado migration test: adapt to "utils.network" API namespace change Date: Fri, 25 Feb 2022 16:01:50 -0500 Message-Id: <20220225210156.2032055-4-crosa@redhat.com> In-Reply-To: <20220225210156.2032055-1-crosa@redhat.com> References: <20220225210156.2032055-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , Mark Cave-Ayland , Eric Farman , KONRAD Frederic , "Edgar E. Iglesias" , Alexandre Iooss , Yoshinori Sato , Daniel Henrique Barboza , Wainer dos Santos Moschetta , Halil Pasic , =?utf-8?q?Herv=C3=A9_Poussineau?= , Antony Pavlov , Christian Borntraeger , Thomas Huth , Greg Kurz , Fabien Chouteau , Eric Auger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Pavel Dovgalyuk , Cleber Rosa , David Gibson , Beraldo Leal , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Since Avocado 94.0[1], the "avocado.utils.network" dropped a lot of previously deprecated API names, having the new names into a finer grained structure. This simply uses the new API names for the network port utility module. [1] - https://avocado-framework.readthedocs.io/en/latest/releases/94_0.html#utility-apis Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée --- tests/avocado/avocado_qemu/__init__.py | 5 +++-- tests/avocado/migration.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index 88cec83e5c..3f15c8a222 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -17,7 +17,8 @@ import uuid import avocado -from avocado.utils import cloudinit, datadrainer, network, process, ssh, vmimage +from avocado.utils import cloudinit, datadrainer, process, ssh, vmimage +from avocado.utils.network import ports from avocado.utils.path import find_command #: The QEMU build root directory. It may also be the source directory @@ -601,7 +602,7 @@ def prepare_cloudinit(self, ssh_pubkey=None): self.log.info('Preparing cloudinit image') try: cloudinit_iso = os.path.join(self.workdir, 'cloudinit.iso') - self.phone_home_port = network.find_free_port() + self.phone_home_port = ports.find_free_port() pubkey_content = None if ssh_pubkey: with open(ssh_pubkey) as pubkey: diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py index 584d6ef53f..4b25680c50 100644 --- a/tests/avocado/migration.py +++ b/tests/avocado/migration.py @@ -14,7 +14,7 @@ from avocado_qemu import QemuSystemTest from avocado import skipUnless -from avocado.utils import network +from avocado.utils.network import ports from avocado.utils import wait from avocado.utils.path import find_command @@ -57,7 +57,7 @@ def do_migrate(self, dest_uri, src_uri=None): self.assert_migration(source_vm, dest_vm) def _get_free_port(self): - port = network.find_free_port() + port = ports.find_free_port() if port is None: self.cancel('Failed to find a free port') return port