Skip to content

providers/virtualbox: investigate using GuestProperties #629

Closed

Description

@lucab

Ignition currently supports a virtualbox provider, which reads straight JSON bytes from a well-known GPT partition: https://github.com/coreos/ignition/blob/v0.28.0/internal/providers/virtualbox/virtualbox.go

This means that at the injection site (e.g. vagrant-virtualbox) we have a bunch of logic to handcraft a raw GPT disk: https://github.com/coreos/vagrant-ignition/blob/v0.0.1/lib/vagrant-ignition/action/IgnitionDiskGenerator.rb

However, virtualbox already provides an HostService to exchange node properties between host<->guest, which can be used from the guest to consume host-provided userdata: https://www.virtualbox.org/browser/vbox/trunk/src/VBox/HostServices/GuestProperties/service.cpp
Those can be directly managed via VBoxManage guestproperty: http://underpop.online.fr/v/virtualbox/vboxmanage-guestproperty-virtualbox.html

At the same time, another point is that the guest-property can also be used to report back provisioning status (outside the scope of this ticket, but nice).

The main problem I see is that property values are currently limited to 128 bytes: https://www.virtualbox.org/browser/vbox/trunk/include/VBox/HostServices/GuestPropertySvc.h?rev=71010#L40

It would be good to investigate:

  • whether vbox upstream would be ok taking a patch to enlarge that size to something slightly larger (e.g. 16KiB like the AWS limit)
  • whether there is already a good away to consume this from userspace or if we need additional features in kernel guest drivers (i.e. recent Linux VBOXGUEST)
  • whether it makes sense to implement and use this in ignition (e.g. to get rid of udev settling races)

Activity

  1. ajeddeloh commented on Sep 11, 2018

    @ajeddeloh
    Contributor

    I fully agree this is worth investigating.

  2. lucab commented on Feb 12, 2019

    @lucab
    Author

    Late followup with a datapoint provided by @crawford: a typical Ignition config for a self-bootstrapping kubernetes node is >100KiB. A larger guestproperty would work initially but probably won't solve all usecases.

    A different path to explore could be custom DMI OEM content, similar to #656.
    VirtualBox seems to support this via the setextradata verb: https://www.virtualbox.org/manual/ch09.html#changedmi.
    In this specific case, VirtualBox only supports x86 guests, so the lack of portability to other platforms isn't a concern. I don't know if there are other key-naming or value-size limitations, though.

  3. bgilbert commented on Feb 12, 2019

    @bgilbert
    Contributor

    The DMI approach is worth exploring. It's unfortunate that there are separate extradata keys for BIOS and UEFI, though.

  4. jlebon commented on Jun 8, 2020

    @jlebon
    Member

    Possibly relevant here: #928 (comment). Haven't checked yet though whether VirtualBox supports specifying the disk serial to ignition.

  5. bgilbert commented on Oct 9, 2021

    @bgilbert
    Contributor

    A custom OEM string doesn't help much here, since VirtualBox limits DMI tables to 768 bytes (VBOX_DMI_TABLE_SIZE). Also, the setextradata commands in the docs are not examples; they're a complete list of the supported fields. It's true that we could encourage users to set VBoxInternal/Devices/pcbios/0/Config/DmiOEMVBoxVer or .../DmiOEMVBoxRev, since API strings aren't key-value pairs anyway, but it doesn't feel like a clean use of the API.

    Guest properties are the official VirtualBox mechanism for host-guest communication, so it'd be nice to use them if possible — and it seems there's no longer a 128-byte limit on property values. The original implementation used fixed-size 128-byte buffers, and a couple call sites still do, but the guest property service no longer imposes that limit and I think it hasn't since r21629 in 2009. #1269 implements Ignition config access via a guest property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions