Bug 1172526 - libvirt should forbid add a address for guestfwd type channel
Summary: libvirt should forbid add a address for guestfwd type channel
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-10 10:04 UTC by Luyao Huang
Modified: 2015-11-19 05:57 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:57:59 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2014-12-10 10:04:48 UTC
description of problem:
libvirt should forbid add a address for guestfwd type channel

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


How reproducible:
100%

Steps to Reproduce:

1.prepare a guest have guestfwd type channel and have a address
# virsh dumpxml r6
...
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/r6.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/guestfwd'/>
      <target type='guestfwd' address='0.0.0.0' port='4600'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
...      
2. start the guest
# virsh start r6
Domain r6 started

3.check qemu cmd line there is no settings for the address:

# ps aux|grep qemu
-chardev socket,id=charchannel1,path=/var/lib/libvirt/qemu/guestfwd,server,nowait -netdev user,guestfwd=tcp:0.0.0.0:4600-chardev:charchannel1,id=user-channel1

4.and use dumpxml found the address still in XML:
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/r6.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='unix'>
      <source mode='bind' path='/nfs2/guestfwd'/>
      <target type='guestfwd' address='0.0.0.0' port='4600'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

Actual results:
address in guestfwd is useless and won't build a cmd line for it, we should forbid it.
      
Expected results:
Cannot add a address for guestfwd type channel

Additional info:

Also found we can add any address to this place:

      <address type='drive' controller='0' bus='0' target='0' unit='0'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>

Thanks Martin's patch:


http://www.redhat.com/archives/libvir-list/2014-December/msg00562.html

Comment 1 Martin Kletzander 2014-12-10 10:24:18 UTC
Fixed upstream by v1.2.11-rc1-27-g47a3dd4:

commit 47a3dd46ead20e6fdc30bcdc1b8e707e250d33da
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Wed Dec 10 10:56:09 2014 +0100

    conf: Ignore device address for guestfwd channel

Comment 3 Hu Jianwei 2015-05-07 07:36:04 UTC
Verified as below:

[root@localhost ~]# rpm -q libvirt qemu-kvm-rhev
libvirt-1.2.15-1.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64

Add below lines to domain:

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/guestfwd'/>
      <target type='guestfwd' address='0.0.0.0' port='4600'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

After "virsh edit"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From libvirtd.log

2015-05-07 07:33:40.180+0000: 7093: debug : virFileFindResourceFull:1666 : Resolved 'domain.rng' to '/usr/share/libvirt/schemas/domain.rng'
2015-05-07 07:33:40.187+0000: 7093: debug : virDomainChrDefParseXML:9196 : Ignoring device address for gustfwd channel
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@localhost ~]# virsh dumpxml r71  | grep "</channel" -B4
...
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/guestfwd'/>
      <target type='guestfwd' address='0.0.0.0' port='4600'/>
    </channel>
[root@localhost ~]# virsh start r71
Domain r71 started

[root@localhost ~]# virsh dumpxml r71  | grep "</channel" -B4
...
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/guestfwd'/>
      <target type='guestfwd' address='0.0.0.0' port='4600'/>
      <alias name='channel3'/>
    </channel>

Comment 5 errata-xmlrpc 2015-11-19 05:57:59 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


Note You need to log in before you can comment on or make changes to this bug.