tag 730604 + patch
thanks

Hi,

I've attached here the patch to rename the .service file.

I've tested it locally and libvirt is properly restarted as expected.

Please note, the libvirt daemon and newly spawned VM are now started in
an other cgroup (systemd start the processes in a cgroup matching
the .service name). The processes spawned before the rename are still
living their live, but in a different cgroup.

Cheers,

Laurent Bigonville
>From ec97b8a0cd12717dd1c9cefe78aaf686a343e489 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bi...@debian.org>
Date: Sun, 23 Feb 2014 13:26:21 +0100
Subject: [PATCH] Rename the .service file back to the upstream name

Rename libvirt-bin.service file back to the upstream (libvirtd.service)
name. We also now create a symlink to mask LSB script.

In the process systemd might become confused, so we need to be sure to
properly stop the libvirtd daemon before trying to restart it again

Closes: #730604
---
 debian/libvirt-bin.postinst                                 | 10 ++++++++++
 debian/patches/debian/Debianize-systemd-service-files.patch | 11 +----------
 debian/rules                                                |  7 +++++--
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/debian/libvirt-bin.postinst b/debian/libvirt-bin.postinst
index b3df139..1cd09ab 100644
--- a/debian/libvirt-bin.postinst
+++ b/debian/libvirt-bin.postinst
@@ -96,6 +96,16 @@ case "$1" in
         add_users_groups
         add_statoverrides
 
+	# When renaming the .service file, systemd might become confused, we
+	# need to ensure that the libvirtd daemon is fully stopped before
+	# trying to restart it again. (Bug: #730604)
+	if dpkg --compare-versions "$2" le-nl "1.2.1-3~"; then
+	    if [ -d /run/systemd/system ]; then
+	        start-stop-daemon --stop --quiet --pidfile /var/run/libvirtd.pid \
+		    --oknodo --exec /usr/sbin/libvirtd --retry 1
+	    fi
+	fi
+
 	# Make sure the directories don't get removed on package removal since
 	# logrotate chokes otherwise.
 	for dir in qemu uml lxc; do
diff --git a/debian/patches/debian/Debianize-systemd-service-files.patch b/debian/patches/debian/Debianize-systemd-service-files.patch
index 4007d92..7065f21 100644
--- a/debian/patches/debian/Debianize-systemd-service-files.patch
+++ b/debian/patches/debian/Debianize-systemd-service-files.patch
@@ -7,8 +7,6 @@ Subject: Debianize systemd service files
  tools/libvirt-guests.service.in | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
 
-diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
-index dc2433a..3c2a6b8 100644
 --- a/daemon/libvirtd.service.in
 +++ b/daemon/libvirtd.service.in
 @@ -13,8 +13,8 @@ Documentation=man:libvirtd(8)
@@ -22,16 +20,9 @@ index dc2433a..3c2a6b8 100644
  ExecReload=/bin/kill -HUP $MAINPID
  KillMode=process
  Restart=on-failure
-diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
-index d8d7adf..e743edd 100644
 --- a/tools/libvirt-guests.service.in
 +++ b/tools/libvirt-guests.service.in
-@@ -1,11 +1,11 @@
- [Unit]
- Description=Suspend Active Libvirt Guests
--After=network.target libvirtd.service
-+After=network.target libvirt-bin.service
- Documentation=man:libvirtd(8)
+@@ -5,7 +5,7 @@ Documentation=man:libvirtd(8)
  Documentation=http://libvirt.org
  
  [Service]
diff --git a/debian/rules b/debian/rules
index 700cc39..38f32ba 100755
--- a/debian/rules
+++ b/debian/rules
@@ -140,8 +140,11 @@ override_dh_install:
 	    debian/libvirt-bin.libvirt-guests.init
 	cp tools/libvirt-guests.sysconf \
 	    debian/libvirt-bin.libvirt-guests.default
-	-mv debian/libvirt-bin/lib/systemd/system/libvirtd.service \
-	    debian/libvirt-bin/lib/systemd/system/libvirt-bin.service
+
+	if [ -f debian/libvirt-bin/lib/systemd/system/libvirtd.service ]; then \
+		ln -s /lib/systemd/system/libvirtd.service \
+		    debian/libvirt-bin/lib/systemd/system/libvirt-bin.service; \
+	fi
 
 	for l in $(LOGROTATE); do \
 		cp $(CURDIR)/debian/build/daemon/$$l.logrotate \
-- 
1.9.0

Reply via email to