diff mbox series

[{bionic,xenial}:linux,1/1] UBUNTU: [Packaging] bind hv_kvp_daemon startup to hv_kvp device

Message ID 20191211143509.9729-2-marcelo.cerri@canonical.com
State New
Headers show
Series LP:#1820063 - Hyper-V: Fix failed KVP daemon start on first boot of disco VM | expand

Commit Message

Marcelo Henrique Cerri Dec. 11, 2019, 2:35 p.m. UTC
From: Seth Forshee <seth.forshee@canonical.com>

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

The hv_kvp_daemon service requires the hv_kvp device and should
be started when the device appears and stopped in it disappears.
Solution is based off the one provided at
https://bugzilla.redhat.com/show_bug.cgi?id=1195029#c22.

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

Comments

Kleber Sacilotto de Souza Dec. 13, 2019, 12:11 p.m. UTC | #1
On 11.12.19 15:35, Marcelo Henrique Cerri wrote:
> From: Seth Forshee <seth.forshee@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1820063
> 
> The hv_kvp_daemon service requires the hv_kvp device and should
> be started when the device appears and stopped in it disappears.
> Solution is based off the one provided at
> https://bugzilla.redhat.com/show_bug.cgi?id=1195029#c22.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>

Already applied to Disco and with limited scope.

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  debian/linux-cloud-tools-common.hv-kvp-daemon.service | 3 ++-
>  debian/linux-cloud-tools-common.hv-kvp-daemon.udev    | 1 +
>  debian/rules.d/3-binary-indep.mk                      | 1 +
>  3 files changed, 4 insertions(+), 1 deletion(-)
>  create mode 100644 debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> 
> diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.service b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> index 015c96f9fea7..571440344cb5 100644
> --- a/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> @@ -5,7 +5,8 @@
>  Description=Hyper-V KVP Protocol Daemon
>  ConditionVirtualization=microsoft
>  DefaultDependencies=no
> -After=systemd-remount-fs.service
> +BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
> +After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device systemd-remount-fs.service
>  Before=shutdown.target cloud-init-local.service walinuxagent.service
>  Conflicts=shutdown.target
>  RequiresMountsFor=/var/lib/hyperv
> diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.udev b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> new file mode 100644
> index 000000000000..0c648f54d4c4
> --- /dev/null
> +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> @@ -0,0 +1 @@
> +SUBSYSTEM=="misc", KERNEL=="vmbus/hv_kvp", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-kvp-daemon.service"
> diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
> index b27275685612..6c847da42bd4 100644
> --- a/debian/rules.d/3-binary-indep.mk
> +++ b/debian/rules.d/3-binary-indep.mk
> @@ -190,6 +190,7 @@ ifeq ($(do_tools_hyperv),true)
>  	dh_installinit -p$(cloudpkg) -n --name hv-kvp-daemon
>  	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_systemd_enable -p$(cloudpkg)
>  	dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
>  	dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon
>
Andy Whitcroft Dec. 13, 2019, 12:48 p.m. UTC | #2
On Wed, Dec 11, 2019 at 11:35:09AM -0300, Marcelo Henrique Cerri wrote:
> From: Seth Forshee <seth.forshee@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1820063
> 
> The hv_kvp_daemon service requires the hv_kvp device and should
> be started when the device appears and stopped in it disappears.
> Solution is based off the one provided at
> https://bugzilla.redhat.com/show_bug.cgi?id=1195029#c22.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
> ---
>  debian/linux-cloud-tools-common.hv-kvp-daemon.service | 3 ++-
>  debian/linux-cloud-tools-common.hv-kvp-daemon.udev    | 1 +
>  debian/rules.d/3-binary-indep.mk                      | 1 +
>  3 files changed, 4 insertions(+), 1 deletion(-)
>  create mode 100644 debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> 
> diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.service b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> index 015c96f9fea7..571440344cb5 100644
> --- a/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> @@ -5,7 +5,8 @@
>  Description=Hyper-V KVP Protocol Daemon
>  ConditionVirtualization=microsoft
>  DefaultDependencies=no
> -After=systemd-remount-fs.service
> +BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
> +After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device systemd-remount-fs.service
>  Before=shutdown.target cloud-init-local.service walinuxagent.service
>  Conflicts=shutdown.target
>  RequiresMountsFor=/var/lib/hyperv
> diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.udev b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> new file mode 100644
> index 000000000000..0c648f54d4c4
> --- /dev/null
> +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> @@ -0,0 +1 @@
> +SUBSYSTEM=="misc", KERNEL=="vmbus/hv_kvp", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-kvp-daemon.service"
> diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
> index b27275685612..6c847da42bd4 100644
> --- a/debian/rules.d/3-binary-indep.mk
> +++ b/debian/rules.d/3-binary-indep.mk
> @@ -190,6 +190,7 @@ ifeq ($(do_tools_hyperv),true)
>  	dh_installinit -p$(cloudpkg) -n --name hv-kvp-daemon
>  	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_systemd_enable -p$(cloudpkg)
>  	dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
>  	dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon

On the face of it this seems ok.  Can you confirm it has been tested on
bionic and xenial too.  Bare in mind that these are init scripts so they
are dependant on support for functionality from systemd and udev and for
semantics of the dh_splat commands all of which could be different in an
older series.

If it has been tested on those series:

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Marcelo Henrique Cerri Dec. 13, 2019, 5:47 p.m. UTC | #3
On Fri, Dec 13, 2019 at 12:48:22PM +0000, Andy Whitcroft wrote:
> On Wed, Dec 11, 2019 at 11:35:09AM -0300, Marcelo Henrique Cerri wrote:
> > From: Seth Forshee <seth.forshee@canonical.com>
> > 
> > BugLink: https://bugs.launchpad.net/bugs/1820063
> > 
> > The hv_kvp_daemon service requires the hv_kvp device and should
> > be started when the device appears and stopped in it disappears.
> > Solution is based off the one provided at
> > https://bugzilla.redhat.com/show_bug.cgi?id=1195029#c22.
> > 
> > Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> > Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
> > ---
> >  debian/linux-cloud-tools-common.hv-kvp-daemon.service | 3 ++-
> >  debian/linux-cloud-tools-common.hv-kvp-daemon.udev    | 1 +
> >  debian/rules.d/3-binary-indep.mk                      | 1 +
> >  3 files changed, 4 insertions(+), 1 deletion(-)
> >  create mode 100644 debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> > 
> > diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.service b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> > index 015c96f9fea7..571440344cb5 100644
> > --- a/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> > +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
> > @@ -5,7 +5,8 @@
> >  Description=Hyper-V KVP Protocol Daemon
> >  ConditionVirtualization=microsoft
> >  DefaultDependencies=no
> > -After=systemd-remount-fs.service
> > +BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
> > +After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device systemd-remount-fs.service
> >  Before=shutdown.target cloud-init-local.service walinuxagent.service
> >  Conflicts=shutdown.target
> >  RequiresMountsFor=/var/lib/hyperv
> > diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.udev b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> > new file mode 100644
> > index 000000000000..0c648f54d4c4
> > --- /dev/null
> > +++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
> > @@ -0,0 +1 @@
> > +SUBSYSTEM=="misc", KERNEL=="vmbus/hv_kvp", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-kvp-daemon.service"
> > diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
> > index b27275685612..6c847da42bd4 100644
> > --- a/debian/rules.d/3-binary-indep.mk
> > +++ b/debian/rules.d/3-binary-indep.mk
> > @@ -190,6 +190,7 @@ ifeq ($(do_tools_hyperv),true)
> >  	dh_installinit -p$(cloudpkg) -n --name hv-kvp-daemon
> >  	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_systemd_enable -p$(cloudpkg)
> >  	dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
> >  	dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon
> 
> On the face of it this seems ok.  Can you confirm it has been tested on
> bionic and xenial too.  Bare in mind that these are init scripts so they
> are dependant on support for functionality from systemd and udev and for
> semantics of the dh_splat commands all of which could be different in an
> older series.
> 
> If it has been tested on those series:

It was built and tested on Xenial and Bionic without any issues. On
regular Azure instances it installs without problems in both series
without causing any regressions to the KVP daemon.

I asked CPC to also test if the patch fixes the failure they had found
and they have confirmed the change works as expected.


> 
> Acked-by: Andy Whitcroft <apw@canonical.com>
> 
> -apw
diff mbox series

Patch

diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.service b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
index 015c96f9fea7..571440344cb5 100644
--- a/debian/linux-cloud-tools-common.hv-kvp-daemon.service
+++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.service
@@ -5,7 +5,8 @@ 
 Description=Hyper-V KVP Protocol Daemon
 ConditionVirtualization=microsoft
 DefaultDependencies=no
-After=systemd-remount-fs.service
+BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
+After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device systemd-remount-fs.service
 Before=shutdown.target cloud-init-local.service walinuxagent.service
 Conflicts=shutdown.target
 RequiresMountsFor=/var/lib/hyperv
diff --git a/debian/linux-cloud-tools-common.hv-kvp-daemon.udev b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
new file mode 100644
index 000000000000..0c648f54d4c4
--- /dev/null
+++ b/debian/linux-cloud-tools-common.hv-kvp-daemon.udev
@@ -0,0 +1 @@ 
+SUBSYSTEM=="misc", KERNEL=="vmbus/hv_kvp", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hv-kvp-daemon.service"
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index b27275685612..6c847da42bd4 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -190,6 +190,7 @@  ifeq ($(do_tools_hyperv),true)
 	dh_installinit -p$(cloudpkg) -n --name hv-kvp-daemon
 	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_systemd_enable -p$(cloudpkg)
 	dh_installinit -p$(cloudpkg) -o --name hv-kvp-daemon
 	dh_installinit -p$(cloudpkg) -o --name hv-vss-daemon