Bug 1459091
| Summary: | virsh domiflist return NULL for the vhostuser interface name and source | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | chhu | |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | |
| Status: | CLOSED ERRATA | QA Contact: | chhu | |
| Severity: | high | Docs Contact: | ||
| Priority: | high | |||
| Version: | 7.4 | CC: | dyuan, jherrman, jraju, jsuchane, mabaakou, rbalakri, rhodain, xuzhang, yalzhang | |
| Target Milestone: | rc | Keywords: | Upstream, ZStream | |
| Target Release: | --- | |||
| Hardware: | x86_64 | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | libvirt-3.7.0-1.el7 | Doc Type: | Bug Fix | |
| Doc Text: |
Prior to this update, the name of vhostuser interfaces were in some cases missing from XML configurations of virtual machines (VMs). Now, vhostuser interfaces are queried during VM startup instead of during VM defining, and the interface names are thus set up in the XM configuration correctly.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 1627781 (view as bug list) | Environment: | ||
| Last Closed: | 2018-04-10 10:46:43 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: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1397940, 1473046, 1627781 | |||
I'm guessing this commit is missing: http://libvirt.org/git/?p=libvirt.git;a=commit;h=57b5e27d3d74f8dbb77ac909b405d99d555eca46 (In reply to Mehdi ABAAKOUK from comment #2) > I'm guessing this commit is missing: > http://libvirt.org/git/?p=libvirt.git;a=commit; > h=57b5e27d3d74f8dbb77ac909b405d99d555eca46 Build libvirt-3.2.0-7.el7 contains that commit. Something else might be missing. Per comment https://bugzilla.redhat.com/show_bug.cgi?id=1397940#c10 I am moving this one to rhel-7.5. Patches proposed upstream: https://www.redhat.com/archives/libvir-list/2017-June/msg00392.html I've pushed patches online:
commit f3908d8557dc609e2262099d76c57b0bcc4b0917
Author: Michal Privoznik <mprivozn>
AuthorDate: Thu Jun 8 14:58:22 2017 +0200
Commit: Michal Privoznik <mprivozn>
CommitDate: Thu Jun 8 15:02:23 2017 +0200
virNetDevOpenvswitchGetVhostuserIfname: Fix off by one error
https://bugzilla.redhat.com/show_bug.cgi?id=1459091
We try to get the last element of the passed path by calling
strrch(path, '/'). However, the pointer that strrchr() returns
points at the slash, We want string that starts right after that.
Signed-off-by: Michal Privoznik <mprivozn>
commit 2a13a0a103340878b05a5ae0b9f454721f67dbb3
Author: Michal Privoznik <mprivozn>
AuthorDate: Wed Jun 7 15:43:58 2017 +0200
Commit: Michal Privoznik <mprivozn>
CommitDate: Thu Jun 8 15:02:22 2017 +0200
qemu: Query for vhostuser iface names at runtime
https://bugzilla.redhat.com/show_bug.cgi?id=1459091
Currently, we are querying for vhostuser interface name in post
parse callback. At that time interface might not yet exist.
However, it has to exist when starting domain. Therefore it makes
more sense to query its name at that point. This partially
reverts 57b5e27.
Signed-off-by: Michal Privoznik <mprivozn>
v3.4.0-66-gf3908d855
Test on libvirt-3.7.0-2.el7.x86_64, the result is as expected, set this bug to be verified.
1. start the guest with vhostuser interface without <target dev=...> element, check the xml
# virsh dumpxml vhost1 --inactive | grep /interface -B5
<interface type='vhostuser'>
<mac address='52:54:00:93:51:db'/>
<source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<== no <target dev=...> set in inactive xml
# virsh dumpxml vhost1 | grep /interface -B7
<interface type='vhostuser'>
<mac address='52:54:00:93:51:db'/>
<source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
<target dev='vhost-user1'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<== the "<target dev='vhost-user1'/>" will generate automatically in the active xml
2. domiflist get the interface name
# virsh domiflist vhost1
Interface Type Source Model MAC
-------------------------------------------------------
vhost-user1 vhostuser - virtio 52:54:00:93:51:db
# virsh domiflist vhost1 --inactive
Interface Type Source Model MAC
-------------------------------------------------------
- vhostuser - virtio 52:54:00:93:51:db
3. set <target dev> in xml
# virsh dumpxml vhost1 --inactive | grep /interface -B6
<interface type='vhostuser'>
<mac address='52:54:00:93:51:db'/>
<source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
<target dev='blah'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<=== set <target dev='blah'/> in xml
# virsh dumpxml vhost1 | grep /interface -B7
<interface type='vhostuser'>
<mac address='52:54:00:93:51:db'/>
<source type='unix' path='/var/run/openvswitch/vhost-user1' mode='client'/>
<target dev='vhost-user1'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<=== when the vm start, the target dev will be override
4. check by domiflist for the interface name
# virsh domiflist vhost1
Interface Type Source Model MAC
-------------------------------------------------------
vhost-user1 vhostuser - virtio 52:54:00:93:51:db
# virsh domiflist vhost1 --inactive
Interface Type Source Model MAC
-------------------------------------------------------
blah vhostuser - virtio 52:54:00:93:51:db
# virsh domifstat vhost1 blah
error: Failed to get interface stats vhost1 blah
error: invalid argument: invalid path, 'blah' is not a known interface
# virsh domifstat vhost1 vhost-user1
vhost-user1 rx_bytes 132144
vhost-user1 rx_packets 1375
vhost-user1 rx_drop 0
vhost-user1 tx_bytes 133096
vhost-user1 tx_packets 1387
vhost-user1 tx_errs 0
vhost-user1 tx_drop 0
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://access.redhat.com/errata/RHEA-2018:0704 |
Description of problem: virsh domiflist return NULL for the vhostuser interface name and source Version-Release number of selected component (if applicable): libvirt-3.2.0-7.el7.x86_64 qemu-kvm-rhev-2.9.0-7.el7.x86_64 kernel-3.10.0-677.el7.x86_64 Test steps: 1. Prepare guest with xml: <memoryBacking> <hugepages> <page size='2048' unit='KiB'/> </hugepages> </memoryBacking> ...... <cpu mode='custom' match='exact' check='full'> <model fallback='forbid'>Broadwell</model> ...... <feature policy='require' name='abm'/> <numa> <cell id='0' cpus='0-1' memory='1048576' unit='KiB' memAccess='shared'/> </numa> </cpu> ...... <interface type='vhostuser'> <mac address='52:54:01:93:55b'/> <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> 2. Start the guests with vhostuser interface #virsh start r7-4t1 Domain r7-4t1 started #virsh list --all Id Name State ---------------------------------------------------- 6 r7-4t1 running #virsh dumpxml r7-4t1| grep interface -A 10 <interface type='vhostuser'> <mac address='52:54:01:93:55b'/> <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> #ps -ef|grep qemu-kvm| grep vhost qemu 7408 1 0 May22 ? 00:03:12 /usr/libexec/qemu-kvm -name guest=r7-4t1,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-8-r7-4t1/master-key.aes -machine pc-i440fx-rhel7.4.0,accel=kvm,usb=off,dump-guest-core=off ...... -chardev socket,id=charnet0,path=/var/run/openvswitch/vhost-user1 -netdev vhost-user,chardev=charnet0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:01:93:55b,bus=pci.0,addr=0x8 -chardev pty,id=charserial0 ...... 3. Check the virsh domiflist: no Interface is listed #virsh domiflist r7-4t1 Interface Type Source Model MAC ------------------------------------------------------- - vhostuser - virtio 52:54:01:93:55b 4. Can't get the network statistics by `virsh domifstat <domain> <interface>` #virsh domifstat r7-4t1 vhostuser1 error: Failed to get interface stats r7-4t1 vhostuser1 error: invalid argument: invalid path, 'vhostuser1' is not a known interface # virsh domifstat r7-4t1 vhostuser error: Failed to get interface stats r7-4t1 vhostuser error: invalid argument: invalid path, 'vhostuser' is not a known interface #virsh domifstat r7-4t1 eth0 error: Failed to get interface stats r7-4t1 eth0 error: invalid argument: invalid path, 'eth0' is not a known interface Actual results: In step3, the virsh domiflist return NULL for the vhostuser interface name and source Expected results: In step3, the virsh domiflist return the vhostuser interface name and source