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