Bug 1174073

Summary: The listen address for vnc is changed after conversion by virt-v2v
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.1CC: dyuan, juzhou, mbooth, mzhan, ptoscano
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.30.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:58:16 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 tingting zheng 2014-12-15 05:01:28 UTC
Description
When using virt-v2v to convert a guest with vnc,the listen address for vnc is changed after conversion,refer to rhel6 bug for old version of virt-v2v :bug 821730#c7

Version:
virt-v2v-1.28.1-1.17.el7.x86_64
libguestfs-1.28.1-1.17.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Before conversion:set the VNC guest listen on all public network interfaces,namely the address:0.0.0.0
#virsh dumpxml rhel7
   <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>

2.Use virt-v2v to convert the guest:
# virt-v2v -ic xen+ssh://10.66.106.64 -os default -n virbr0 rhel7 -of raw
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 rhel7
[  17.0] Creating an overlay to protect the source from being modified
[  31.0] Opening the overlay
[ 241.0] Initializing the target -o libvirt -os default
[ 241.0] Inspecting the overlay
[ 251.0] Checking for sufficient free disk space in the guest
[ 251.0] Estimating space required on target for each disk
[ 251.0] Converting Red Hat Enterprise Linux Server release 7.0 Beta (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 315.0] Mapping filesystem data to avoid copying unused and blank areas
[ 316.0] Closing the overlay
[ 316.0] Copying disk 1/1 to /var/lib/libvirt/images/rhel7-sda (raw)
    (100.00/100%)
[ 393.0] Creating output metadata
Pool default refreshed

Domain rhel7 defined from /tmp/v2vlibvirt01d9a1.xml

[ 394.0] Finishing off

3.After conversion:the guest only listen from local host,namely the address:127.0.0.1
#virsh dumpxml rhel7 
        <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>


Actual results:
When using virt-v2v to convert a guest with vnc,the listen address for vnc is changed after conversion.

Expected results:
When using virt-v2v to convert a guest with vnc,the listen address for vnc is kept the same after conversion.

Additional info:

Comment 1 Richard W.M. Jones 2014-12-15 10:25:42 UTC
Although it's a fairly simple change to make this work, I think
deferring it to RHEL >= 7.2 is the correct decision because:

 - old virt-v2v had the same missing feature

 - the listen address is more restrictive than before conversion, so
   it doesn't open any security holes

 - users can work around easily by adjusting the libvirt XML

 - it's risky to add new features just before RHEL 7.1 is released

Comment 2 Pino Toscano 2015-04-14 09:18:52 UTC
Fixed upstream with
https://github.com/libguestfs/libguestfs/commit/9360675dc244a8762e07a8a4289e7a30ca3e1eef
which is in libguestfs >= 1.29.34.

Comment 4 tingting zheng 2015-04-27 08:05:34 UTC
1.Prepare a guest with vnc graphics type,which listens to '0.0.0.0'
# virsh -c xen+ssh://10.66.106.64 dumpxml rhel7
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>

2.Use virt-v2v to convert the guest.
# virt-v2v -ic xen+ssh://10.66.106.64 -os default -b br1 rhel7 -of raw -on rhel7-vncaddress-test
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 rhel7
[   0.0] Creating an overlay to protect the source from being modified
[   1.0] Opening the overlay
[   7.0] Initializing the target -o libvirt -os default
[   7.0] Inspecting the overlay
[  16.0] Checking for sufficient free disk space in the guest
[  16.0] Estimating space required on target for each disk
[  16.0] Converting Red Hat Enterprise Linux Server release 7.0 Beta (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  86.0] Mapping filesystem data to avoid copying unused and blank areas
[  87.0] Closing the overlay
[  87.0] Copying disk 1/1 to /var/lib/libvirt/images/rhel7-vncaddress-test-sda (raw)
    (100.00/100%)
[ 160.0] Creating output metadata
Pool default refreshed

Domain rhel7-vncaddress-test defined from /tmp/v2vlibvirt13d108.xml

