Commit 208c38e4 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
parent e1824e58
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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
+39 −0
Original line number Diff line number Diff line
@@ -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