Bug 1351892

Summary: vhost-user: A socket file is not deleted after VM's port is detached.
Product: Red Hat Enterprise Linux 7 Reporter: Marcel Kolaja <mkolaja>
Component: qemu-kvm-rhevAssignee: Marc-Andre Lureau <marcandre.lureau>
Status: CLOSED ERRATA QA Contact: Pei Zhang <pezhang>
Severity: medium Docs Contact:
Priority: high    
Version: 7.2CC: ailan, areis, atragler, chayang, dmaley, editucci, huding, jdonohue, jherrman, john.joyce, jonshin, juzhang, knoel, marcandre.lureau, mst, pezhang, victork, virt-maint, xfu, xiywang
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.3.0-31.el7_2.18 Doc Type: Bug Fix
Doc Text:
Previously, deleting a guest virtual machine set up as a vhost-user server caused the socket file on the host machine to be preserved. This update adjusts the guest clean-up mechanism to ensure that in the described situation, the socket file is deleted as expected.
Story Points: ---
Clone Of: 1347077 Environment:
Last Closed: 2016-08-12 13:21:55 UTC Type: ---
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: 1347077    
Bug Blocks:    

Description Marcel Kolaja 2016-07-01 07:07:21 UTC
This bug has been copied from bug #1347077 and has been proposed
to be backported to 7.2 z-stream (EUS).

Comment 3 Miroslav Rezanina 2016-07-08 06:28:13 UTC
Fix included in qemu-kvm-rhev-2.3.0-31.el7_2.18

Comment 4 Pei Zhang 2016-07-12 07:43:32 UTC
Reproduced:
Versions:
qemu-kvm-rhev-2.3.0-31.el7_2.17.x86_64
Steps:
1. Run a slirp/vlan in a background process
# /usr/libexec/qemu-kvm \
-net none \
-net socket,vlan=0,udp=localhost:4444,localaddr=localhost:5555 \
-net user,vlan=0

2. Start qemu with vhost-user as server mode
# /usr/libexec/qemu-kvm  -m 1024 -smp 2 \
-object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on \
-numa node,memdev=mem -mem-prealloc \
-chardev socket,id=char0,path=/tmp/vubr.sock,server \
-netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \
-device virtio-net-pci,netdev=mynet1,mac=54:52:00:1a:2c:01 \
/home/pezhang/rhel7.3.qcow2 \
-monitor stdio \
-vga std -vnc :10 \

3. Start vubr as vhostuser client
# ./vhost-user-bridge -c

4. Check socket file
# ll /tmp/vubr.sock 
srwxr-xr-x. 1 root root 0 Jul 12 14:48 /tmp/vubr.sock

5. Shutdown guest
(qemu) system_powerdown 
or
in guest:
# shutdown -h now 

6. Check socket file again, it still exists.
# ll /tmp/vubr.sock 
srwxr-xr-x. 1 root root 0 Jul 12 14:48 /tmp/vubr.sock

So this bug has been reproduced.

Verified: 
Versions:
qemu-kvm-rhev-2.3.0-31.el7_2.18.x86_64

Steps:
1. Run a slirp/vlan in a background process
2. Start qemu with vhost-user as server mode
3. Start vubr as vhostuser client

4. Check socket file
# ll /tmp/vubr.sock srwxr-xr-x. 1 root root 0 Jul 12 15:01 /tmp/vubr.sock

5. Shutdown guest. Guest can be shutdown, but qemu prompt warning messages.
(qemu) system_powerdown 
(qemu) 
(process:16842): GLib-CRITICAL **: g_io_channel_write_chars: assertion 'channel != NULL' failed

(process:16842): GLib-CRITICAL **: g_io_channel_write_chars: assertion 'channel != NULL' failed

'# shutdown -h now' hit same issue.
 

6. Check socket file again, it has been deleted.
# ll /tmp/vubr.sock 
ls: cannot access /tmp/vubr.sock: No such file or directory


So this bug has been fixed. Thank you.

But in step5, qemu prints code level messages, seems it doesn't quit well. Maybe it's not a problem, but I am not quite sure and file a new bug[1] here to find more opinions:
[1]Bug 1355659 - Boot guest with vhostuser server mode, QEMU prompt code level message after shutdown guest

Comment 5 Marc-Andre Lureau 2016-07-12 10:30:33 UTC
(In reply to Pei Zhang from comment #4)
> 5. Shutdown guest. Guest can be shutdown, but qemu prompt warning messages.
> (qemu) system_powerdown 
> (qemu) 
> (process:16842): GLib-CRITICAL **: g_io_channel_write_chars: assertion
> 'channel != NULL' failed
> 
> (process:16842): GLib-CRITICAL **: g_io_channel_write_chars: assertion
> 'channel != NULL' failed
> 
> '# shutdown -h now' hit same issue.
>  
> 
> 6. Check socket file again, it has been deleted.
> # ll /tmp/vubr.sock 
> ls: cannot access /tmp/vubr.sock: No such file or directory
> 
> 
> So this bug has been fixed. Thank you.
> 
> But in step5, qemu prints code level messages, seems it doesn't quit well.
> Maybe it's not a problem, but I am not quite sure and file a new bug[1] here
> to find more opinions:

This is being worked on in bug 1354090.

Comment 7 Pei Zhang 2016-07-20 11:47:17 UTC
Re-verification this bug with qemu-kvm-rhev-2.3.0-31.el7_2.19.x86_64. Every step(above step 1~6) works well as expected. Thank you.

Comment 11 errata-xmlrpc 2016-08-12 13:21:55 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-2016-1614.html