3.After conversion,check the xml of guest.
# virsh dumpxml rhel7-vncaddress-test
   <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1' keymap='en-us'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

Refer to comment 3,the listen address has been changed to '127.0.0.1'.

So the bug is not fixed yet,would you pls help to check it?thanks.

Comment 5 Pino Toscano 2015-04-27 08:16:47 UTC
(In reply to tingting zheng from comment #4)
> 1.Prepare a guest with vnc graphics type,which listens to '0.0.0.0'
> # virsh -c xen+ssh://10.66.106.64 dumpxml rhel7
>     <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'
> keymap='en-us'/>

The libvirt documentation [1] seems to recommend a separate <listen> child node rather than an address="" attribute in <graphics> though, as it is more detailed, and v2v supports that so far. I will add support for the old format as well in case <listen> is missing, but you should better use the new one.

[1] http://libvirt.org/formatdomain.html#elementsGraphics

Comment 6 tingting zheng 2015-04-27 08:32:40 UTC
(In reply to Pino Toscano from comment #5)
> (In reply to tingting zheng from comment #4)
> > 1.Prepare a guest with vnc graphics type,which listens to '0.0.0.0'
> > # virsh -c xen+ssh://10.66.106.64 dumpxml rhel7
> >     <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'
> > keymap='en-us'/>
> 
> The libvirt documentation [1] seems to recommend a separate <listen> child
> node rather than an address="" attribute in <graphics> though, as it is more
> detailed, and v2v supports that so far. I will add support for the old
> format as well in case <listen> is missing, but you should better use the
> new one.
> 
> [1] http://libvirt.org/formatdomain.html#elementsGraphics

The guest exist on xen server which is rhel5 system,and this is the default configuration.

Also tried the new way on xen server,it just ignores address line,so I think the new way on xen server is not supported as it's too old.

Comment 7 tingting zheng 2015-04-27 08:36:22 UTC
Refer to comment 4,5,6,move this bug back to ASSIGNED.

Comment 9 tingting zheng 2015-07-02 08:38:47 UTC
Tested with:
libvirt-1.2.16-1.el7.x86_64
virt-v2v-1.28.1-1.42.el7.x86_64
qemu-kvm-1.5.3-92.el7.x86_64

1.Prepare a guest with vnc graphics type,which listens to '0.0.0.0'
# virsh -c xen+ssh://10.66.106.64 dumpxml rhel7
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>

2.Use virt-v2v to convert the guest.
# virt-v2v -ic xen+ssh://10.66.106.64 -os default -b virbr0 rhel7 -of raw -on rhel7-vncaddress-test
[   0.0] Opening the source -i libvirt -ic xen+ssh://10.66.106.64 rhel7
[   1.0] Creating an overlay to protect the source from being modified
[   1.0] Opening the overlay
[  11.0] Initializing the target -o libvirt -os default
[  11.0] Inspecting the overlay
[  23.0] Checking for sufficient free disk space in the guest
[  23.0] Estimating space required on target for each disk
[  23.0] Converting Red Hat Enterprise Linux Server release 7.0 Beta (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  90.0] Mapping filesystem data to avoid copying unused and blank areas
[  91.0] Closing the overlay
[  91.0] Copying disk 1/1 to /var/lib/libvirt/images/rhel7-vncaddress-test-sda (raw)
    (100.00/100%)
[ 329.0] Creating output metadata
Pool default refreshed

Domain rhel7-vncaddress-test defined from /tmp/v2vlibvirt23ff44.xml

[ 330.0] Finishing off

3.After conversion,check the listen address for guest,it is the same as before.
# virsh dumpxml rhel7-vncaddress-test
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

Refer to the above comments,move the bug to VERIFIED.

Comment 10 tingting zheng 2015-07-02 08:41:57 UTC
Miss this comment:
For the new format of graphics,it is not supported on xen server,as v2v supports conversion kvm guests running on rhel7 to RHEV,guests graphics defaults to spice on rhev,so I didn't test the new format of graphics.

Comment 12 errata-xmlrpc 2015-11-19 06:58:16 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-2183.html