Skip to content

Commit 6d75ce3

Browse files
authored
Add Hyper-V KVP Daemon to Azure Stemcells (#453)
* Add hvperv-kv daemon for Azure stemcells Azure runs on the Hyper-V hypervisor, and Linux VMs rely on Linux Integration Services (LIS) to communicate with the host. These services include kernel modules (like hv_utils) and daemons (hv_kvp_daemon, hv_vss_daemon, etc.) that handle: - Host-to-guest communication - IP address reporting - VM metadata exchange - Backup coordination (via VSS) The hv_kvp_daemon specifically manages key-value pair exchange between the Azure host and the Linux guest. If the daemon is missing, Azure may not be able to retrieve guest metadata (e.g., hostname, IP address) This can affect Azure Resource Graph queries, scripts that rely on guest-reported data, backup and monitoring tools that use KVP for coordination cloud-init writes warnings about events that could not be sent to hv-kvp: ```txt $ grep kvp /var/log/cloud-init.log failed to truncate kvp pool file, [Errno 2] No such file or directory: '/var/lib/hyperv/.kvp_pool_1' failed posting events to kvp, [Errno 2] No such file or directory: '/var/lib/hyperv/.kvp_pool_1' ``` * Add missing tests for waagent.service * Consolidate Azure package installs
1 parent 3e0b699 commit 6d75ce3

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

bosh-stemcell/spec/stemcells/azure_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,40 @@
7979
its(:content) { should match /Unmanaged=yes/ }
8080
end
8181
end
82+
83+
context 'installed by system_azure_init', {
84+
exclude_on_alicloud: true,
85+
exclude_on_aws: true,
86+
exclude_on_google: true,
87+
exclude_on_vcloud: true,
88+
exclude_on_vsphere: true,
89+
exclude_on_warden: true,
90+
exclude_on_openstack: true,
91+
exclude_on_softlayer: true,
92+
} do
93+
describe 'Hyper-V KVP daemon' do
94+
describe command('which hv_kvp_daemon') do
95+
its(:exit_status) { should eq 0 }
96+
end
97+
98+
describe service('hv-kvp-daemon') do
99+
it { should be_enabled }
100+
end
101+
end
102+
103+
describe 'WALinuxAgent configuration' do
104+
describe file('/etc/waagent.conf') do
105+
it { should be_owned_by('root') }
106+
end
107+
108+
describe file('/lib/systemd/system/walinuxagent.service') do
109+
it { should be_mode(0644) }
110+
it { should be_owned_by('root') }
111+
end
112+
113+
describe service('walinuxagent') do
114+
it { should be_enabled }
115+
end
116+
end
117+
end
82118
end

stemcell_builder/stages/system_azure_init/apply.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -e
55
base_dir=$(readlink -nf $(dirname $0)/../..)
66
source $base_dir/lib/prelude_apply.bash
77

8-
packages="python3 python3-pyasn1 python3-setuptools python3-distro python-is-python3 cloud-init"
8+
packages="python3 python3-pyasn1 python3-setuptools python3-distro python-is-python3 \
9+
cloud-init linux-cloud-tools-common linux-cloud-tools-generic"
910
pkg_mgr install $packages
1011

1112
wala_release=2.14.0.1
@@ -66,3 +67,6 @@ cat $chroot/etc/rsyslog.d/21-cloudinit.conf >> $chroot/etc/rsyslog.d/50-default.
6667

6768
rm $chroot/etc/rsyslog.d/21-cloudinit.conf
6869

70+
71+
# Enable Hyper-V KVP daemon (installed via linux-cloud-tools)
72+
run_in_chroot "$chroot" "systemctl enable hv-kvp-daemon.service"

0 commit comments

Comments
 (0)