Bug 598163 - libvirtd should delete its UNIX domain sockets upon daemon shutdown
libvirtd should delete its UNIX domain sockets upon daemon shutdown
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-31 11:56 EDT by Michael S. Tsirkin
Modified: 2010-11-11 09:48 EST (History)
8 users (show)

See Also:
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 09:48:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Remove UNIX sockets on shutdown (8.01 KB, patch)
2010-06-03 09:43 EDT, Daniel Berrange
no flags Details | Diff

  None (edit)
Description Michael S. Tsirkin 2010-05-31 11:56:20 EDT
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 13:44:38 EDT
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 Berrange 2010-06-02 06:25:19 EDT
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 07:27:05 EDT
why is  /var/run/libvirt/libvirt-sock left behind then?
Is libvirtd daemon removing it on stop?
Comment 5 Daniel Berrange 2010-06-03 09:43:54 EDT
Created attachment 419370 [details]
Remove UNIX sockets on shutdown
Comment 7 Dave Allan 2010-06-10 17:31:45 EDT
libvirt-0_8_1-8_el6 has been built in RHEL-6-candidate with the fix.

Dave
Comment 9 zhanghaiyan 2010-07-05 23:21:17 EDT
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 09:48:32 EST
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.

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