Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Hyper-V #1538

Closed
4 tasks
bgilbert opened this issue Jan 27, 2023 · 4 comments
Closed
4 tasks

Support Hyper-V #1538

bgilbert opened this issue Jan 27, 2023 · 4 comments

Comments

@bgilbert
Copy link
Contributor

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:

  • Try to get a custom key/value pair into the guest using hv_kvp_daemon
  • Try stopping the daemon, removing its data files, restarting it, and seeing whether the data is restored. This verifies that the host service doesn't require data persistence in the guest. If it did, Ignition's use of the K-V protocol would interfere with any hv_kvp_daemon instance run later in the real root.
  • Implement K-V socket in Ignition
  • Determine the maximum value size we can receive

coreos/fedora-coreos-tracker#251 discusses Hyper-V support in FCOS.

@bgilbert
Copy link
Contributor Author

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
Copy link
Contributor Author

bgilbert commented Feb 6, 2023

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
Copy link
Contributor Author

bgilbert commented Feb 6, 2023

Open questions:

  • How should the KVP keys be named/structured?
  • Is the Hyper-V socket interface accessible to non-root users or in a container?
  • Does the guest have an API to delete the host's KVP keys? (I assume no.)
  • Are the KVP keys deleted in the host (in the registry etc.) if the VM is deleted?

@prestist
Copy link
Collaborator

prestist commented Aug 3, 2023

This was achieved by #1555 and other related PR's

@prestist prestist closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants