Bug 1191016

Summary: domdisplay show the wrong IP address for network type listen address
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, eskultet, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:14:35 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 Luyao Huang 2015-02-10 09:20:48 UTC
description of problem:
domdisplay show the wrong IP address for network type listen address

Version-Release number of selected component (if applicable):
libvirt-1.2.8-16.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
 
1.prepare a vm have network type listen address graphics
    <graphics type='spice' autoport='yes' keymap='en-us'>
      <listen type='network' network='default'/>
    </graphics>

2.start
# virsh start test4
Domain test4 started

3.
# virsh dumpxml test4
    <graphics type='spice' port='5901' autoport='yes' keymap='en-us'>
      <listen type='network' address='192.168.122.1' network='default'/>
    </graphics>

4.# virsh domdisplay test4
spice://localhost:5901

5. try to connect to this uri and will failed:
remote-viewer spice://localhost:5901

Actual results:
domdisplay show the wrong IP address for network type listen address

Expected results:
# virsh domdisplay test4
spice://192.168.122.1:5901

infomation:

Comment 1 Luyao Huang 2015-02-16 09:48:10 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2015-February/msg00331.html
https://www.redhat.com/archives/libvir-list/2015-February/msg00298.html

Pushed as:

commit 1ba8156cc9070eed2b5cea4ea7e519442f14e8d2
Author: Luyao Huang <lhuang>
Date:   Tue Feb 10 17:35:56 2015 +0800

    virsh: fix IP address in domdisplay for listen type='network'

commit 699299419b4d079a57fc7faa5e819403ba198381
Author: Laine Stump <laine>
Date:   Tue Feb 10 13:49:16 2015 -0500

    domain: backfill listen address to parent <graphics> listen attribute

commit 6d1194ffc08499922d6518bbf910941eedb26ea6
Author: Laine Stump <laine>
Date:   Tue Feb 10 14:04:40 2015 -0500

    domain: avoid potential memory leak in virDomainGraphicsListenSet*()

Comment 3 vivian zhang 2015-05-26 05:32:02 UTC
I can produce this bug with build libvirt-1.2.8-16.el7.x86_64

Verify it with build libvirt-1.2.15-2.el7.x86_64

Steps:

1. edit guest with XML

# virsh edit vm2
...
<graphics type='spice' autoport='yes' keymap='en-us'>
      <listen type='network' network='default'/>
    </graphics>
...

2. dumpxml and domdisplay
# virsh dumpxml vm1
...
<graphics type='spice' port='5900' autoport='yes' listen='192.168.122.1' keymap='en-us'>
      <listen type='network' address='192.168.122.1' network='default'/>
    </graphics>
...

# virsh domdisplay vm1
spice://192.168.122.1:5900


3. connect guest with remote-viewer and virt-viewer on local host success
# remote-viewer spice://192.168.122.1:5900
# virt-viewer vm1

4. set with vnc, check domdisplay 
...
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'>
      <listen type='network' network='default'/>
    </graphics>
...


# virsh domdisplay vm1
vnc://192.168.122.1:0

5. use virt-viewer or remote-viewer vnc://192.168.122.1:5900 connect guest success

6. try with another bridge network br1

# virsh net-dumpxml br1
<network>
  <name>br1</name>
  <uuid>8a2e947d-c1d5-4695-2881-5f877ced63e0</uuid>
  <forward mode='route'/>
  <bridge name='br1' stp='on' delay='0'/>
  <mac address='52:54:00:ad:88:b2'/>
  <ip address='10.0.0.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='10.0.0.2' end='10.0.0.254'/>
    </dhcp>
  </ip>
</network>

7. dumpxml and domdispaly guest
# virsh dumpxml vm1
...
<graphics type='vnc' port='5900' autoport='yes' listen='10.0.0.1' keymap='en-us'>
      <listen type='network' address='10.0.0.1' network='br1'/>
    </graphics>
...

# virsh domdisplay vm1
vnc://10.0.0.1:0

8. connect with remote-viewer or virt-viewer to guest success

# remote-viewer vnc://10.0.0.1:5900


9. try with direct network

# virsh net-dumpxml bridge-net
<network>
  <name>bridge-net</name>
  <uuid>d4282a3c-029a-a48a-9d04-e340f9ebc053</uuid>
  <forward dev='eno1' mode='bridge'>
    <interface dev='eno1'/>
  </forward>
</network>

# virsh domdisplay vm1
spice://10.66.7.206:5900

10. remote-viewer also works well

# remote-viewer spice://10.66.7.206:5900


11. prepare a remote guest on host with libvirt build libvirt-1.2.8-16.el7.x86_64

configure the remote guest with network bridge 

# virsh dumpxml rh7
...
<graphics type='spice' port='5900' autoport='yes' keymap='en-us'>
      <listen type='network' address='192.168.122.1' network='default'/>
    </graphics>
...

12. connect remote guest on local host with libvirt build libvirt-1.2.15-2.el7.x86_64

    check domdisplay show remote host IP is right
# virsh -c qemu+ssh://$remotehostIP/system
root@$remotehostIP's password: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list
 Id    Name                           State
----------------------------------------------------
 7     rh7                            running

virsh #  domdisplay rh7
spice://192.168.122.1:5900


move to verified

Comment 5 errata-xmlrpc 2015-11-19 06:14:35 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