1*adfe2030SMax Reitz#!/usr/bin/env python 2*adfe2030SMax Reitz# 3*adfe2030SMax Reitz# Test case for the QMP 'change' command and all other associated 4*adfe2030SMax Reitz# commands 5*adfe2030SMax Reitz# 6*adfe2030SMax Reitz# Copyright (C) 2015 Red Hat, Inc. 7*adfe2030SMax Reitz# 8*adfe2030SMax Reitz# This program is free software; you can redistribute it and/or modify 9*adfe2030SMax Reitz# it under the terms of the GNU General Public License as published by 10*adfe2030SMax Reitz# the Free Software Foundation; either version 2 of the License, or 11*adfe2030SMax Reitz# (at your option) any later version. 12*adfe2030SMax Reitz# 13*adfe2030SMax Reitz# This program is distributed in the hope that it will be useful, 14*adfe2030SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 15*adfe2030SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*adfe2030SMax Reitz# GNU General Public License for more details. 17*adfe2030SMax Reitz# 18*adfe2030SMax Reitz# You should have received a copy of the GNU General Public License 19*adfe2030SMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 20*adfe2030SMax Reitz# 21*adfe2030SMax Reitz 22*adfe2030SMax Reitzimport os 23*adfe2030SMax Reitzimport stat 24*adfe2030SMax Reitzimport time 25*adfe2030SMax Reitzimport iotests 26*adfe2030SMax Reitzfrom iotests import qemu_img 27*adfe2030SMax Reitz 28*adfe2030SMax Reitzold_img = os.path.join(iotests.test_dir, 'test0.img') 29*adfe2030SMax Reitznew_img = os.path.join(iotests.test_dir, 'test1.img') 30*adfe2030SMax Reitz 31*adfe2030SMax Reitzclass ChangeBaseClass(iotests.QMPTestCase): 32*adfe2030SMax Reitz has_opened = False 33*adfe2030SMax Reitz has_closed = False 34*adfe2030SMax Reitz 35*adfe2030SMax Reitz def process_events(self): 36*adfe2030SMax Reitz for event in self.vm.get_qmp_events(wait=False): 37*adfe2030SMax Reitz if (event['event'] == 'DEVICE_TRAY_MOVED' and 38*adfe2030SMax Reitz event['data']['device'] == 'drive0'): 39*adfe2030SMax Reitz if event['data']['tray-open'] == False: 40*adfe2030SMax Reitz self.has_closed = True 41*adfe2030SMax Reitz else: 42*adfe2030SMax Reitz self.has_opened = True 43*adfe2030SMax Reitz 44*adfe2030SMax Reitz def wait_for_open(self): 45*adfe2030SMax Reitz timeout = time.clock() + 3 46*adfe2030SMax Reitz while not self.has_opened and time.clock() < timeout: 47*adfe2030SMax Reitz self.process_events() 48*adfe2030SMax Reitz if not self.has_opened: 49*adfe2030SMax Reitz self.fail('Timeout while waiting for the tray to open') 50*adfe2030SMax Reitz 51*adfe2030SMax Reitz def wait_for_close(self): 52*adfe2030SMax Reitz timeout = time.clock() + 3 53*adfe2030SMax Reitz while not self.has_closed and time.clock() < timeout: 54*adfe2030SMax Reitz self.process_events() 55*adfe2030SMax Reitz if not self.has_opened: 56*adfe2030SMax Reitz self.fail('Timeout while waiting for the tray to close') 57*adfe2030SMax Reitz 58*adfe2030SMax Reitzclass GeneralChangeTestsBaseClass(ChangeBaseClass): 59*adfe2030SMax Reitz def test_change(self): 60*adfe2030SMax Reitz result = self.vm.qmp('change', device='drive0', target=new_img, 61*adfe2030SMax Reitz arg=iotests.imgfmt) 62*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 63*adfe2030SMax Reitz 64*adfe2030SMax Reitz self.wait_for_open() 65*adfe2030SMax Reitz self.wait_for_close() 66*adfe2030SMax Reitz 67*adfe2030SMax Reitz result = self.vm.qmp('query-block') 68*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 69*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 70*adfe2030SMax Reitz 71*adfe2030SMax Reitz def test_blockdev_change_medium(self): 72*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 73*adfe2030SMax Reitz filename=new_img, 74*adfe2030SMax Reitz format=iotests.imgfmt) 75*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 76*adfe2030SMax Reitz 77*adfe2030SMax Reitz self.wait_for_open() 78*adfe2030SMax Reitz self.wait_for_close() 79*adfe2030SMax Reitz 80*adfe2030SMax Reitz result = self.vm.qmp('query-block') 81*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 82*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 83*adfe2030SMax Reitz 84*adfe2030SMax Reitz def test_eject(self): 85*adfe2030SMax Reitz result = self.vm.qmp('eject', device='drive0', force=True) 86*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 87*adfe2030SMax Reitz 88*adfe2030SMax Reitz self.wait_for_open() 89*adfe2030SMax Reitz 90*adfe2030SMax Reitz result = self.vm.qmp('query-block') 91*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 92*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 93*adfe2030SMax Reitz 94*adfe2030SMax Reitz def test_tray_eject_change(self): 95*adfe2030SMax Reitz result = self.vm.qmp('eject', device='drive0', force=True) 96*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 97*adfe2030SMax Reitz 98*adfe2030SMax Reitz self.wait_for_open() 99*adfe2030SMax Reitz 100*adfe2030SMax Reitz result = self.vm.qmp('query-block') 101*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 102*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 103*adfe2030SMax Reitz 104*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 105*adfe2030SMax Reitz filename=new_img, 106*adfe2030SMax Reitz format=iotests.imgfmt) 107*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 108*adfe2030SMax Reitz 109*adfe2030SMax Reitz self.wait_for_close() 110*adfe2030SMax Reitz 111*adfe2030SMax Reitz result = self.vm.qmp('query-block') 112*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 113*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 114*adfe2030SMax Reitz 115*adfe2030SMax Reitz def test_tray_open_close(self): 116*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True) 117*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 118*adfe2030SMax Reitz 119*adfe2030SMax Reitz self.wait_for_open() 120*adfe2030SMax Reitz 121*adfe2030SMax Reitz result = self.vm.qmp('query-block') 122*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 123*adfe2030SMax Reitz if self.was_empty == True: 124*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 125*adfe2030SMax Reitz else: 126*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 127*adfe2030SMax Reitz 128*adfe2030SMax Reitz result = self.vm.qmp('blockdev-close-tray', device='drive0') 129*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 130*adfe2030SMax Reitz 131*adfe2030SMax Reitz if self.has_real_tray or not self.was_empty: 132*adfe2030SMax Reitz self.wait_for_close() 133*adfe2030SMax Reitz 134*adfe2030SMax Reitz result = self.vm.qmp('query-block') 135*adfe2030SMax Reitz if self.has_real_tray or not self.was_empty: 136*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 137*adfe2030SMax Reitz else: 138*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 139*adfe2030SMax Reitz if self.was_empty == True: 140*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 141*adfe2030SMax Reitz else: 142*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 143*adfe2030SMax Reitz 144*adfe2030SMax Reitz def test_tray_eject_close(self): 145*adfe2030SMax Reitz result = self.vm.qmp('eject', device='drive0', force=True) 146*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 147*adfe2030SMax Reitz 148*adfe2030SMax Reitz self.wait_for_open() 149*adfe2030SMax Reitz 150*adfe2030SMax Reitz result = self.vm.qmp('query-block') 151*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 152*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 153*adfe2030SMax Reitz 154*adfe2030SMax Reitz result = self.vm.qmp('blockdev-close-tray', device='drive0') 155*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 156*adfe2030SMax Reitz 157*adfe2030SMax Reitz if self.has_real_tray: 158*adfe2030SMax Reitz self.wait_for_close() 159*adfe2030SMax Reitz 160*adfe2030SMax Reitz result = self.vm.qmp('query-block') 161*adfe2030SMax Reitz if self.has_real_tray: 162*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 163*adfe2030SMax Reitz else: 164*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 165*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 166*adfe2030SMax Reitz 167*adfe2030SMax Reitz def test_tray_open_change(self): 168*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True) 169*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 170*adfe2030SMax Reitz 171*adfe2030SMax Reitz self.wait_for_open() 172*adfe2030SMax Reitz 173*adfe2030SMax Reitz result = self.vm.qmp('query-block') 174*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 175*adfe2030SMax Reitz if self.was_empty == True: 176*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 177*adfe2030SMax Reitz else: 178*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 179*adfe2030SMax Reitz 180*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 181*adfe2030SMax Reitz filename=new_img, 182*adfe2030SMax Reitz format=iotests.imgfmt) 183*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 184*adfe2030SMax Reitz 185*adfe2030SMax Reitz self.wait_for_close() 186*adfe2030SMax Reitz 187*adfe2030SMax Reitz result = self.vm.qmp('query-block') 188*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 189*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 190*adfe2030SMax Reitz 191*adfe2030SMax Reitz def test_cycle(self): 192*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 193*adfe2030SMax Reitz options={'node-name': 'new', 194*adfe2030SMax Reitz 'driver': iotests.imgfmt, 195*adfe2030SMax Reitz 'file': {'filename': new_img, 196*adfe2030SMax Reitz 'driver': 'file'}}) 197*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 198*adfe2030SMax Reitz 199*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True) 200*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 201*adfe2030SMax Reitz 202*adfe2030SMax Reitz self.wait_for_open() 203*adfe2030SMax Reitz 204*adfe2030SMax Reitz result = self.vm.qmp('query-block') 205*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 206*adfe2030SMax Reitz if self.was_empty == True: 207*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 208*adfe2030SMax Reitz else: 209*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 210*adfe2030SMax Reitz 211*adfe2030SMax Reitz result = self.vm.qmp('blockdev-remove-medium', device='drive0') 212*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 213*adfe2030SMax Reitz 214*adfe2030SMax Reitz result = self.vm.qmp('query-block') 215*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 216*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 217*adfe2030SMax Reitz 218*adfe2030SMax Reitz result = self.vm.qmp('blockdev-insert-medium', device='drive0', 219*adfe2030SMax Reitz node_name='new') 220*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 221*adfe2030SMax Reitz 222*adfe2030SMax Reitz result = self.vm.qmp('query-block') 223*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 224*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 225*adfe2030SMax Reitz 226*adfe2030SMax Reitz result = self.vm.qmp('blockdev-close-tray', device='drive0') 227*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 228*adfe2030SMax Reitz 229*adfe2030SMax Reitz self.wait_for_close() 230*adfe2030SMax Reitz 231*adfe2030SMax Reitz result = self.vm.qmp('query-block') 232*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 233*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 234*adfe2030SMax Reitz 235*adfe2030SMax Reitz def test_close_on_closed(self): 236*adfe2030SMax Reitz result = self.vm.qmp('blockdev-close-tray', device='drive0') 237*adfe2030SMax Reitz # Should be a no-op 238*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 239*adfe2030SMax Reitz self.assertEquals(self.vm.get_qmp_events(wait=False), []) 240*adfe2030SMax Reitz 241*adfe2030SMax Reitz def test_remove_on_closed(self): 242*adfe2030SMax Reitz if self.has_opened: 243*adfe2030SMax Reitz # Empty floppy drive 244*adfe2030SMax Reitz return 245*adfe2030SMax Reitz 246*adfe2030SMax Reitz result = self.vm.qmp('blockdev-remove-medium', device='drive0') 247*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 248*adfe2030SMax Reitz 249*adfe2030SMax Reitz def test_insert_on_closed(self): 250*adfe2030SMax Reitz if self.has_opened: 251*adfe2030SMax Reitz # Empty floppy drive 252*adfe2030SMax Reitz return 253*adfe2030SMax Reitz 254*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 255*adfe2030SMax Reitz options={'node-name': 'new', 256*adfe2030SMax Reitz 'driver': iotests.imgfmt, 257*adfe2030SMax Reitz 'file': {'filename': new_img, 258*adfe2030SMax Reitz 'driver': 'file'}}) 259*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 260*adfe2030SMax Reitz 261*adfe2030SMax Reitz result = self.vm.qmp('blockdev-insert-medium', device='drive0', 262*adfe2030SMax Reitz node_name='new') 263*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 264*adfe2030SMax Reitz 265*adfe2030SMax Reitzclass TestInitiallyFilled(GeneralChangeTestsBaseClass): 266*adfe2030SMax Reitz was_empty = False 267*adfe2030SMax Reitz 268*adfe2030SMax Reitz def setUp(self, media, interface): 269*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k') 270*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') 271*adfe2030SMax Reitz self.vm = iotests.VM().add_drive(old_img, 'media=%s' % media, interface) 272*adfe2030SMax Reitz self.vm.launch() 273*adfe2030SMax Reitz 274*adfe2030SMax Reitz def tearDown(self): 275*adfe2030SMax Reitz self.vm.shutdown() 276*adfe2030SMax Reitz os.remove(old_img) 277*adfe2030SMax Reitz os.remove(new_img) 278*adfe2030SMax Reitz 279*adfe2030SMax Reitz def test_insert_on_filled(self): 280*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 281*adfe2030SMax Reitz options={'node-name': 'new', 282*adfe2030SMax Reitz 'driver': iotests.imgfmt, 283*adfe2030SMax Reitz 'file': {'filename': new_img, 284*adfe2030SMax Reitz 'driver': 'file'}}) 285*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 286*adfe2030SMax Reitz 287*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0') 288*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 289*adfe2030SMax Reitz 290*adfe2030SMax Reitz self.wait_for_open() 291*adfe2030SMax Reitz 292*adfe2030SMax Reitz result = self.vm.qmp('blockdev-insert-medium', device='drive0', 293*adfe2030SMax Reitz node_name='new') 294*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 295*adfe2030SMax Reitz 296*adfe2030SMax Reitzclass TestInitiallyEmpty(GeneralChangeTestsBaseClass): 297*adfe2030SMax Reitz was_empty = True 298*adfe2030SMax Reitz 299*adfe2030SMax Reitz def setUp(self, media, interface): 300*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') 301*adfe2030SMax Reitz self.vm = iotests.VM().add_drive(None, 'media=%s' % media, interface) 302*adfe2030SMax Reitz self.vm.launch() 303*adfe2030SMax Reitz 304*adfe2030SMax Reitz def tearDown(self): 305*adfe2030SMax Reitz self.vm.shutdown() 306*adfe2030SMax Reitz os.remove(new_img) 307*adfe2030SMax Reitz 308*adfe2030SMax Reitz def test_remove_on_empty(self): 309*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0') 310*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 311*adfe2030SMax Reitz 312*adfe2030SMax Reitz self.wait_for_open() 313*adfe2030SMax Reitz 314*adfe2030SMax Reitz result = self.vm.qmp('blockdev-remove-medium', device='drive0') 315*adfe2030SMax Reitz # Should be a no-op 316*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 317*adfe2030SMax Reitz 318*adfe2030SMax Reitzclass TestCDInitiallyFilled(TestInitiallyFilled): 319*adfe2030SMax Reitz TestInitiallyFilled = TestInitiallyFilled 320*adfe2030SMax Reitz has_real_tray = True 321*adfe2030SMax Reitz 322*adfe2030SMax Reitz def setUp(self): 323*adfe2030SMax Reitz self.TestInitiallyFilled.setUp(self, 'cdrom', 'ide') 324*adfe2030SMax Reitz 325*adfe2030SMax Reitzclass TestCDInitiallyEmpty(TestInitiallyEmpty): 326*adfe2030SMax Reitz TestInitiallyEmpty = TestInitiallyEmpty 327*adfe2030SMax Reitz has_real_tray = True 328*adfe2030SMax Reitz 329*adfe2030SMax Reitz def setUp(self): 330*adfe2030SMax Reitz self.TestInitiallyEmpty.setUp(self, 'cdrom', 'ide') 331*adfe2030SMax Reitz 332*adfe2030SMax Reitzclass TestFloppyInitiallyFilled(TestInitiallyFilled): 333*adfe2030SMax Reitz TestInitiallyFilled = TestInitiallyFilled 334*adfe2030SMax Reitz has_real_tray = False 335*adfe2030SMax Reitz 336*adfe2030SMax Reitz def setUp(self): 337*adfe2030SMax Reitz self.TestInitiallyFilled.setUp(self, 'disk', 'floppy') 338*adfe2030SMax Reitz 339*adfe2030SMax Reitzclass TestFloppyInitiallyEmpty(TestInitiallyEmpty): 340*adfe2030SMax Reitz TestInitiallyEmpty = TestInitiallyEmpty 341*adfe2030SMax Reitz has_real_tray = False 342*adfe2030SMax Reitz 343*adfe2030SMax Reitz def setUp(self): 344*adfe2030SMax Reitz self.TestInitiallyEmpty.setUp(self, 'disk', 'floppy') 345*adfe2030SMax Reitz # FDDs not having a real tray and there not being a medium inside the 346*adfe2030SMax Reitz # tray at startup means the tray will be considered open 347*adfe2030SMax Reitz self.has_opened = True 348*adfe2030SMax Reitz 349*adfe2030SMax Reitzclass TestChangeReadOnly(ChangeBaseClass): 350*adfe2030SMax Reitz def setUp(self): 351*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k') 352*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') 353*adfe2030SMax Reitz self.vm = iotests.VM() 354*adfe2030SMax Reitz 355*adfe2030SMax Reitz def tearDown(self): 356*adfe2030SMax Reitz self.vm.shutdown() 357*adfe2030SMax Reitz os.chmod(old_img, 0666) 358*adfe2030SMax Reitz os.chmod(new_img, 0666) 359*adfe2030SMax Reitz os.remove(old_img) 360*adfe2030SMax Reitz os.remove(new_img) 361*adfe2030SMax Reitz 362*adfe2030SMax Reitz def test_ro_ro_retain(self): 363*adfe2030SMax Reitz os.chmod(old_img, 0444) 364*adfe2030SMax Reitz os.chmod(new_img, 0444) 365*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy') 366*adfe2030SMax Reitz self.vm.launch() 367*adfe2030SMax Reitz 368*adfe2030SMax Reitz result = self.vm.qmp('query-block') 369*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 370*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 371*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 372*adfe2030SMax Reitz 373*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 374*adfe2030SMax Reitz filename=new_img, 375*adfe2030SMax Reitz format=iotests.imgfmt, 376*adfe2030SMax Reitz read_only_mode='retain') 377*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 378*adfe2030SMax Reitz 379*adfe2030SMax Reitz self.wait_for_open() 380*adfe2030SMax Reitz self.wait_for_close() 381*adfe2030SMax Reitz 382*adfe2030SMax Reitz result = self.vm.qmp('query-block') 383*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 384*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 385*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 386*adfe2030SMax Reitz 387*adfe2030SMax Reitz def test_ro_rw_retain(self): 388*adfe2030SMax Reitz os.chmod(old_img, 0444) 389*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy') 390*adfe2030SMax Reitz self.vm.launch() 391*adfe2030SMax Reitz 392*adfe2030SMax Reitz result = self.vm.qmp('query-block') 393*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 394*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 395*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 396*adfe2030SMax Reitz 397*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 398*adfe2030SMax Reitz filename=new_img, 399*adfe2030SMax Reitz format=iotests.imgfmt, 400*adfe2030SMax Reitz read_only_mode='retain') 401*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 402*adfe2030SMax Reitz 403*adfe2030SMax Reitz self.wait_for_open() 404*adfe2030SMax Reitz self.wait_for_close() 405*adfe2030SMax Reitz 406*adfe2030SMax Reitz result = self.vm.qmp('query-block') 407*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 408*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 409*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 410*adfe2030SMax Reitz 411*adfe2030SMax Reitz def test_rw_ro_retain(self): 412*adfe2030SMax Reitz os.chmod(new_img, 0444) 413*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 414*adfe2030SMax Reitz self.vm.launch() 415*adfe2030SMax Reitz 416*adfe2030SMax Reitz result = self.vm.qmp('query-block') 417*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 418*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 419*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 420*adfe2030SMax Reitz 421*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 422*adfe2030SMax Reitz filename=new_img, 423*adfe2030SMax Reitz format=iotests.imgfmt, 424*adfe2030SMax Reitz read_only_mode='retain') 425*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 426*adfe2030SMax Reitz 427*adfe2030SMax Reitz self.assertEquals(self.vm.get_qmp_events(wait=False), []) 428*adfe2030SMax Reitz 429*adfe2030SMax Reitz result = self.vm.qmp('query-block') 430*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 431*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 432*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 433*adfe2030SMax Reitz 434*adfe2030SMax Reitz def test_ro_rw(self): 435*adfe2030SMax Reitz os.chmod(old_img, 0444) 436*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy') 437*adfe2030SMax Reitz self.vm.launch() 438*adfe2030SMax Reitz 439*adfe2030SMax Reitz result = self.vm.qmp('query-block') 440*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 441*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 442*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 443*adfe2030SMax Reitz 444*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', 445*adfe2030SMax Reitz device='drive0', 446*adfe2030SMax Reitz filename=new_img, 447*adfe2030SMax Reitz format=iotests.imgfmt, 448*adfe2030SMax Reitz read_only_mode='read-write') 449*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 450*adfe2030SMax Reitz 451*adfe2030SMax Reitz self.wait_for_open() 452*adfe2030SMax Reitz self.wait_for_close() 453*adfe2030SMax Reitz 454*adfe2030SMax Reitz result = self.vm.qmp('query-block') 455*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 456*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 457*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 458*adfe2030SMax Reitz 459*adfe2030SMax Reitz def test_rw_ro(self): 460*adfe2030SMax Reitz os.chmod(new_img, 0444) 461*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 462*adfe2030SMax Reitz self.vm.launch() 463*adfe2030SMax Reitz 464*adfe2030SMax Reitz result = self.vm.qmp('query-block') 465*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 466*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 467*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 468*adfe2030SMax Reitz 469*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', 470*adfe2030SMax Reitz device='drive0', 471*adfe2030SMax Reitz filename=new_img, 472*adfe2030SMax Reitz format=iotests.imgfmt, 473*adfe2030SMax Reitz read_only_mode='read-only') 474*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 475*adfe2030SMax Reitz 476*adfe2030SMax Reitz self.wait_for_open() 477*adfe2030SMax Reitz self.wait_for_close() 478*adfe2030SMax Reitz 479*adfe2030SMax Reitz result = self.vm.qmp('query-block') 480*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 481*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 482*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 483*adfe2030SMax Reitz 484*adfe2030SMax Reitz def test_make_rw_ro(self): 485*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 486*adfe2030SMax Reitz self.vm.launch() 487*adfe2030SMax Reitz 488*adfe2030SMax Reitz result = self.vm.qmp('query-block') 489*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 490*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 491*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 492*adfe2030SMax Reitz 493*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', 494*adfe2030SMax Reitz device='drive0', 495*adfe2030SMax Reitz filename=new_img, 496*adfe2030SMax Reitz format=iotests.imgfmt, 497*adfe2030SMax Reitz read_only_mode='read-only') 498*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 499*adfe2030SMax Reitz 500*adfe2030SMax Reitz self.wait_for_open() 501*adfe2030SMax Reitz self.wait_for_close() 502*adfe2030SMax Reitz 503*adfe2030SMax Reitz result = self.vm.qmp('query-block') 504*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 505*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 506*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 507*adfe2030SMax Reitz 508*adfe2030SMax Reitz def test_make_ro_rw(self): 509*adfe2030SMax Reitz os.chmod(new_img, 0444) 510*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 511*adfe2030SMax Reitz self.vm.launch() 512*adfe2030SMax Reitz 513*adfe2030SMax Reitz result = self.vm.qmp('query-block') 514*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 515*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 516*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 517*adfe2030SMax Reitz 518*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', 519*adfe2030SMax Reitz device='drive0', 520*adfe2030SMax Reitz filename=new_img, 521*adfe2030SMax Reitz format=iotests.imgfmt, 522*adfe2030SMax Reitz read_only_mode='read-write') 523*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 524*adfe2030SMax Reitz 525*adfe2030SMax Reitz self.assertEquals(self.vm.get_qmp_events(wait=False), []) 526*adfe2030SMax Reitz 527*adfe2030SMax Reitz result = self.vm.qmp('query-block') 528*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 529*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 530*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 531*adfe2030SMax Reitz 532*adfe2030SMax Reitz def test_make_rw_ro_by_retain(self): 533*adfe2030SMax Reitz os.chmod(old_img, 0444) 534*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy') 535*adfe2030SMax Reitz self.vm.launch() 536*adfe2030SMax Reitz 537*adfe2030SMax Reitz result = self.vm.qmp('query-block') 538*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 539*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 540*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 541*adfe2030SMax Reitz 542*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 543*adfe2030SMax Reitz filename=new_img, 544*adfe2030SMax Reitz format=iotests.imgfmt, 545*adfe2030SMax Reitz read_only_mode='retain') 546*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 547*adfe2030SMax Reitz 548*adfe2030SMax Reitz self.wait_for_open() 549*adfe2030SMax Reitz self.wait_for_close() 550*adfe2030SMax Reitz 551*adfe2030SMax Reitz result = self.vm.qmp('query-block') 552*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 553*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 554*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 555*adfe2030SMax Reitz 556*adfe2030SMax Reitz def test_make_ro_rw_by_retain(self): 557*adfe2030SMax Reitz os.chmod(new_img, 0444) 558*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 559*adfe2030SMax Reitz self.vm.launch() 560*adfe2030SMax Reitz 561*adfe2030SMax Reitz result = self.vm.qmp('query-block') 562*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 563*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 564*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 565*adfe2030SMax Reitz 566*adfe2030SMax Reitz result = self.vm.qmp('blockdev-change-medium', device='drive0', 567*adfe2030SMax Reitz filename=new_img, 568*adfe2030SMax Reitz format=iotests.imgfmt, 569*adfe2030SMax Reitz read_only_mode='retain') 570*adfe2030SMax Reitz self.assert_qmp(result, 'error/class', 'GenericError') 571*adfe2030SMax Reitz 572*adfe2030SMax Reitz self.assertEquals(self.vm.get_qmp_events(wait=False), []) 573*adfe2030SMax Reitz 574*adfe2030SMax Reitz result = self.vm.qmp('query-block') 575*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 576*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 577*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 578*adfe2030SMax Reitz 579*adfe2030SMax Reitz def test_rw_ro_cycle(self): 580*adfe2030SMax Reitz os.chmod(new_img, 0444) 581*adfe2030SMax Reitz self.vm.add_drive(old_img, 'media=disk', 'floppy') 582*adfe2030SMax Reitz self.vm.launch() 583*adfe2030SMax Reitz 584*adfe2030SMax Reitz result = self.vm.qmp('query-block') 585*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 586*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 587*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 588*adfe2030SMax Reitz 589*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 590*adfe2030SMax Reitz options={'node-name': 'new', 591*adfe2030SMax Reitz 'driver': iotests.imgfmt, 592*adfe2030SMax Reitz 'read-only': True, 593*adfe2030SMax Reitz 'file': {'filename': new_img, 594*adfe2030SMax Reitz 'driver': 'file'}}) 595*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 596*adfe2030SMax Reitz 597*adfe2030SMax Reitz result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True) 598*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 599*adfe2030SMax Reitz 600*adfe2030SMax Reitz self.wait_for_open() 601*adfe2030SMax Reitz 602*adfe2030SMax Reitz result = self.vm.qmp('query-block') 603*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 604*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', False) 605*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 606*adfe2030SMax Reitz 607*adfe2030SMax Reitz result = self.vm.qmp('blockdev-remove-medium', device='drive0') 608*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 609*adfe2030SMax Reitz 610*adfe2030SMax Reitz result = self.vm.qmp('query-block') 611*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 612*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 613*adfe2030SMax Reitz 614*adfe2030SMax Reitz result = self.vm.qmp('blockdev-insert-medium', device='drive0', 615*adfe2030SMax Reitz node_name='new') 616*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 617*adfe2030SMax Reitz 618*adfe2030SMax Reitz result = self.vm.qmp('query-block') 619*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', True) 620*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 621*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 622*adfe2030SMax Reitz 623*adfe2030SMax Reitz result = self.vm.qmp('blockdev-close-tray', device='drive0') 624*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 625*adfe2030SMax Reitz 626*adfe2030SMax Reitz self.wait_for_close() 627*adfe2030SMax Reitz 628*adfe2030SMax Reitz result = self.vm.qmp('query-block') 629*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 630*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/ro', True) 631*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 632*adfe2030SMax Reitz 633*adfe2030SMax ReitzGeneralChangeTestsBaseClass = None 634*adfe2030SMax ReitzTestInitiallyFilled = None 635*adfe2030SMax ReitzTestInitiallyEmpty = None 636*adfe2030SMax Reitz 637*adfe2030SMax Reitz 638*adfe2030SMax Reitzclass TestBlockJobsAfterCycle(ChangeBaseClass): 639*adfe2030SMax Reitz def setUp(self): 640*adfe2030SMax Reitz qemu_img('create', '-f', iotests.imgfmt, old_img, '1M') 641*adfe2030SMax Reitz 642*adfe2030SMax Reitz self.vm = iotests.VM() 643*adfe2030SMax Reitz self.vm.launch() 644*adfe2030SMax Reitz 645*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 646*adfe2030SMax Reitz options={'id': 'drive0', 647*adfe2030SMax Reitz 'driver': 'null-co'}) 648*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 649*adfe2030SMax Reitz 650*adfe2030SMax Reitz result = self.vm.qmp('query-block') 651*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 652*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/format', 'null-co') 653*adfe2030SMax Reitz 654*adfe2030SMax Reitz # For device-less BBs, calling blockdev-open-tray or blockdev-close-tray 655*adfe2030SMax Reitz # is not necessary 656*adfe2030SMax Reitz result = self.vm.qmp('blockdev-remove-medium', device='drive0') 657*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 658*adfe2030SMax Reitz 659*adfe2030SMax Reitz result = self.vm.qmp('query-block') 660*adfe2030SMax Reitz self.assert_qmp_absent(result, 'return[0]/inserted') 661*adfe2030SMax Reitz 662*adfe2030SMax Reitz result = self.vm.qmp('blockdev-add', 663*adfe2030SMax Reitz options={'node-name': 'node0', 664*adfe2030SMax Reitz 'driver': iotests.imgfmt, 665*adfe2030SMax Reitz 'file': {'filename': old_img, 666*adfe2030SMax Reitz 'driver': 'file'}}) 667*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 668*adfe2030SMax Reitz 669*adfe2030SMax Reitz result = self.vm.qmp('blockdev-insert-medium', device='drive0', 670*adfe2030SMax Reitz node_name='node0') 671*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 672*adfe2030SMax Reitz 673*adfe2030SMax Reitz result = self.vm.qmp('query-block') 674*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/tray_open', False) 675*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img) 676*adfe2030SMax Reitz 677*adfe2030SMax Reitz def tearDown(self): 678*adfe2030SMax Reitz self.vm.shutdown() 679*adfe2030SMax Reitz os.remove(old_img) 680*adfe2030SMax Reitz try: 681*adfe2030SMax Reitz os.remove(new_img) 682*adfe2030SMax Reitz except OSError: 683*adfe2030SMax Reitz pass 684*adfe2030SMax Reitz 685*adfe2030SMax Reitz def test_snapshot_and_commit(self): 686*adfe2030SMax Reitz # We need backing file support 687*adfe2030SMax Reitz if iotests.imgfmt != 'qcow2' and iotests.imgfmt != 'qed': 688*adfe2030SMax Reitz return 689*adfe2030SMax Reitz 690*adfe2030SMax Reitz result = self.vm.qmp('blockdev-snapshot-sync', device='drive0', 691*adfe2030SMax Reitz snapshot_file=new_img, 692*adfe2030SMax Reitz format=iotests.imgfmt) 693*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 694*adfe2030SMax Reitz 695*adfe2030SMax Reitz result = self.vm.qmp('query-block') 696*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img) 697*adfe2030SMax Reitz self.assert_qmp(result, 698*adfe2030SMax Reitz 'return[0]/inserted/image/backing-image/filename', 699*adfe2030SMax Reitz old_img) 700*adfe2030SMax Reitz 701*adfe2030SMax Reitz result = self.vm.qmp('block-commit', device='drive0') 702*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 703*adfe2030SMax Reitz 704*adfe2030SMax Reitz self.vm.event_wait(name='BLOCK_JOB_READY') 705*adfe2030SMax Reitz 706*adfe2030SMax Reitz result = self.vm.qmp('query-block-jobs') 707*adfe2030SMax Reitz self.assert_qmp(result, 'return[0]/device', 'drive0') 708*adfe2030SMax Reitz 709*adfe2030SMax Reitz result = self.vm.qmp('block-job-complete', device='drive0') 710*adfe2030SMax Reitz self.assert_qmp(result, 'return', {}) 711*adfe2030SMax Reitz 712*adfe2030SMax Reitz self.vm.event_wait(name='BLOCK_JOB_COMPLETED') 713*adfe2030SMax Reitz 714*adfe2030SMax Reitz 715*adfe2030SMax Reitzif __name__ == '__main__': 716*adfe2030SMax Reitz if iotests.qemu_default_machine != 'pc': 717*adfe2030SMax Reitz # We need floppy and IDE CD-ROM 718*adfe2030SMax Reitz iotests.notrun('not suitable for this machine type: %s' % 719*adfe2030SMax Reitz iotests.qemu_default_machine) 720*adfe2030SMax Reitz iotests.main() 721