Red Hat Bugzilla – Bug 1112939
libvirt should prompt more readable error message while ide/sata bus disk do not support readonly
Last modified: 2015-03-05 02:38:21 EST
Description of problem: libvirt should prompt more readable error message, to clarify ide/sata bus disk do not support readonly element. Version-Release number of selected component (if applicable): libvirt-1.1.1-29.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. prepare one guest with the following ide bus disk # virsh dumpxml r7 ...... <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/r7-r.img'/> <target dev='hda' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> ...... 2. start the guest # virsh start r7 error: Failed to start domain r7 error: internal error: early end of file from monitor: possible problem: qemu-kvm: -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1: Can't use a read-only drive qemu-kvm: -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1: Device initialization failed. qemu-kvm: -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1: Device 'ide-hd' could not be initialized Actual results: As step 2, fail to start the guest which the readonly disk is ide/sata Expected results: As step 2, libvirt should prompt more readable error message, to clarify ide/sata bus do not support readonly disk. Addtional info: 1. change the bus to sata, will report similar error message like step 2. 2. if "device='cdrom'", the guest can be booted up successfully with ide/sata bus and readonly setting. So, ide/sata bus "disk" can not support readonly, but the ide/sata bus "cdrom" is ok for readonly setting.
Could you tell us what qemu-kvm version was used? And, please, attach /var/log/libvirt/qemu/r7.log. Anyway, we just provide what we got from qemu-kvm. And the error seems to be pretty clear to me. However, I would expect readonly to work even for disks, not just cdroms. Let qemu guys investigate if this is expected to fail or not.
hi, Jiri, This behave is as expected from qemu-kvm said, I have contact with the qemu guys already. Please the following bug comment: https://bugzilla.redhat.com/show_bug.cgi?id=915162#c1 I file this bug for the error message, not the fail result. It's better to generate one more readable error message like the following one: # virsh start r7 error: Failed to start domain r7 error: unsupported configuration: readonly is not supported for bus='ide' and 'sata' (In reply to Jiri Denemark from comment #1) > Could you tell us what qemu-kvm version was used? And, please, attach > /var/log/libvirt/qemu/r7.log. > > Anyway, we just provide what we got from qemu-kvm. And the error seems to be > pretty clear to me. However, I would expect readonly to work even for disks, > not just cdroms. Let qemu guys investigate if this is expected to fail or > not.
patch proposed upstream: https://www.redhat.com/archives/libvir-list/2014-June/msg01441.html
fixed upstream with: commit 72f919f558902968bd0cf9f99f25ac62cbfe3ac6 Author: Giuseppe Scrivano <gscrivan@redhat.com> Date: Mon Jun 30 12:05:06 2014 +0200 qemu: raise an error when trying to use readonly ide disks The IDE bus doesn't support readonly disks, so inform the user with an error message instead of let qemu fail with a more obscure "Device 'ide-hd' could not be initialized" error message. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Hi Giuseppe, I seems that the patch does not raise an accurate error when trying to use readonly SATA disks. It only fixs the error when trying to use readonly IDE disks. # rpm -q libvirt libvirt-1.2.8-3.el7.x86_64 Steps: 1. # virsh dumpxml qe-con | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/qe-con.qcow2'/> <target dev='hda' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/test.img'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> # virsh start qe-con error: Failed to start domain qe-con error: unsupported configuration: readonly ide disks are not supported 2. # virsh dumpxml qe-con | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/qe-con.qcow2'/> <target dev='sda' bus='sata'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh start qe-con error: Failed to start domain qe-con error: internal error: process exited while connecting to monitor: 2014-09-22T10:44:17.334327Z qemu-kvm: -device ide-hd,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1: Can't use a read-only drive 2014-09-22T10:44:17.334384Z qemu-kvm: -device ide-hd,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1: Device initialization failed. 2014-09-22T10:44:17.334405Z qemu-kvm: -device ide-hd,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1: Device 'ide-hd' could not be initialized In step 2: the error messages are not friendly.
Verified on libvirt-1.2.8-4.el7.x86_64 Steps: 1. # virsh dumpxml qe-con | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/qe-con.qcow2'/> <target dev='hda' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh start qe-con error: Failed to start domain qe-con error: unsupported configuration: readonly ide disks are not supported 2. # virsh dumpxml qe-con | grep disk -a6 <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/qe-con.qcow2'/> <target dev='sda' bus='sata'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh start qe-con error: Failed to start domain qe-con error: unsupported configuration: readonly sata disks are not supported Since the above steps got the expected results, I'd like to set it to verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-0323.html