Bug 1285665

Summary: Fail to valid the guest's xml while set the graphical listen as ipv6 address which end with "::" on rhel7
Product: Red Hat Enterprise Linux 7 Reporter: mxie <mxie>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dyuan, fjin, jdenemar, jtomko, juzhou, mzhan, rbalakri, tzheng, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:32:18 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 mxie@redhat.com 2015-11-26 08:27:39 UTC
Description of problem:
Fail to valid the guest's xml while set the graphical listen as ipv6 address which end with "::" on rhel7

Version-Release number of selected component (if applicable):
Host:3.10.0-327.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Edit a guest xml on rhel7 and change graphical listen address to "::" or other ipv6 address end with "::"
# virsh edit 2OS
<graphics type='vnc' port='5901' autoport='no' listen='::'>
  <listen type='address' address='::'/>
</graphics>

2.Using ":wq" to save xml, it will pop up below error
# virsh edit 2OS
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

Failed. Try again? [y,n,i,f,?]: 

3.if type "i" , the xml could be saved as below and the graphical listen ipv6 address "::" could be used by guest normally

Domain 2OS XML configuration edited.


Actual results:
As above description

Expected results:
Could valid the guest's xml while set the graphical listen as ipv6 address which end with "::" on rhel7 

Addtional info:
Could valid the guest's xml while set the graphical listen as ipv6 address which end with "::" on rhel6 normally

Comment 1 Ján Tomko 2015-11-26 09:52:37 UTC
Reproducible with libvirt-1.2.17-13.el7

Upstream patch:
https://www.redhat.com/archives/libvir-list/2015-November/msg01118.html

Comment 2 Ján Tomko 2015-11-26 09:56:38 UTC
Note that 'virsh edit' did not validate the XML before RHEL 7.2, it was added upstream by:

commit d7565bd8aab018302307a994e7753766cc72c085
Author:     Daniel P. Berrange <berrange>
CommitDate: 2015-01-16 11:07:59 +0000

    virsh: add support for domain XML validation
    
    The 'virsh edit' command gets XML validation enabled by default,
    with a --skip-validate option to disable it. The 'virsh define'
    and 'virsh create' commands get a --validate option to enable
    it, to avoid regressions for existing scripts.
    
    The quality of error reporting from libxml2 varies depending
    on the type of XML error made. Sometimes it is quite clear
    and useful, other times it is obscure & inaccurate. At least
    the user will see an error now, rather than having their
    XML modification silently disappear.

git describe: v1.2.11-188-gd7565bd contains: v1.2.12-rc1~21

Comment 3 Ján Tomko 2015-11-26 10:06:06 UTC
Now pushed upstream:
commit 7ec235ed092a2408ca0d3b7fd1c4bfcbc3fc835e
Author:     Ján Tomko <jtomko>
CommitDate: 2015-11-26 11:05:18 +0100

    schema: use a better regex for listen addresses
    
    A domain with '::' as the listen address fails to validate.
    
    Reuse the 'ipAddr' and 'dnsName' regexes from basictypes instead
    of reinventing them.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1285665

git describe: v1.2.21-142-g7ec235e

Comment 5 Fangge Jin 2016-03-03 02:14:54 UTC
Verify pass on downstream build: libvirt-1.3.1-1.el7.x86_64

Steps:
# virsh edit rhel7
(edit listen address to :: or 0::, like
<graphics type='spice' port='5900' autoport='no' listen='0::'>
)
Domain rhel7 XML configuration edited.

# virsh dumpxml rhel7 |grep gra
<graphics type='spice' port='5900' autoport='no' listen='0::'>
</graphics>

# virsh start rhel7

# ps aux|grep qemu
...-spice port=5900,addr=::,disable-ticketing,seamless-migration=on...

Comment 6 Fangge Jin 2016-04-11 03:53:58 UTC
Verify pass on downstream build: libvirt-1.3.3-1.el7.x86_64

Steps:
1. # virsh edit windows
    <graphics type='spice' port='5905' autoport='no' listen='**0::**'/>
Domain windows XML configuration edited.
2. # virsh dumpxml windows
    <graphics type='spice' port='5905' autoport='no' listen='0::'>
      <listen type='address' address='0::'/>
    </graphics>
3. # virsh start windows
4. # ps aux|grep qemu
-spice port=5905,addr=0::,...
5.# remote-viewer spice://10.66.5.57:5905
6.Edit listen address to '::', and test again

Comment 8 errata-xmlrpc 2016-11-03 18:32:18 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-2016-2577.html