Bug 1392032 - libvirt use wrong qmp command to hotplug a vhostuser network
Summary: libvirt use wrong qmp command to hotplug a vhostuser network
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: chhu
URL:
Whiteboard:
Depends On: 1366108
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-04 15:44 UTC by Marcel Kolaja
Modified: 2017-01-17 18:27 UTC (History)
10 users (show)

Fixed In Version: libvirt-2.0.0-10.el7_3.3
Doc Type: Bug Fix
Doc Text:
Previously, the libvirt library was using wrong set of commands on the QEMU monitor, when trying to hotplug vhost-user interface to a guest. As a consequence, the hot plug of the vhost-user interface failed. This update corrects the hot-plug code for vhost-user devices. As a result, the hotplug now succeeds as expected.
Clone Of: 1366108
Environment:
Last Closed: 2017-01-17 18:27:44 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0098 0 normal SHIPPED_LIVE libvirt bug fix update 2017-01-17 22:58:08 UTC

Description Marcel Kolaja 2016-11-04 15:44:04 UTC
This bug has been copied from bug #1366108 and has been proposed
to be backported to 7.3 z-stream (EUS).

Comment 6 chhu 2016-12-23 09:38:51 UTC
Failed to verify this bug with packages:

libvirt-2.0.0-10.el7_3.3.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.2.x86_64
kernel-3.10.0-514.6.1.el7.x86_64

Hit qemu-kvm-rhev bug, which block this bug verification:
Bug 1394140 - qemu gets SIGSEGV when hot-plug a vhostuser network.

Comment 7 chhu 2017-01-05 08:34:05 UTC
Verified with packages:
libvirt-2.0.0-10.el7_3.3.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.3.x86_64
kernel: 3.10.0-514.6.1.el7.x86_64

Test steps:
1. Setup the openvswtich dpdk environment, start an guest without vhostuser network.
 	
# virsh start vm
Domain vm started
# virsh dumpxml vm|grep interface -A 5

2. Open another terminal to setup a systemtap of qemu monitor command:
# stap qemu-monitor.stp 
  0.000 begin

3. Attach a vhostuser network successfully.
# cat vhostuser1.xml 
    <interface type='vhostuser'>
      <mac address='52:54:00:5f:cd:11'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

# virsh attach-device vm vhostuser1.xml 
Device attached successfully

# virsh dumpxml vm|grep interface -A 5
    <interface type='vhostuser'>
      <mac address='52:54:00:5f:cd:11'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

4. Check the systemtap of qemu monitor command output: libvirt attach a chardev which backend is socket and then use netdev_add vhost-user net device, then use device_add to add virtio-net-pci

# stap qemu-monitor.stp 
  0.000 begin
136.125 > 0x7fa754011df0 {"execute":"chardev-add","arguments":{"id":"charnet0","backend":{"type":"socket","data":{"addr":{"type":"unix","data":{"path":"/var/run/openvswitch/vhost-user1"}},"wait":false,"server":false}}},"id":"libvirt-14"}
136.129 < 0x7fa754011df0 {"return": {}, "id": "libvirt-14"}
136.129 > 0x7fa754011df0 {"execute":"netdev_add","arguments":{"type":"vhost-user","chardev":"charnet0","id":"hostnet0"},"id":"libvirt-15"}
136.132 < 0x7fa754011df0 {"return": {}, "id": "libvirt-15"}
136.132 > 0x7fa754011df0 {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:5f:cd:11","bus":"pci.0","addr":"0x8"},"id":"libvirt-16"}
136.144 < 0x7fa754011df0 {"return": {}, "id": "libvirt-16"}

5. Attach the second vhostuser network and detach it, check the systemtap of qemu monitor command output: PASS
# virsh attach-device vm vhostuser2.xml
Device attached successfully
# virsh dumpxml vm |grep interface -A 5
    <interface type='vhostuser'>
      <mac address='52:54:00:5f:cd:11'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
    <interface type='vhostuser'>
      <mac address='52:54:00:5f:dd:21'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user2' mode='client'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# stap qemu-monitor.stp
  0.000 begin
 47.410 > 0x7fa754011df0 {"execute":"chardev-add","arguments":{"id":"charnet1","backend":{"type":"socket","data":{"addr":{"type":"unix","data":{"path":"/var/run/openvswitch/vhost-user2"}},"wait":false,"server":false}}},"id":"libvirt-18"}
 47.414 < 0x7fa754011df0 {"return": {}, "id": "libvirt-18"}
 47.414 > 0x7fa754011df0 {"execute":"netdev_add","arguments":{"type":"vhost-user","chardev":"charnet1","id":"hostnet1"},"id":"libvirt-19"}
 47.417 < 0x7fa754011df0 {"return": {}, "id": "libvirt-19"}
 47.417 > 0x7fa754011df0 {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"52:54:00:5f:dd:21","bus":"pci.0","addr":"0x3"},"id":"libvirt-20"}
 47.432 < 0x7fa754011df0 {"return": {}, "id": "libvirt-20"}

Login to the guest:
# lspci | grep Ethernet
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:08.0 Ethernet controller: Red Hat, Inc Virtio network device

# virsh detach-device vm vhostuser2.xml
Device detached successfully

# virsh dumpxml vm |grep interface -A 5
    <interface type='vhostuser'>
      <mac address='52:54:00:5f:cd:11'/>
      <source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>

# stap qemu-monitor.stp
  0.000 begin
  3.349 > 0x7fa754011df0 {"execute":"device_del","arguments":{"id":"net1"},"id":"libvirt-22"}
  3.351 < 0x7fa754011df0 {"return": {}, "id": "libvirt-22"}
  3.411 ! 0x7fa754011df0 {"timestamp": {"seconds": 1483598085, "microseconds": 807355}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/net1/virtio-backend"}}
  3.412 ! 0x7fa754011df0 {"timestamp": {"seconds": 1483598085, "microseconds": 807439}, "event": "DEVICE_DELETED", "data": {"device": "net1", "path": "/machine/peripheral/net1"}}
  3.412 > 0x7fa754011df0 {"execute":"netdev_del","arguments":{"id":"hostnet1"},"id":"libvirt-23"}
  3.416 < 0x7fa754011df0 {"return": {}, "id": "libvirt-23"}
  3.416 > 0x7fa754011df0 {"execute":"chardev-remove","arguments":{"id":"charnet1"},"id":"libvirt-24"}
  3.417 < 0x7fa754011df0 {"return": {}, "id": "libvirt-24"}

Login to the guest:
# lspci|grep Ethernet
00:08.0 Ethernet controller: Red Hat, Inc Virtio network device

Comment 9 errata-xmlrpc 2017-01-17 18:27:44 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-2017-0098.html


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