qemu-iotests: Test unplug of -device without drive

This caused an assertion failure until recently because the BlockBackend
would be detached on unplug, but was in fact never attached in the first
place. Add a regression test.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Kevin Wolf 2017-07-12 13:53:03 +02:00
parent e1824e585f
commit 208c38e4e4
2 changed files with 52 additions and 0 deletions

View File

@ -137,6 +137,19 @@ run_qemu <<EOF
{ "execute": "quit" }
EOF
echo
echo === Empty drive with -device and device_del ===
echo
run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
{ "execute": "qmp_capabilities" }
{ "execute": "query-block" }
{ "execute": "device_del", "arguments": { "id": "cd0" } }
{ "execute": "system_reset" }
{ "execute": "query-block" }
{ "execute": "quit" }
EOF
# success, all done
echo "*** done"
rm -f $seq.full

View File

@ -416,4 +416,43 @@ Testing:
"return": {
}
}
=== Empty drive with -device and device_del ===
Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
{
QMP_VERSION
}
{
"return": {
}
}
{
"return": [
{
"device": "",
"locked": false,
"removable": true,
"qdev": "cd0",
"tray_open": false,
"type": "unknown"
}
]
}
{
"return": {
}
}
{
"return": {
}
}
{
"return": [
]
}
{
"return": {
}
}
*** done