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 1210669 - virt-xml-validate should post error when guest xml configured with "disk type='file' device='lun'"
Summary: virt-xml-validate should post error when guest xml configured with "disk type...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-10 10:16 UTC by Shanzhi Yu
Modified: 2015-11-19 06:28 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.15-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:28:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Shanzhi Yu 2015-04-10 10:16:35 UTC
Description of problem:

virt-xml-validate should post error when guest xml configured with "disk type='file' device='lun'"

Version-Release number of selected component (if applicable):

libvirt-client-1.2.14-1.el7.x86_64

How reproducible:

100%

Steps to Reproduce:

1. Prepare a xml with "disk type=file" and "device=lun"
# cat test.xml
<domain type='kvm' id='5'>
<name>test</name>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static' current='2'>4</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='lun'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/test.copy'/>
<backingStore/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
</devices>
</domain>

2. validate it with virt-xml-validate
# virt-xml-validate test.xml
test.xml validates

3. Create a guest with above xml
# virsh create test.xml
error: Failed to create domain from test.xml
error: unsupported configuration: disk device='lun' is only valid for block type disk source

Actual results:


Expected results:


Additional info:

Comment 1 Erik Skultety 2015-04-20 08:17:33 UTC
Fixed upstream:

commit cea1b86fa7f140a30220bb2efaece1d2890f2d91
Author: Erik Skultety <eskultet>
Date:   Fri Apr 17 13:14:12 2015 +0200

    rng: Forbid to validate mismatched <disk> 'device' and 'type' attributes
    
    According to docs, using 'lun' as a value for device attribute is only valid
    with disk types 'block' and 'network'. However current RNG schema also allows
    a combination type='file' device='lun' which results in a successfull
    xml validation, but fails at qemuBuildCommandLine.
    Besides fixing the RNG schema, this patch also adds a qemuxml2argvtest
    for this case.

v1.2.14-223-gcea1b86

Comment 3 Pei Zhang 2015-05-25 10:23:11 UTC
Reproduce it on libvirt-1.2.14-1.el7.x86_64

Verified version:
libvirt-1.2.15-2.el7.x86_64

steps:
1.prepare a xml with "disk type='file' and device='lun'"
# cat r7.2.xml | grep disk -A 9
......
<disk type='file' device='lun'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/raw.img'/>
      <target dev='sde' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>
......
2.validate it with virt-xml-validate , it will report error.
# virt-xml-validate r7.2.xml
Relax-NG validity error : Extra element devices in interleave
r7.2.xml:31: element devices: Relax-NG validity error : Element domain failed to validate content
r7.2.xml fails to validate

3.change domain xml to "disk type='block' " ,it is valid.
# cat r7.2.xml | grep disk -A 9
 <disk type='block' device='lun'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sde'/>
      <target dev='sde' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>

# virt-xml-validate r7.2.xml
r7.2.xml validates

4.change domain xml to "disk type='network' and source protocol is iscsi" ,it is valid.
<disk type='network' device='lun'>
      <driver name='qemu' type='raw'/>
      <source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target1/1'>
        <host name='$IP' port='3260'/>
      </source>
      <target dev='sde' bus='scsi'/>
    </disk>
</devices>


Now ,  virt-xml-validate can report error when guest xml configured with "disk type='file' device='lun'" . and it is valid with "block lun " and "iscsi network lun " . 


Note :

Since device "lun" is only valid when type is "block" or "network" using the iSCSI protocol . If the network protocol is not ISCSI , should virt-xml-validate also report error .

5.prepare a xml like following 
# cat test.xml |grep disk -A 9
......
 <disk type='network' device='lun'>  <=== device is lun 
      <driver name='qemu' type='qcow2' cache='none'/>
      <source protocol='gluster' name='gluster-vol1/r6q2.img'>  <===protocol is gluster not iscsi
        <host name='$IP'/>
      </source>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
......

6.using virt-xml-validate to validate it , it is valid.
# virt-xml-validate test.xml 
test.xml validates

7.using above domain xml to create a guest , it will report error .
# virsh create validate.xml 
error: Failed to create domain from validate.xml
error: unsupported configuration: disk device='lun' is not supported for protocol='gluster'

In step6 , should it also report error if the network protocol is not iscsi . Thanks a lot .

Comment 4 Erik Skultety 2015-05-26 08:48:42 UTC
I get your point, but I don't think it's worth it, we can't know for sure that there won't be any support for gluster at all, thus I'd leave this as a post-parse logic rather than fragment our RNG schema where maintainability matters.

Comment 5 Pei Zhang 2015-05-26 10:44:33 UTC
Thanks for your info , and according to comment 3 and comment 4 , moving it to verified .

Comment 7 errata-xmlrpc 2015-11-19 06:28:11 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/RHBA-2015-2202.html


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