Hi, developers,
I have a question about rerror="report". In the qemu manual, it mentions "report the error to the guest". So does it report to qemu too? Can we get the I/O error status from qmp?
I started a test on qemu-kvm-6.2.0 libvirt-8.0.0:
1. Start an nbd server:
~ qemu-nbd /tmp/scsi -t -x nn
2. Start VM with 2 disks. One is nbd disk with rerror="report"
...
-blockdev {"driver":"file","filename":"/var/lib/libvirt/images/rhel.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"} \
-blockdev {"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage","backing":null} \
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=libvirt-2-format,id=virtio-disk0,bootindex=1 \
-blockdev {"driver":"nbd","server":{"type":"inet","host":"localhost","port":"10809"},"export":"nn","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"} \
-blockdev {"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"} \
-device virtio-blk-pci,bus=pci.0,addr=0x7,drive=libvirt-1-format,id=virtio-disk1,rerror=report
...
3. Kill the qemu-nbd process
~ killall qemu-ndb
4. Read from the nbd disk in guest always:
(guest) # while true;do dd if=/dev/vdb of=file;done
dd: error reading '/dev/vdb': Input/output error
0+0 records in
0+0 records out
0 bytes copied, 0.0132758 s, 0.0 kB/s
dd: error reading '/dev/vdb': Input/output error
...
5. Query the block by qmp query-block:
{ "execute": "query-block" }
{
"return": [
{
"io-status": "ok",
"device": "",
"locked": false,
"removable": false,
"inserted": {
"iops_rd": 0,
"detect_zeroes": "off",
"image": {
"virtual-size": 10737418240,
"filename": "/var/lib/libvirt/images/rhel.qcow2",
"cluster-size": 65536,
"format": "qcow2",
"actual-size": 4294909952,
"format-specific": {
"type": "qcow2",
"data": {
"compat": "1.1",
"compression-type": "zlib",
"lazy-refcounts": false,
"refcount-bits": 16,
"corrupt": false,
"extended-l2": false
}
},
"dirty-flag": false
},
"iops_wr": 0,
"ro": false,
"node-name": "libvirt-2-format",
"backing_file_depth": 0,
"drv": "qcow2",
"iops": 0,
"bps_wr": 0,
"write_threshold": 0,
"encrypted": false,
"bps": 0,
"bps_rd": 0,
"cache": {
"no-flush": false,
"direct": false,
"writeback": true
},
"file": "/var/lib/libvirt/images/rhel.qcow2"
},
"qdev": "/machine/peripheral/virtio-disk0/virtio-backend",
"type": "unknown"
},
{
"io-status": "ok",
"device": "",
"locked": false,
"removable": false,
"inserted": {
"iops_rd": 0,
"detect_zeroes": "off",
"image": {
"virtual-size": 33554432,
"filename": "nbd://localhost:10809/nn",
"format": "raw"
},
"iops_wr": 0,
"ro": false,
"node-name": "libvirt-1-format",
"backing_file_depth": 0,
"drv": "raw",
"iops": 0,
"bps_wr": 0,
"write_threshold": 0,
"encrypted": false,
"bps": 0,
"bps_rd": 0,
"cache": {
"no-flush": false,
"direct": false,
"writeback": true
},
"file": "nbd://localhost:10809/nn"
},
"qdev": "/machine/peripheral/virtio-disk1/virtio-backend",
"type": "unknown"
}
],
"id": "libvirt-418"
}
Here the io-status of the nbd disk is "ok".
Personally, I think the io-status of query-block should be failed as well. The doc of rerror="report" does not say qemu will ignore the read error.