List, Paolo Please find a small patch that adds a new "drive" keyword "removable". When used together with SCSI DISK devices, this makes the emulation support removable scsi disk.
Example: -drive file=./scsi-disk.img,if=scsi,removable Emulation of SCSI DISK with removable media currently pass all my tests for SCSI removable media and behaviour of STARTSTOPUNIT/ALLOWPREVENTMEDIUMREMOVAL commands : iscsi-test --dataloss --test="*prevent*eject*" iscsi://127.0.0.1:32601/iqn.qemu.scsi-test/3 0381_preventallow_eject: ======================== Try to set PREVENTALLOW ... [OK] Try to eject the media ... Eject failed. [OK] Load the media again in case it was ejected ... [OK] Clear the PREVENTALLOW again ... [OK] TEST T0381_preventallow_eject [OK] iscsi-test --dataloss --test="*nomedia*" iscsi://127.0.0.1:32601/iqn.qemu.scsi-test/3 0370_nomedia: ============ Try to eject the media ... [OK] Test TESTUNITREADY ... [OK] Test SYNCHRONIZECACHE10 ... [OK] Test SYNCHRONIZECACHE16 ... [OK] Test READ10 ... [OK] Test READ12 ... [OK] Test READ16 ... [OK] Test READCAPACITY10 ... [OK] Test READCAPACITY16 ... [OK] Test GETLBASTATUS ... [OK] Test PREFETCH10 ... [OK] Test PREFETCH16 ... [OK] Test VERIFY10 ... [OK] Test VERIFY12 ... [OK] Test VERIFY16 ... [OK] Test WRITE10 ... [OK] Test WRITE12 ... [OK] Test WRITE16 ... [OK] Test WRITEVERIFY10 ... [OK] Test WRITEVERIFY12 ... [OK] Test WRITEVERIFY16 ... [OK] Test ORWRITE ... [OK] Test COMPAREWRITE ... [OK] Test WRITESAME10 ... [OK] Test WRITESAME16 ... [OK] Test UNMAP ... [OK] Try to mount the media again ... [OK] TEST T0370_nomedia [OK]