Hide Forgot
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
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
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
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