linux-cloud-tools-common: Ensure hv-kvp-daemon.service starts before walinuxagent.service

Bug #1739107 reported by David Coronel on 2017-12-19
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Medium
Eric Desrochers
Xenial
Medium
Eric Desrochers
Zesty
Undecided
Unassigned
Artful
Undecided
Unassigned
Bionic
Medium
Eric Desrochers

Bug Description

This is a request to make a change in the hv-kvp-daemon systemd service which is part of the linux-cloud-tools-common package to ensure the hv-kvp-daemon service starts before the walinuxagent service. The default dependencies make hv-kvp-daemon wait until the whole system is up before it can start.

Currently the /lib/systemd/system/hv-kvp-daemon.service file looks like this:

====================
# On Azure/Hyper-V systems start the hv_kvp_daemon
#
# author "Andy Whitcroft <email address hidden>"
[Unit]
Description=Hyper-V KVP Protocol Daemon
ConditionVirtualization=microsoft

[Service]
ExecStart=/usr/sbin/hv_kvp_daemon -n

[Install]
WantedBy=multi-user.target
====================

The suggested modification is to make the [Unit] section look like this:

[Unit]
Description=Hyper-V KVP Protocol Daemon
ConditionVirtualization=microsoft
DefaultDependencies=no
After=systemd-remount-fs.service
Before=shutdown.target cloud-init-local.service walinuxagent.service
Conflicts=shutdown.target
RequiresMountsFor=/var/lib/hyperv

The hv-kvp-daemon service is not currently part of the critical-chain:

$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @10.809s
└─multi-user.target @10.723s
└─ephemeral-disk-warning.service @10.538s +31ms
└─cloud-config.service @8.249s +2.252s
└─basic.target @8.044s
└─sockets.target @8.019s
└─snapd.socket @7.692s +264ms
└─sysinit.target @6.719s
└─cloud-init.service @5.803s +842ms
└─networking.service @5.137s +612ms
└─network-pre.target @5.074s
└─cloud-init-local.service @2.257s +2.783s
└─systemd-remount-fs.service @1.368s +656ms
└─systemd-journald.socket @1.218s
└─-.mount @649ms
└─system.slice @653ms
└─-.slice @649ms

In an Azure VM, the current startup time of my test is:
$ systemd-analyze
Startup finished in 10.375s (kernel) + 12.352s (userspace) = 22.728s

After making the suggested change, the startup time is similar:

$ systemd-analyze
Startup finished in 9.759s (kernel) + 11.867s (userspace) = 21.627s

And the service is now in the critical-chain:

$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @10.666s
└─multi-user.target @10.636s
└─ephemeral-disk-warning.service @10.556s +36ms
└─cloud-config.service @8.423s +2.095s
└─basic.target @8.124s
└─sockets.target @8.101s
└─lxd.socket @7.677s +326ms
└─sysinit.target @6.755s
└─cloud-init.service @5.814s +908ms
└─networking.service @5.111s +651ms
└─network-pre.target @5.087s
└─cloud-init-local.service @2.345s +2.707s
└─hv-kvp-daemon.service @2.316s
└─systemd-remount-fs.service @1.253s +680ms
└─system.slice @1.225s
└─-.slice @650ms

The ConditionVirtualization=microsoft line makes it so that this doesn't affect non microsoft virtualization environments (ie. qemu, kvm, vmware, xen, etc.) by checking whether the system is executed in a virtualized environment and optionally test whether it is a specific implementation, in this case "microsoft" for Hyper-V.

https://www.freedesktop.org/software/systemd/man/systemd-detect-virt.html#
microsoft = Hyper-V, also known as Viridian or Windows Server Virtualization

Related branches

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1739107

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu):
importance: Undecided → Medium
tags: added: kernel-da-key
Changed in linux (Ubuntu):
status: Incomplete → Triaged
Eric Desrochers (slashd) on 2017-12-21
tags: added: sts
tags: added: azure
Eric Desrochers (slashd) wrote :

Waiting for a confirmation from Azure team to validate that the proposal fix for all Ubuntu stable releases works as expected with their internal validation before submitting to kernel-team ML.

Regards,
Eric

Eric Desrochers (slashd) wrote :

0001-UBUNTU-Debian-hyper-v-Ensure-that-hv-kvp-daemon.serv.patch

tags: added: patch
Eric Desrochers (slashd) wrote :

Microsoft Azure didn't come back to us yet about comment #3.

I will gladly resume the work on this LP once we get some updates. For now I've set the bug to "incomplete" as it can only be tested internally by Microsoft.

Regards,
Eric

Changed in linux (Ubuntu):
status: Triaged → Incomplete
Changed in linux (Ubuntu Xenial):
status: New → Incomplete
Changed in linux (Ubuntu Zesty):
status: New → Incomplete
Changed in linux (Ubuntu Artful):
status: New → Incomplete
Changed in linux (Ubuntu Bionic):
status: Triaged → Incomplete
Andy (andyliuliming) wrote :

@Eric Desrochers,
I'm from azure team.
and the xenial bionic are tested. and it works well.
will test the zesty and artful today and post the result here.

Changed in linux (Ubuntu):
status: Incomplete → In Progress
assignee: nobody → Andy (andyliuliming)
Andy (andyliuliming) on 2018-07-27
Changed in linux (Ubuntu Xenial):
assignee: nobody → Andy (andyliuliming)
Changed in linux (Ubuntu Zesty):
assignee: nobody → Andy (andyliuliming)
Changed in linux (Ubuntu Artful):
assignee: nobody → Andy (andyliuliming)
Changed in linux (Ubuntu Bionic):
assignee: nobody → Andy (andyliuliming)
Changed in linux (Ubuntu Xenial):
status: Incomplete → In Progress
Changed in linux (Ubuntu Zesty):
status: Incomplete → In Progress
Changed in linux (Ubuntu Artful):
status: Incomplete → In Progress
Changed in linux (Ubuntu Bionic):
status: Incomplete → In Progress
Andy (andyliuliming) wrote :

verified, all works.

could you please help "submitting to kernel-team ML", through I do not know what does it mean :)
maybe it's a process before merging the PRs :)

Changed in linux (Ubuntu):
assignee: Andy (andyliuliming) → nobody
Changed in linux (Ubuntu Xenial):
assignee: Andy (andyliuliming) → nobody
Changed in linux (Ubuntu Zesty):
assignee: Andy (andyliuliming) → nobody
Changed in linux (Ubuntu Bionic):
assignee: Andy (andyliuliming) → nobody
Changed in linux (Ubuntu Artful):
assignee: Andy (andyliuliming) → nobody
Eric Desrochers (slashd) wrote :

Zesty and Artful is not needed, as both release are no longer supported version.

Xenial & Bionic testing as you did will suffice for now.

Eric Desrochers (slashd) on 2018-07-31
Changed in linux (Ubuntu Artful):
status: In Progress → Won't Fix
Changed in linux (Ubuntu Zesty):
status: In Progress → Won't Fix
Changed in linux (Ubuntu Xenial):
importance: Undecided → Medium
Eric Desrochers (slashd) on 2018-08-03
description: updated
Eric Desrochers (slashd) on 2018-08-03
description: updated
Eric Desrochers (slashd) on 2018-08-03
Changed in linux (Ubuntu Bionic):
assignee: nobody → Eric Desrochers (slashd)
Changed in linux (Ubuntu):
assignee: nobody → Eric Desrochers (slashd)
Changed in linux (Ubuntu Xenial):
assignee: nobody → Eric Desrochers (slashd)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers