mirror of https://gitee.com/openkylin/qemu.git
iotests: Add virtio-scsi device helper
Seems that it comes up enough. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20190709232550.10724-17-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
de263986b5
commit
f357576fa9
|
@ -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()
|
||||
self.has_quit = False
|
||||
|
|
|
@ -367,10 +367,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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue