Bug 1210669
| Summary: | virt-xml-validate should post error when guest xml configured with "disk type='file' device='lun'" | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Shanzhi Yu <shyu> |
| Component: | libvirt | Assignee: | Erik Skultety <eskultet> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.2 | CC: | dyuan, eskultet, mzhan, pzhang, rbalakri, yanyang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.15-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:28:11 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Shanzhi Yu
2015-04-10 10:16:35 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
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 .
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. 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 |