xref: /qemu/tests/qemu-iotests/238 (revision a6862418fec40727b392c86dc13d9ec980efcb15)
1202277f4SStefan Hajnoczi#!/usr/bin/env python
2202277f4SStefan Hajnoczi#
3202277f4SStefan Hajnoczi# Regression test for throttle group member unregister segfault with iothread
4202277f4SStefan Hajnoczi#
5202277f4SStefan Hajnoczi# Copyright (c) 2019 Red Hat, Inc.
6202277f4SStefan Hajnoczi#
7202277f4SStefan Hajnoczi# This program is free software; you can redistribute it and/or modify
8202277f4SStefan Hajnoczi# it under the terms of the GNU General Public License as published by
9202277f4SStefan Hajnoczi# the Free Software Foundation; either version 2 of the License, or
10202277f4SStefan Hajnoczi# (at your option) any later version.
11202277f4SStefan Hajnoczi#
12202277f4SStefan Hajnoczi# This program is distributed in the hope that it will be useful,
13202277f4SStefan Hajnoczi# but WITHOUT ANY WARRANTY; without even the implied warranty of
14202277f4SStefan Hajnoczi# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15202277f4SStefan Hajnoczi# GNU General Public License for more details.
16202277f4SStefan Hajnoczi#
17202277f4SStefan Hajnoczi# You should have received a copy of the GNU General Public License
18202277f4SStefan Hajnoczi# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19202277f4SStefan Hajnoczi#
20202277f4SStefan Hajnoczi
21202277f4SStefan Hajnocziimport sys
22202277f4SStefan Hajnocziimport os
23202277f4SStefan Hajnocziimport iotests
24202277f4SStefan Hajnoczifrom iotests import log
25202277f4SStefan Hajnoczi
26202277f4SStefan Hajnocziif iotests.qemu_default_machine == 's390-ccw-virtio':
27202277f4SStefan Hajnoczi    virtio_scsi_device = 'virtio-scsi-ccw'
28202277f4SStefan Hajnoczielse:
29202277f4SStefan Hajnoczi    virtio_scsi_device = 'virtio-scsi-pci'
30202277f4SStefan Hajnoczi
31b74b1adeSStefan Hajnoczivm = iotests.VM()
32202277f4SStefan Hajnoczivm.launch()
33202277f4SStefan Hajnoczi
34*a6862418SAndrey Shinkevichlog(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
35202277f4SStefan Hajnoczilog(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
36202277f4SStefan Hajnoczilog(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
37202277f4SStefan Hajnoczilog(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
38202277f4SStefan Hajnoczilog(vm.qmp('block_set_io_throttle', id='scsi-hd0', bps=0, bps_rd=0, bps_wr=0,
39202277f4SStefan Hajnoczi           iops=1000, iops_rd=0, iops_wr=0, conv_keys=False))
40202277f4SStefan Hajnoczilog(vm.qmp('device_del', id='scsi-hd0'))
41202277f4SStefan Hajnoczi
42202277f4SStefan Hajnoczivm.shutdown()
43