UBUNTU: [Packaging] bind hv_fcopy_daemon startup to hv_fcopy device

BugLink: https://bugs.launchpad.net/bugs/1891224

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

The udev rules is responsible for starting the service only when the
fcopy 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>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
This commit is contained in:
Marcelo Henrique Cerri 2020-08-24 13:59:48 -03:00 committed by Thadeu Lima de Souza Cascardo
parent e8d92bd801
commit a80a7da2ec
3 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,8 @@
[Unit]
Description=Hyper-V File Copy Protocol Daemon
ConditionVirtualization=microsoft
ConditionPathExists=/dev/vmbus/hv_fcopy
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
[Service]
ExecStart=/usr/sbin/hv_fcopy_daemon -n

View File

@ -0,0 +1 @@
SUBSYSTEM=="misc", KERNEL=="vmbus/hv_fcopy", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-fcopy-daemon.service"

View File

@ -202,6 +202,7 @@ ifeq ($(do_tools_hyperv),true)
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_installudev -p$(cloudpkg) -n --name hv-fcopy-daemon
dh_systemd_enable -p$(cloudpkg)
dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon