RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1112939 - libvirt should prompt more readable error message while ide/sata bus disk do not support readonly
Summary: libvirt should prompt more readable error message while ide/sata bus disk do ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-25 05:23 UTC by Xuesong Zhang
Modified: 2015-03-05 07:38 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.2.8-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:38:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Xuesong Zhang 2014-06-25 05:23:44 UTC
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 08:17:39 UTC
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 08:37:10 UTC
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 10:06:14 UTC
patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2014-June/msg01441.html

Comment 4 Giuseppe Scrivano 2014-07-07 10:24:53 UTC
fixed upstream with:

commit 72f919f558902968bd0cf9f99f25ac62cbfe3ac6
Author: Giuseppe Scrivano <gscrivan>
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>

Comment 6 Yang Yang 2014-09-22 10:50:05 UTC
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 Yang Yang 2014-09-29 10:02:01 UTC
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 07:38:21 UTC
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.