<iotune> in cdrom device makes libvirt fail with "Device has no medium"
Software environment
- Operating system: Linux
- Architecture: x86_64
- kernel version: 4.18 stock CentOS 8
- libvirt version: 6.9.0
- Hypervisor and version: qemu/kvm 5.1.0
Description of problem
IO throttling for a cdrom device fails with
internal error: unable to execute 'block_set_io_throttle', unexpected error: 'Device has no medium'
"Device has no medium" is from qemu of course. Removing the iotune entries from following domain XML makes it work again.
<disk type='network' device='cdrom'>
<driver name='qemu' type='raw' />
<target dev='sdi' bus='sata'/>
<boot order='5'/>
<iotune>
<read_bytes_sec>104857600</read_bytes_sec>
<read_iops_sec>1000</read_iops_sec>
<read_bytes_sec_max>104857600</read_bytes_sec_max>
<read_iops_sec_max>1000</read_iops_sec_max>
</iotune>
<readonly/>
</disk>`
This used to work with libvirt 6.5.0 and qemu 4.1 but fails now with 6.9.0 and qemu 5.1.0
Steps to reproduce
- Try adding above device with entries
- Start a guest
- Observe "Device has no medium" error
Additional information
libvirtd logs
libvirtd[46248]: internal error: unable to execute 'block_set_io_throttle', unexpected error: 'Device has no medium'
Relevant snip from debug logs:
2020-12-15 16:15:57.041+0000: 64581: debug : qemuMonitorJSONIOProcessLine:222 : Line [{"return": {}, "id": "libvirt-368"}]
2020-12-15 16:15:57.041+0000: 64581: info : qemuMonitorJSONIOProcessLine:242 : QEMU_MONITOR_RECV_REPLY: mon=0x7ff86403c010 reply={"return": {}, "id": "libvirt-368"}
2020-12-15 16:15:57.041+0000: 64581: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: debug : qemuDomainObjExitMonitorInternal:5610 : Exited monitor (mon=0x7ff86403c010 vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.041+0000: 63832: debug : qemuDomainObjEndJob:1143 : Stopping job: async nested (async=start vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.041+0000: 63832: debug : qemuProcessSetupDiskThrottlingBlockdev:6806 : Setting up disk throttling for -blockdev via block_set_io_throttle
2020-12-15 16:15:57.041+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.041+0000: 63832: debug : qemuDomainObjBeginJobInternal:843 : Starting job: job=async nested agentJob=none asyncJob=none (vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a, current job=none agentJob=none async=start)
2020-12-15 16:15:57.041+0000: 63832: debug : qemuDomainObjBeginJobInternal:890 : Started job: async nested (async=start vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.041+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff82012c030
2020-12-15 16:15:57.041+0000: 63832: debug : qemuDomainObjEnterMonitorInternal:5585 : Entering monitor (mon=0x7ff86403c010 vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.041+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: debug : qemuMonitorSetBlockIoThrottle:3500 : drivealias=<null>, qomid=sata1-0-2, info=0x7ff87801c900
2020-12-15 16:15:57.041+0000: 63832: debug : qemuMonitorSetBlockIoThrottle:3502 : mon:0x7ff86403c010 vm:0x55e7270d06a0 fd:39
2020-12-15 16:15:57.041+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 63832: info : qemuMonitorSend:954 : QEMU_MONITOR_SEND_MSG: mon=0x7ff86403c010 msg={"execute":"block_set_io_throttle","arguments":{"id":"sata1-0-2","bps":0,"bps_rd":104857600,"bps_wr":0,"iops":0,"iops_rd":1000,"iops_wr":0,"bps_max":0,"bps_rd_max":104857600,"bps_wr_max":0,"iops_max":0,"iops_rd_max":1000,"iops_wr_max":0,"iops_size":0},"id":"libvirt-369"}
fd=-1
2020-12-15 16:15:57.041+0000: 64581: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 64581: info : qemuMonitorIOWrite:441 : QEMU_MONITOR_IO_WRITE: mon=0x7ff86403c010 buf={"execute":"block_set_io_throttle","arguments":{"id":"sata1-0-2","bps":0,"bps_rd":104857600,"bps_wr":0,"iops":0,"iops_rd":1000,"iops_wr":0,"bps_max":0,"bps_rd_max":104857600,"bps_wr_max":0,"iops_max":0,"iops_rd_max":1000,"iops_wr_max":0,"iops_size":0},"id":"libvirt-369"}
len=273 ret=273 errno=0
2020-12-15 16:15:57.041+0000: 64581: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.041+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.043+0000: 64581: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.043+0000: 64581: debug : qemuMonitorJSONIOProcessLine:222 : Line [{"id": "libvirt-369", "error": {"class": "GenericError", "desc": "Device has no medium"}}]
2020-12-15 16:15:57.043+0000: 64581: info : qemuMonitorJSONIOProcessLine:242 : QEMU_MONITOR_RECV_REPLY: mon=0x7ff86403c010 reply={"id": "libvirt-369", "error": {"class": "GenericError", "desc": "Device has no medium"}}
2020-12-15 16:15:57.043+0000: 64581: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 64581: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 63832: error : qemuMonitorJSONSetBlockIoThrottle:5642 : internal error: unable to execute 'block_set_io_throttle', unexpected error: 'Device has no medium'
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86403c010
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainObjExitMonitorInternal:5610 : Exited monitor (mon=0x7ff86403c010 vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainObjEndJob:1143 : Stopping job: async nested (async=start vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainLogContextFinalize:366 : ctxt=0x7ff82000dec0
2020-12-15 16:15:57.044+0000: 63832: info : vir_object_finalize:322 : OBJECT_DISPOSE: obj=0x55e7271348b0
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x55e7271348b0
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86c005d00
2020-12-15 16:15:57.044+0000: 63832: info : vir_object_finalize:322 : OBJECT_DISPOSE: obj=0x7ff820019400
2020-12-15 16:15:57.044+0000: 63832: info : vir_object_finalize:322 : OBJECT_DISPOSE: obj=0x7ff86c005d00
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff86c005d00
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff820019400
2020-12-15 16:15:57.044+0000: 63832: debug : virFileClose:135 : Closed fd 38
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: debug : qemuProcessStop:7561 : Shutting down vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a id=1 pid=64577, reason=failed, asyncJob=start, flags=0x0
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainObjBeginJobInternal:843 : Starting job: job=async nested agentJob=none asyncJob=none (vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a, current job=none agentJob=none async=start)
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainObjBeginJobInternal:890 : Started job: async nested (async=start vm=0x55e7270d06a0 name=33a1f203-534d-4e7a-83de-883cbaa3c72a)
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: debug : virFileClose:135 : Closed fd 33
2020-12-15 16:15:57.044+0000: 63832: info : virObjectRef:403 : OBJECT_REF: obj=0x7ff82012c030
2020-12-15 16:15:57.044+0000: 63832: debug : qemuDomainLogAppendMessage:6386 : Append log message (vm='33a1f203-534d-4e7a-83de-883cbaa3c72a' message='2020-12-15 16:15:57.044+0000: shutting down, reason=failed
) stdioLogD=1