Bug 1174154 - libvirt should auto generate a virtio-serial when cold plug a agent
Summary: libvirt should auto generate a virtio-serial when cold plug a agent
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: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-15 09:48 UTC by Luyao Huang
Modified: 2015-11-19 05:58 UTC (History)
5 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:58:32 UTC
Target Upstream Version:


Attachments (Terms of Use)


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

Description Luyao Huang 2014-12-15 09:48:28 UTC
description of problem:
libvirt should auto generate a virtio-serial when cold plug a agent

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 do not have a virtio-serial controller
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0' model='none'/>
    <controller type='pci' index='0' model='pci-root'/>
    <memballoon model='none'/>
  </devices>

2.cold plug a agent device
# cat agent.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'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

3.# virsh attach-device test4 agent.xml --config
Device attached successfully

4.no virtio-serial controller in guest XML:
# virsh dumpxml test4
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0' model='none'/>
    <controller type='pci' index='0' model='pci-root'/>
    <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>
    <memballoon model='none'/>
  </devices>


5.# virsh start test4
error: Failed to start domain test4
error: internal error: early end of file from monitor: possible problem:
2014-12-11T02:40:30.480485Z qemu-kvm: -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0: Bus 'virtio-serial0.0' not found

6.try to start it again:
# virsh start test4
Domain test4 started

Actual results:
libvirt forget add a virtio-serial controller when add a agent

      
Expected results:
libvirt auto generate a virtio-serial controller when cold plug a agent

Additional info:

Also found the issue when coldplug a hostdev device

Comment 1 Michal Privoznik 2014-12-15 15:26:25 UTC
I've just pushed the patch upstream:

commit 98dee717597a8ad3e7c7728aed0643e84b6140de
Author:     Luyao Huang <lhuang@redhat.com>
AuthorDate: Mon Dec 15 17:49:54 2014 +0800
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Mon Dec 15 16:24:01 2014 +0100

    qemu: Auto generate a controller when attach hostdev and chr device
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1174154
    
    When we use attach-device add a hostdev or chr device which have a
    iscsi address or others (just like guest agent, subsys iscsi disk...),
    we will find there is no basic controller for our new attached device.
    Somtimes this will make guest cannot start after we add them (although
    they can start at the second time).
    
    Signed-off-by: Luyao Huang <lhuang@redhat.com>


v1.2.11-19-g98dee71

Comment 3 zhenfeng wang 2015-05-22 07:53:45 UTC
I can reproduce this bug with libvirt-1.2.8-10.el7.x86_64, also can get expect result with libvirt-1.2.15-2.el7.x86_64. Verify steps as following

1.prepare a guest do not have a virtio-serial controller
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0' model='none'/>
    <controller type='pci' index='0' model='pci-root'/>
    <memballoon model='none'/>
  </devices>

2.cold plug a agent device
# cat agent.xml
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.0.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
    </channel>

#cat spicevmc.xml
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
    </channel>

3.# virsh attach-device 7.0 agent.xml --config
Device attached successfully

# virsh attach-device 7.0 spicevmc.xml --config
Device attached successfully

4.Check the guest's xml, could fond the libvirt add the virtio-serial controller
automatically

# virsh dumpxml 7.0 
--
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0' model='none'/>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'/>
--
 <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.0.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
    </channel>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
    </channel>
 </devices>

5.Start guest, guest could start successfully, also guest agent, spicevmc could get the virtio-serial address
# virsh start 7.0
Domain 7.0 started
#virsh dumpxml 7.0
--
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/7.0.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0' state='connected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

6.Destroy guest, then restart libvirtd, the guest also could start successfully
#service libvirtd restart
#virsh start 7.0

According to the upper steps, mark this bug verifed

Comment 5 errata-xmlrpc 2015-11-19 05:58:32 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.