Bug 1220197
Summary: | Domain XML is invalid with "<source startupPolicy='optional'/>" | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Pei Zhang <pzhang> |
Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.7 | CC: | dyuan, jsuchane, lmen, mzhan, pzhang, rbalakri, xuzhang |
Target Milestone: | rc | Keywords: | Upstream |
Target Release: | --- | Flags: | pzhang:
needinfo-
|
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | libvirt-0.10.2-55.el6 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-05-10 19:23:39 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
Pei Zhang
2015-05-11 01:48:24 UTC
Hi, is it reproducible with libvirt-0.10.2-46.el6 build? Firstly , sorry for my mistaken . "startupPolicy" just be used disk type is "file / volume " . it is a invalid operation . so please ignore virt-xml-validate . but it will also get a bad domain xml after libvirt format it . If I configure XML like following (using type is 'file'). it is all right (dumpxml and start): <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> Then I change disk type to 'block' : 1. For a running domain , using edit to change 'file' to 'block' #virsh edit r6 <disk type='block' device='cdrom'> ...... It can be saved , but it just remove "<source" rather than all of them . It should remove " <source startupPolicy='optional'/> " all after I edit and saved If libvirt try to format it . so that is not expected result I think . using dumpxml to check , the result likes following : # virsh dumpxml r6 --inactive |grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> startupPolicy='optional'/> ...... 2. for a shut off domain ,configure guest XML like following : ...... <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <source startupPolicy='optional'/> ...... start guest # virsh start r6 Domain r6 started # virsh dumpxml r6 | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> startupPolicy='optional'/> <===it still exists. ...... # virsh dumpxml r6 --inactive | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> ...... And these operations (edit and dumpxml guest) can reproduce it with libvirt-0.10.2-46.el6 and libvirt-0.10.2-46.el6_6.6.x86_64 . Thanks . Fixed upstream by: commit 4b5652d0dcb2d53fd4240f589a63aaa434650fe0 Author: Doug Goldstein <cardoe> CommitDate: 2013-09-17 14:10:40 -0500 Allow <source> for type=block to have no dev Currently the XML parser already allows the following syntax: <disk type='block' device='cdrom'> <source startupPolicy='optional'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> But it if the dev value is NULL then it would not have the leading "<source ", resulting in invalid XML. git describe: v1.1.2-162-g4b5652d contains: v1.1.3-rc1~115 version: libvirt-0.10.2-55.el6.x86_64 steps: scenario 1: 1.start guest with following XML <disk type='block' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 2.check domain xml with --inactive flag [root@lmen ~]# virsh dumpxml rhel6 --inactive | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 3.check domain xml without --inactive flag [root@lmen ~]# virsh dumpxml rhel6 | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 4.Using virt-xml-validate to check [root@lmen ~]# virsh dumpxml rhel6 --inactive >rhel6.xml [root@lmen ~]# virt-xml-validate rhel6.xml rhel6.xml validates scenario 2: 1.start guest with following XML <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 2.edit the xml to change 'file' to 'block' #virsh edit rhel6 <disk type='block' device='cdrom'> ..... 3.check domain xml without --inactive flag [root@lmen ~]# virsh dumpxml rhel6 | grep cdrom -A 9 <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 4.check domain xml with --inactive flag [root@lmen ~]# virsh dumpxml rhel6 --inactive | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> 5.Use virt-xml-validate to check [root@lmen ~]# virsh dumpxml rhel6 --inactive >rhel6.xml [root@lmen ~]# virt-xml-validate rhel6.xml rhel6.xml validates 6.reboot rhe guest [root@lmen ~]# virsh destroy rhel6 Domain rhel6 destroyed [root@lmen ~]# virsh start rhel6 Domain rhel6 started 7.check domain xml without --inactive flag [root@lmen ~]# virsh dumpxml rhel6 | grep cdrom -A 9 <disk type='block' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <source startupPolicy='optional'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> the bug is 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/RHBA-2016-0738.html |