coreos / ignition

First boot installer and configuration tool
https://coreos.github.io/ignition/
Apache License 2.0
840 stars 247 forks source link

Support Hyper-V #1538

Closed bgilbert closed 1 year ago

bgilbert commented 1 year ago

Hyper-V has Hyper-V Integration Services for host-guest communication. It's possible to write a custom service, but that requires a host-side process to connect to a socket. But there's also a key-value service (documentation).

The key-value service does work on Linux, with a helper daemon shipped with the kernel source. Unlike the other hypervisors we support, the daemon appears to take the passive role; it connects and listens for get/set commands, maintaining a set of binary blob files in /var.

In principle, we can emulate the daemon: connect to the hypervisor socket, wait for a SET command for the correct key, then close the socket and continue. If we don't get the Ignition config in the initial set of keys, assume there isn't one. This involves a timeout, which isn't ideal, but the scope of the timeout is much more constrained than "all hardware detection has completed" as would be needed for a config drive.

The kernel headers give the appearance of a 2 KiB limit on the value size, which a) is cramped but sufficient for our purposes, and b) may not be a real limit in the wire protocol; we should test this.

Proposed next steps:

https://github.com/coreos/fedora-coreos-tracker/issues/251 discusses Hyper-V support in FCOS.

bgilbert commented 1 year ago

Just to make this explicit: an Ignition implementation can't be directly adapted from hv_kvp_daemon.c because the latter is GPLv2 and Ignition is Apache.

bgilbert commented 1 year ago

It appears that KVP values are limited to 1K characters (2K bytes in UTF-16). In OOB discussion we concluded that the least-worst approach was to support concatenating multiple keys together. OSes can document a PowerShell script that takes an Ignition config, chunks it, and sets the appropriate KVP keys.

bgilbert commented 1 year ago

Open questions:

prestist commented 1 year ago

This was achieved by https://github.com/coreos/ignition/pull/1555 and other related PR's