Bug 1108524

Summary: virt-viewer -c qemu+tcp will open local guest when remote VM is only listening on 127.0.0.1
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: virt-viewerAssignee: Virt Viewer Maint <virt-viewer-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: cfergeau, codong, dblechte, dyuan, jjongsma, juzhou, marcandre.lureau, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-viewer-0.6.0-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1108523 Environment:
Last Closed: 2015-03-05 13:39:09 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:
Bug Depends On: 1108523    
Bug Blocks: 1085216    

Description tingting zheng 2014-06-12 08:01:21 UTC
The bug can also be reproduced on rhel7,so cloned it.

+++ This bug was initially created as a clone of Bug #1108523 +++

Description
virt-viewer -c qemu+tcp will open local guest when remote VM is only listening on 127.0.0.1

Version:
virt-viewer-0.6.0-5.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.On host A,set tcp server environment.
1.1 Edit /etc/sysconfig/libvirtd
       LIBVIRTD_ARGS="--listen"

1.2 Edit /etc/libvirt/libvirtd.conf
       listen_tls = 0
       listen_tcp=1
       auth_tcp="sasl"

1.3 Add a user named "fred", and setting his password as "redhat"
   # saslpasswd2 -a libvirt fred
   Password: xxxxxx
   Again (for verification): xxxxxx

1.4 Restart libvirtd service and set iptables.
# service libvirtd restart

#iptables -F

2.Prepare a spice guest rhel6.5 on host A,set it's listen address as 127.0.0.1,the xml shows as below:
# virsh dumpxml rhel6.5
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

3. On host B,prepare a spice guest winxp,set it's listen address as 127.0.0.1,the xml shows as below:
# virsh dumpxml winxp
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

4.On host B,use virt-viewer to launch remote guest rhel6.5 on host A,guest winxp on host B will be opened instead of rhel6.5 on host A.
# virt-viewer -c qemu+tcp://10.66.7.56/system rhel6.5

5.Repeat step 4 to connect remote vm through ssh,guest on host A can be opened successfully.
# virt-viewer -c qemu+ssh://10.66.7.56/system rhel6.5

Actual results:
As descripiton.

Expected results:
Guest booted on local host should not effect remote vm launched by virt-viewer.

Additional info:
1.If no guest booted on host B,step 4 will fail with error:Unable to connect to the graphic server 127.0.0.1:5900
2.The bug can be reproduced for vnc guest.
3.If guest on host A set listen address as '0.0.0.0',step 4 will connect to remote vm successfully.

Comment 2 Christophe Fergeau 2014-08-06 08:47:05 UTC
*** Bug 1084393 has been marked as a duplicate of this bug. ***

Comment 3 Christophe Fergeau 2014-09-12 15:33:57 UTC
Patch is https://www.redhat.com/archives/virt-tools-list/2014-June/msg00175.html

Comment 4 CongDong 2014-09-17 03:05:33 UTC
Test with:
virt-viewer-0.6.0-5.el7.x86_64

Steps:

Same with description.
In step 2, change the listen address from 127.0.0.1 to 0
# virsh dumpxml $vm     
<graphics type='spice' port='5900' autoport='yes' listen='0'>
      <listen type='address' address='0'/>
</graphics>


Result:
Step4, virt-viewer will open the guest on host B.

It should open the guest on host A.

Comment 5 Christophe Fergeau 2014-09-17 13:24:33 UTC
If I try what you describe with listen='0', I get an error message that this host is unknown. If I use 0.0.0.0, things work as expected.

Comment 6 CongDong 2014-09-18 09:16:12 UTC
(In reply to Christophe Fergeau from comment #5)
> If I try what you describe with listen='0', I get an error message that this
> host is unknown. If I use 0.0.0.0, things work as expected.

I think you get the same problem with this one:
https://bugzilla.redhat.com/show_bug.cgi?id=1143907

You can downgrade glib2 and retest it.

Comment 7 Christophe Fergeau 2014-09-18 09:24:02 UTC
What matters is what happens with a glib as close as possible to the one which will be released with 7.1, so I'd tend to stick with the latest one.
0 and 0.0.0.0 should be the same if I'm not mistaken, so if glib is fixed, we should get the same behaviour as with 0.0.0.0, which was working as I expect in my tests.

Comment 9 CongDong 2014-09-19 08:38:14 UTC
I can reproduce with:
virt-viewer-0.6.0-4.el7.x86_64.rpm

Test with virt-viewer-0.6.0-5.el7.x86_64.rpm and virt-viewer-0.6.0-6.el7.x86_64.rpm.

Steps are same with description.

Result:
If listen address is "127.0.0.1", cannot the guest with error:
Guest is not reachable

If listen address is "0.0.0.0", can connect the guest

If listen address is "0", cannot the guest with error:
fail to connect Error resolving '0': Name or service not known

As the result and comment 7, move to VERIFIED

Comment 11 errata-xmlrpc 2015-03-05 13:39:09 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-0295.html