Bug 598163

Summary: libvirtd should delete its UNIX domain sockets upon daemon shutdown
Product: Red Hat Enterprise Linux 6 Reporter: Michael S. Tsirkin <mst>
Component: libvirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: berrange, crobinso, dallan, hbrock, mjenner, syeghiay, xen-maint, yoyzhang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0_8_1-8_el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-11 14:48:32 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:
Attachments:
Description Flags
Remove UNIX sockets on shutdown none

Description Michael S. Tsirkin 2010-05-31 15:56:20 UTC
Description of problem:
installed libvirt which installed libvirtd but
did not start it. had to reboot to get it started

Version-Release number of selected component (if applicable):
libvirt-0.8.1-7.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. yum install libvirt
2. ls -l /var/run/libvirt/libvirt-sock
3. /etc/rc.d/init.d/libvirtd start
3. yum remove libvirt
4. ls -l /var/run/libvirt/libvirt-sock
  
Actual results:
after install libvirtd is not running and libvirt sock does not exist
after remove libvirtd is sill running and sock is left behind

Expected results:
libvirtd should run after install, reboot should not be required
after remove, should stop libvirtd and remove the sock file, do not leave files behind

Additional info:

Comment 2 Cole Robinson 2010-06-01 17:44:38 UTC
Pretty sure your startup suggestion would violate packaging guidelines:

http://fedoraproject.org/wiki/Packaging:SysVInitScript#Why_don.27t_we....

As for uninstall, we don't take down qemu-kvm processes when uninstalling that package, why should we stop libvirtd when uninstalling it?

Comment 3 Daniel Berrangé 2010-06-02 10:25:19 UTC
We already stop the daemon during uninstall:

%preun
%if %{with_libvirtd}
if [ $1 = 0 ]; then
    /sbin/service libvirtd stop 1>/dev/null 2>&1
    /sbin/chkconfig --del libvirtd
fi
%endif

And I've verified that it works

# ps -axuwfw | grep libvirtd
root      6519  0.0  2.7 620236 21688 ?        Sl   Jun01   0:01 libvirtd --daemon

# rpm -e libvirt
warning: /etc/libvirt/qemu.conf saved as /etc/libvirt/qemu.conf.rpmsave
warning: /etc/libvirt/libvirtd.conf saved as /etc/libvirt/libvirtd.conf.rpmsave

# ps -axuwfw | grep libvirtd


As Cole says, starting the daemon upon install is forbidden by packaging rules.

Comment 4 Michael S. Tsirkin 2010-06-02 11:27:05 UTC
why is  /var/run/libvirt/libvirt-sock left behind then?
Is libvirtd daemon removing it on stop?

Comment 5 Daniel Berrangé 2010-06-03 13:43:54 UTC
Created attachment 419370 [details]
Remove UNIX sockets on shutdown

Comment 7 Dave Allan 2010-06-10 21:31:45 UTC
libvirt-0_8_1-8_el6 has been built in RHEL-6-candidate with the fix.

Dave

Comment 9 zhanghaiyan 2010-07-06 03:21:17 UTC
Verified this bug PASS with libvirt-0.8.1-13.el6.x86_64
- kernel-2.6.32-42.el6.x86_64
- qemu-kvm-0.12.1.2-2.90.el6.x86_64
- qemu-img-0.12.1.2-2.90.el6.x86_64

1. As Cole says, starting the daemon upon install is forbidden by packaging rules. So after new install libvirt package, the libvirtd service is stop status and /var/run/libvirt/libvirt-sock is not generated.

2. After remove libvirt package, libvirtd service is stoped, and /var/run/libvirt/libvirt-sock file is removed.
# yum remove libvirt
......
  Erasing        : libvirt-0.8.1-13.el6.x86_64                              1/1 

Removed:
  libvirt.x86_64 0:0.8.1-13.el6                                                 

Complete!

# service libvirtd status
libvirtd: unrecognized service

# ls -l /var/run/libvirt/libvirt-sock
ls: cannot access /var/run/libvirt/libvirt-sock: No such file or directory

Comment 10 releng-rhel@redhat.com 2010-11-11 14:48:32 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.