'file' driver requires '/dev/sdx' to be a regular file
Software environment
- Operating system: Arch Linux
- Architecture: x86_64
- kernel version: 5.13.13.arch1-1
- libvirt version: 7.7.0
- Hypervisor and version: QEMU 6.1.0
Description of problem
When trying to launch a domain which has a block device being passed as follows:
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sdx'/>
</disk>
it fails with following error: internal error: process exited while connecting to monitor: 2021-09-04T09:03:30.420933Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/dev/sdx","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true}: 'file' driver requires '/dev/sdx' to be a regular file
.
Steps to reproduce
- Create a QEMU/KVM domain
- Add a disk to it which points to the block device at host
- Try to launch the domain
Additional information
This seems to be a breaking change introduced in QEMU 6.0, as changelog says the following: The file block driver no longer permits use with block devices
. Downgrading to QEMU 5.2 allows for domain to successfully boot up.
Judging from current documentation, in order to pass a block device, you have to use raw block driver instead.