Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1112939 - libvirt should prompt more readable error message while ide/sata bus disk do not support readonly
libvirt should prompt more readable error message while ide/sata bus disk do ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Giuseppe Scrivano
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-25 01:23 EDT by Xuesong Zhang
Modified: 2015-03-05 02:38 EST (History)
8 users (show)

See Also:
Fixed In Version: libvirt-1.2.8-4.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 02:38:21 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 07:10:54 EST

  None (edit)
Description Xuesong Zhang 2014-06-25 01:23:44 EDT
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.
Comment 1 Jiri Denemark 2014-06-25 04:17:39 EDT
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.
Comment 2 Xuesong Zhang 2014-06-25 04:37:10 EDT
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.
Comment 3 Giuseppe Scrivano 2014-06-30 06:06:14 EDT
patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2014-June/msg01441.html
Comment 4 Giuseppe Scrivano 2014-07-07 06:24:53 EDT
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>
Comment 6 yangyang 2014-09-22 06:50:05 EDT
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.
Comment 8 yangyang 2014-09-29 06:02:01 EDT
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.
Comment 10 errata-xmlrpc 2015-03-05 02:38:21 EST
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

Note You need to log in before you can comment on or make changes to this bug.