Bug 1085216

Summary: virt-viewer --direct tries to connect to localhost when remote VM is only listening on 127.0.0.1
Product: Red Hat Enterprise Linux 6 Reporter: tingting zheng <tzheng>
Component: virt-viewerAssignee: Fabiano Fidêncio <fidencio>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: cfergeau, dblechte, fidencio, jjongsma, juzhou, marcandre.lureau, mzhan, rbalakri, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-viewer-2.0-5.el6 Doc Type: Bug Fix
Doc Text:
No doc needed
Story Points: ---
Clone Of: 1084393 Environment:
Last Closed: 2015-07-22 06:31:04 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: 1084393, 1108524, 1179477    
Bug Blocks:    

Comment 2 Christophe Fergeau 2014-09-12 13:49:14 UTC
Hmm missed this for 6.6, fixed upstream by https://www.redhat.com/archives/virt-tools-list/2014-June/msg00175.html

Comment 4 Jonathon Jongsma 2015-02-09 16:33:33 UTC
Will be fixed by rebase to 2.0

Comment 6 zhoujunqin 2015-03-11 10:36:57 UTC
I can reproduce this issue with package:
virt-viewer-0.6.0-11.el6.x86_64

Then try to verify this bug with new build:
virt-viewer-2.0-2.el6.x86_64

steps to verify:
Prepare 2 hosts: A&B

1.On host A(ip:10.66.7.91),prepare a vnc guest.

# virsh list 
 Id    Name                           State
----------------------------------------------------
 1     rhel6u6-i386                   running

# virsh dumpxml rhel6u6-i386 
...
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
...

2.On host B(ip:10.66.70.126),use virt-viewer to connect the guest on host A using --direct:
# virt-viewer --direct -c qemu+ssh://10.66.7.91/system rhel6u6-i386 

2.1 On host B,if there is no guest running using vnc protocal with port 5900,check whether guest on remote host can be launched.
Result: "Unable to connect to the graphic server 127.0.0.1:5900"

2.2 On host B,if there is a guest demo running using vnc protocal with port 5900:
# virsh dumpxml win7-x64
...
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
# virt-viewer --direct -c qemu+ssh://10.66.7.91/system rhel6u6-i386
root.7.91's password: 

Result: Then the vm 'win7-x64' on host B will be opened instead of remote guest 's1-clone' on host A.

Since bug can also reproduced, assigned back, please help check, thanks.

Comment 7 Fabiano Fidêncio 2015-03-11 15:29:31 UTC
Hmm. Not exactly trivial to understand the description.

I have proposed upstream a simple patch to solve the problem (https://www.redhat.com/archives/virt-tools-list/2015-March/msg00063.html). However, I don't think it was properly verified for rhel-7.1 as the bug still occurs there. I'd suggest to re-open the bug there and backport the upstream patch to rhel-7.2 as well.

Comment 9 zhoujunqin 2015-03-25 10:45:22 UTC
Try to verify this bug with new build:
virt-viewer-2.0-4.el6.x86_64

steps to verify:
Prepare 2 hosts: A&B

1.On host A, prepare a vnc guest.

# virsh list 
 Id    Name                           State
----------------------------------------------------
 4     b                              running

# virsh dumpxml b
...
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

2.On host B,use virt-viewer to connect the guest on host A using --direct:
# virt-viewer --direct -c qemu+ssh://$hostA_ip/system b

2.1 On host B,if there is no guest running using vnc protocal with port 5900,check whether guest on remote host can be launched.

Result: 
i. An error box pop up and shows: Guest 'b' is not reachable

ii. After click "OK", there is a Virt-Viewer window pop up, and shows "Checking guest domain status", "# virt-viewer --direct -c qemu+ssh://$hostA_ip/system b
" cannot quit until you click "x" in virt-viewer window, i think this is not as expect exiting way.

# virt-viewer --direct -c qemu+ssh://10.66.4.178/system b --debug
(virt-viewer:23570): virt-viewer-DEBUG: connecting ...
(virt-viewer:23570): virt-viewer-DEBUG: Opening connection to libvirt with URI qemu+ssh://10.66.4.178/system
(virt-viewer:23570): virt-viewer-DEBUG: Add handle 7 1 0x1b1daf0
(virt-viewer:23570): virt-viewer-DEBUG: initial connect
(virt-viewer:23570): virt-viewer-DEBUG: notebook show status 0x1aae000
(virt-viewer:23570): virt-viewer-DEBUG: virt_viewer_app_set_uuid_string: UUID changed to 6944dea9-f124-c7cd-93a2-ee4ea9b16ac2
(virt-viewer:23570): virt-viewer-DEBUG: No guest-specific fullscreen config, using fallback
(virt-viewer:23570): virt-viewer-DEBUG: notebook show status 0x1aae000
(virt-viewer:23570): virt-viewer-DEBUG: Guest b is running, determining display
(virt-viewer:23570): virt-viewer-DEBUG: Set connect info: (null),(null),(null),-1,(null),(null),(null),0
(virt-viewer:23570): virt-viewer-DEBUG: Guest b has a vnc display
(virt-viewer:23570): virt-viewer-DEBUG: Guest graphics address is 127.0.0.1:5900
(virt-viewer:23570): virt-viewer-DEBUG: graphics listen '127.0.0.1' is not reachable from this machine
(virt-viewer:23570): virt-viewer-DEBUG: Guest b has not activated its display yet, waiting for it to start
(virt-viewer:23570): virt-viewer-DEBUG: Add timeout 0x1a91b60 -1 0x3fbe0b23b0 0x1b1ce50 1
(virt-viewer:23570): virt-viewer-DEBUG: Window closed
(virt-viewer:23570): virt-viewer-DEBUG: Unable to get comment from key file: Key file does not have group '6944dea9-f124-c7cd-93a2-ee4ea9b16ac2'
(virt-viewer:23570): virt-viewer-DEBUG: close vnc=0x1a8b6e0
(virt-viewer:23570): virt-viewer-DEBUG: Remove timeout 0x1a91b60 1
(virt-viewer:23570): virt-viewer-DEBUG: Remove handle 1 7
(virt-viewer:23570): virt-viewer-DEBUG: Disposing window 0x1aad840

(virt-viewer:23570): virt-viewer-DEBUG: Set connect info: (null),(null),(null),-1,(null),(null),(null),0

2.2 On host B,if there is a guest demo running using vnc protocal with port 5900:
# virsh dumpxml win7-x64
...
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
# virt-viewer --direct -c qemu+ssh://$hostA_ip/system b

Result: same with step2.1.

so move it back to ASSIGNED.

Comment 10 Fabiano Fidêncio 2015-03-25 12:02:37 UTC
(In reply to zhoujunqin from comment #9)
> 
> Result: 
> i. An error box pop up and shows: Guest 'b' is not reachable

This is exactly the expected result and this bug was opened because it was not happening before. Right?

> 
> ii. After click "OK", there is a Virt-Viewer window pop up, and shows
> "Checking guest domain status", "# virt-viewer --direct -c
> qemu+ssh://$hostA_ip/system b
> " cannot quit until you click "x" in virt-viewer window, i think this is not
> as expect exiting way.

Hmmm. Okay, I'll take a look into this ...

Comment 11 Fabiano Fidêncio 2015-03-25 14:54:54 UTC
Sent to the ML:
https://www.redhat.com/archives/virt-tools-list/2015-March/msg00166.html

Comment 12 Fabiano Fidêncio 2015-03-30 13:09:57 UTC
Pushed the series upstream:

2c03eacc2d71adb260fbf84b3b691b64fad15184
cab8f7450b8af6111c50d563321e5e7e50944479
f9c4a03bd76ca23b6eb715244b7019fddca0eb72
f1204f0e695d9db2f4bdca433d2a75944673f490
ffe19f6ece25e89968e74bccd12c61c1cd749f61
f580f1ea54f98092791814e8f49fbcd5296a4a77
dc2dd055d4334a5b8a1a93a460c97b35defb66e9

Comment 14 zhoujunqin 2015-04-13 08:14:43 UTC
Try to verify this bug with package:
virt-viewer-2.0-5.el6.x86_64

Steps:
steps to verify:
Prepare 2 hosts: A&B

1.On host A, prepare a vnc guest.

# virsh list 
 Id    Name                           State
----------------------------------------------------
 15    cdrom-rhel6u6-x64              running

# virsh dumpxml cdrom-rhel6u6-x64
...
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

2.On host B,use virt-viewer to connect the guest on host A using --direct:
# virt-viewer --direct -c qemu+ssh://$hostA_ip/system b

2.1 On host B, if there is no guest running using vnc protocal with port 5900,check whether guest on remote host can be launched.

Result: 
# virt-viewer --direct -c qemu+ssh://$hostA_ip/system cdrom-rhel6u6-x64 
root.4.178's password: 

After input right password, a dialog window pop up:
Failed to connect: Guest 'cdrom-rhel6u6-x64' is not reachable
Then click "Close" button or "x", virt-viewer exit successfully.

2.2 On host B,if there is a guest running using vnc protocal with port 5900:
# virsh dumpxml win7
...
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
# virt-viewer --direct -c qemu+ssh://$hostA_ip/system cdrom-rhel6u6-x64 


Result: same with step2.1.

So move this bug from ON_QA to VERIFIED.

Comment 16 errata-xmlrpc 2015-07-22 06:31:04 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-1322.html