From patchwork Tue Jul 9 23:25:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 1130073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 ozlabs.org (Postfix) with ESMTPS id 45jzQY3D7Mz9sNj for ; Wed, 10 Jul 2019 09:43:00 +1000 (AEST) Received: from localhost ([::1]:56860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkzlA-0007Gi-BU for incoming@patchwork.ozlabs.org; Tue, 09 Jul 2019 19:42:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49178) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkzVh-0007QS-Pb for qemu-devel@nongnu.org; Tue, 09 Jul 2019 19:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkzVX-0003R0-Eu for qemu-devel@nongnu.org; Tue, 09 Jul 2019 19:26:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37442) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hkzVD-00030x-OT; Tue, 09 Jul 2019 19:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B238430C31B4; Tue, 9 Jul 2019 23:26:25 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-215.bos.redhat.com [10.18.17.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D0265B80B; Tue, 9 Jul 2019 23:26:24 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Tue, 9 Jul 2019 19:25:48 -0400 Message-Id: <20190709232550.10724-17-jsnow@redhat.com> In-Reply-To: <20190709232550.10724-1-jsnow@redhat.com> References: <20190709232550.10724-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 09 Jul 2019 23:26:25 +0000 (UTC) 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] [PATCH v4 16/18] iotests: Add virtio-scsi device helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , vsementsov@virtuozzo.com, Juan Quintela , John Snow , Xie Changlong , "Dr. David Alan Gilbert" , Max Reitz , Stefan Hajnoczi , Wen Congyang , Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Seems that it comes up enough. Signed-off-by: John Snow Reviewed-by: Max Reitz --- tests/qemu-iotests/040 | 6 +----- tests/qemu-iotests/093 | 6 ++---- tests/qemu-iotests/139 | 7 ++----- tests/qemu-iotests/238 | 5 +---- tests/qemu-iotests/iotests.py | 4 ++++ 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index b81133a474..657b37103c 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -85,11 +85,7 @@ class TestSingleDrive(ImageCommitTestCase): qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img) self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none") - if iotests.qemu_default_machine == 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw") - else: - self.vm.add_device("virtio-scsi-pci") - + self.vm.add_device(iotests.get_virtio_scsi_device()) self.vm.add_device("scsi-hd,id=scsi0,drive=drive0") self.vm.launch() diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index d88fbc182e..46153220f8 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -366,10 +366,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase): class ThrottleTestRemovableMedia(iotests.QMPTestCase): def setUp(self): self.vm = iotests.VM() - if iotests.qemu_default_machine == 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi") - else: - self.vm.add_device("virtio-scsi-pci,id=virtio-scsi") + self.vm.add_device("{},id=virtio-scsi".format( + iotests.get_virtio_scsi_device())) self.vm.launch() def tearDown(self): diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index 933b45121a..2176ea51ba 100755 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -35,11 +35,8 @@ class TestBlockdevDel(iotests.QMPTestCase): def setUp(self): iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M') self.vm = iotests.VM() - if iotests.qemu_default_machine == 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi") - else: - self.vm.add_device("virtio-scsi-pci,id=virtio-scsi") - + self.vm.add_device("{},id=virtio-scsi".format( + iotests.get_virtio_scsi_device())) self.vm.launch() def tearDown(self): diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238 index 1c0a46fa90..387a77b2cd 100755 --- a/tests/qemu-iotests/238 +++ b/tests/qemu-iotests/238 @@ -23,10 +23,7 @@ import os import iotests from iotests import log -if iotests.qemu_default_machine == 's390-ccw-virtio': - virtio_scsi_device = 'virtio-scsi-ccw' -else: - virtio_scsi_device = 'virtio-scsi-pci' +virtio_scsi_device = iotests.get_virtio_scsi_device() vm = iotests.VM() vm.launch() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6135c9663d..8ae7bc353e 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -164,6 +164,10 @@ def qemu_io_silent(*args): (-exitcode, ' '.join(args))) return exitcode +def get_virtio_scsi_device(): + if qemu_default_machine == 's390-ccw-virtio': + return 'virtio-scsi-ccw' + return 'virtio-scsi-pci' class QemuIoInteractive: def __init__(self, *args):