Skip to content

cloud-hypervisor: cannot override the --serial and --console args. #376

@Ramblurr

Description

@Ramblurr

Issue

The cloud-hypervisor runner unconditionally sets --serial and --console.

https://github.com/astro/microvm.nix/blob/f30ae9b9e740116d044935c9c0c68bd1c2ce8432/lib/runners/cloud-hypervisor.nix#L142-L143

Motivation

...but there are other values that could be useful (at least for myself)

      --console <console>
          Control (virtio) console: "off|null|pty|tty|file=</path/to/a/file>,iommu=on|off" [default: tty]
      --serial <serial>
          Control serial port: off|null|pty|tty|file=</path/to/a/file>|socket=</path/to/a/file> [default: null]

Also see the slow boot problem caused by the default --serial tty in #366

Current behavior

If you try to set --serial for example, you get the error:

$ nix run .#packages.x86_64-linux.cloud-hypervisor-example --show-trace
warning: Git tree '/home/ramblurr/src/microvm.nix' is dirty
error: the argument '--serial <serial>' cannot be used multiple times

Usage: microvm@cloud-hypervisor-microvm [OPTIONS]

For more information, try '--help'.

Possible solutions

I understand the goal not to have an additional nixos module option for every single CLI flag for the VMMs, that would just get out of hand.

I think a good solution is to detect if the user passed a flag in the extraArgs list, and if so, do not add the default that microvm otherwise would.

This is easy to implement now using the extractOptValues function I implemented over in #336

If you approve this, then I can prepare a PR that does exactly that.

A PR for this is over in #377 so you can see exactly what this looks like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions