Bug 730911

Summary: 'virt-viewer --direct --connect' fails to connect remote vms.
Product: Red Hat Enterprise Linux 6 Reporter: Huming Jiang <hjiang>
Component: virt-viewerAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dallan, jwu, mzhan, rwu, zpeng
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-viewer-0.4.1-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:07:23 UTC Type: ---
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:    
Bug Blocks: 743047    

Description Huming Jiang 2011-08-16 08:18:02 UTC
Description of problem:
If you use 'virt-viewer --direct --connect' with an remote IP address to connect a vm, virt-viewer will connect to the graphic server 0.0.0.0:5900, and could not connect the remote vm you have selected.

Version-Release number of selected component (if applicable):
virt-viewer-0.4.1-3.el6.x86_64

How reproducible:
Always

Steps to Reproduce:

1.Make sure your local host has no running vm.
  #virt-viewer --direct --connect=qemu+ssh://10.66.3.130/system rh

  There will be an error pop-up:"Unable to connect to the graphic server 0.0.0.0:5900"

2.If there is an vm running on your local host, 
  #virsh dumpmxl rh6-copy-clone
...
    <graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
  #virt-viewer --direct --connect=qemu+ssh://10.66.3.130/system rh
  Then the vm 'rh6-copy-clone' on the local host will be opened.
  
Actual results:
See the description in the 'Steps to Reproduce'.

Expected results:
Virt-viewer should open the remote vm.

Additional info:

Comment 2 Daniel Berrangé 2011-09-19 11:13:02 UTC
This regression is caused by the following upstream patch

commit 6c477650ca3497eb56fa273a421f72d4d8f9aca1
Author: Jiri Denemark <Jiri.Denemark>
Date:   Mon May 23 12:15:05 2011 +0100

    Add support for listen attribute
    
    Virt-viewer now parses listen attribute from graphics element to be able
    to connect to domains configured with explicit listen address:
    
        <graphics type='vnc' port='-1' autoport='yes' listen='123.45.67.89'/>


The patch is fine in the case where the XML gives an explicit address, but for a wildcard address like 0.0.0.0 it clearly does not work.

In the latter case we'll need to fallback to use the hostname from the libvirt URI as with previous releases.

Comment 4 Daniel Berrangé 2011-09-19 16:49:06 UTC
Note for testing, there are three guest configurations that should be tested

 1. No listen attribute

      <graphics type='vnc' port='-1' autoport='yes'/>

 2. Specific listen attribute

      <graphics type='vnc' port='-1' autoport='yes' listen='123.45.67.89'/>

 3. Wildcard listen attribute

      <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>


These need to be tested with two command lines:

 1. Tunnelled over ssh:

  virt-viewer -c qemu+ssh://root.and.domain/system vm-name

 2. Direct connection

  virt-viewer --direct -c qemu+ssh://root.and.domain/system vm-name

Comment 6 Daisy Wu 2011-09-21 06:40:15 UTC
The issue 'virt-viewer --direct --connect' fails to connect remote vms' can reproduce on version:
virt-viewer-0.4.1-3.el6.x86_64

Verified on version:
virt-viewer-0.4.1-5.el6.x86_64

Environment:
kernel-2.6.32-191.el6.x86_64
libvirt-0.9.4-11.el6
python-virtinst-0.600.0-3.el6
qemu-kvm-0.12.1.2-2.185.el6
virt-manager-0.9.0-6.el6
virt-viewer-0.4.1-5.el6.x86_64

Prepared two host and a remote vm:
local host
remote host 
remote vm named xpi386

Detail Steps:
1.Make sure local host has no running vm.
logon the local host:
#virt-viewer --direct --connect=qemu+ssh://remotehostIP/system xpi386

There will be an error pop-up:"Unable to connect to the graphic server
0.0.0.0:5900"

2.If there is an vm running on local host,
#virsh dumpmxl win2008x64
...
<graphics type='vnc' port='5900' autoport='yes'/>
...
#virt-viewer --direct --connect=qemu+ssh://remotehostIP/system xpi386
Then the vm 'win2008x64' on the local host will be opened.

3. No listen attribute:
#virsh dumpmxl xpi386
<graphics type='vnc' port='-1' autoport='yes'/>
logon the local host:
a. #virt-viewer -c qemu+ssh://root@remotehostIP/system xpi386
The remote vm 'xpi386' opened successfully through virt-viewer.
b. #virt-viewer --direct -c qemu+ssh://root@remotehostIP/system xpi386
The remote vm 'xpi386' can not open,error pop up: "Unable to connect to the graphic server localhost:5900"
logon the remote host:
#virt-viewer --direct -c qemu+ssh://root@remotehostIP/system xpi386
The remote vm 'xpi386' opened successfully through virt-viewer.

4. Specific listen attribute:
#virsh dumpmxl xpi386
<graphics type='vnc' port='-1' autoport='yes' listen='10.66.6.23'/>
<listen type='address' address='10.66.6.23'/>

logon the local host:
#virt-viewer -c qemu+ssh://root@remotehostIP/system xpi386
#virt-viewer --direct -c qemu+ssh://root@remotehostIP/system xpi386
The remote vm 'xpi386' opened successfully through virt-viewer.

5. Wildcard listen attribute:
#virsh dumpmxl xpi386
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>

logon on the local host:
#virt-viewer -c qemu+ssh://root@remotehostIP/system xpi386
#virt-viewer --direct -c qemu+ssh://root@remotehostIP/system xpi386
The remote vm 'xpi386' opened successfully through virt-viewer.

Comment 7 errata-xmlrpc 2011-12-06 15:07:23 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.

http://rhn.redhat.com/errata/RHEA-2011-1614.html