diff mbox series

[G/F/B/X,1/2] UBUNTU: [Packaging] Bind hv_vss_daemon startup to hv_vss device

Message ID 20200824165948.476427-2-marcelo.cerri@canonical.com
State New
Headers show
Series LP:#1891224 - [Hyper-V] VSS and File Copy daemons intermittently fails to start | expand

Commit Message

Marcelo Henrique Cerri Aug. 24, 2020, 4:59 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1891224

Update the systemd service for the vss daemon and add a new udev rule
to ensure the service will not fail in case vss is not enabled for the
guest.

The udev rules is responsible for starting the service only when the
vss device is available. In the unit file, the service is now bound to
the device unit, so the service can be stopped if the device is
removed. And the service is also conditioned to the existence of the
device, this way we avoid starting and stopping the service during
boot if the device is not available.

Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 debian/linux-cloud-tools-common.hv-vss-daemon.service | 2 ++
 debian/linux-cloud-tools-common.hv-vss-daemon.udev    | 1 +
 debian/rules.d/3-binary-indep.mk                      | 1 +
 3 files changed, 4 insertions(+)
 create mode 100644 debian/linux-cloud-tools-common.hv-vss-daemon.udev
diff mbox series

Patch

diff --git a/debian/linux-cloud-tools-common.hv-vss-daemon.service b/debian/linux-cloud-tools-common.hv-vss-daemon.service
index 20717a7bd159..4ff9e796b3b2 100644
--- a/debian/linux-cloud-tools-common.hv-vss-daemon.service
+++ b/debian/linux-cloud-tools-common.hv-vss-daemon.service
@@ -4,6 +4,8 @@ 
 [Unit]
 Description=Hyper-V VSS Protocol Daemon
 ConditionVirtualization=microsoft
+ConditionPathExists=/dev/vmbus/hv_vss
+BindsTo=sys-devices-virtual-misc-vmbus\x21hv_vss.device
 
 [Service]
 ExecStart=/usr/sbin/hv_vss_daemon -n
diff --git a/debian/linux-cloud-tools-common.hv-vss-daemon.udev b/debian/linux-cloud-tools-common.hv-vss-daemon.udev
new file mode 100644
index 000000000000..f4b9a91ad4bf
--- /dev/null
+++ b/debian/linux-cloud-tools-common.hv-vss-daemon.udev
@@ -0,0 +1 @@ 
+SUBSYSTEM=="misc", KERNEL=="vmbus/hv_vss", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-vss-daemon.service"
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index d79e866dfe2e..f4dcba21d620 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -201,6 +201,7 @@  ifeq ($(do_tools_hyperv),true)
 	dh_installinit -p$(cloudpkg) -n --name hv-vss-daemon
 	dh_installinit -p$(cloudpkg) -n --name hv-fcopy-daemon
 	dh_installudev -p$(cloudpkg) -n --name hv-kvp-daemon
+	dh_installudev -p$(cloudpkg) -n --name hv-vss-daemon
 	dh_systemd_enable -p$(cloudpkg)
 	dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
 	dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon