Skip to content

OpenVMM: give a port forward that cannot be bound at restore a stable error code #972

Closed

Description

A clone of a template restores its NIC with its own network policy (#850). OpenVMM binds the host socket of each port forward of that policy as it resolves the NIC's endpoint, as the VM worker launches, before the restore-ready event. When it cannot bind one, for example because another socket holds the port, the worker's launch fails, and OpenVMM exits with a fatal error that carries no code:

fatal error: failed to launch vm worker

Caused by:
    0: ...
    1: failed to create socket for port forward (Tcp 127.0.0.1:PORT)
    2: <the operating system's error>

NVX attributes that failure to the host, with the evidence forward-bind, by finding the text failed to create socket for port forward ( among the causes of the error's chain. It pins the text with an excerpt of OpenVMM's source, nvx-rs/tests/vectors/openvmm/port_forward_socket_creation.rs, the ResolveConsommeError::SocketCreation variant of vm/devices/net/net_consomme/src/resolver.rs, which the ignored test nvx-rs/tests/openvmm_vectors.rs compares with the submodule. The text is not a contract, though: if OpenVMM rewords the error, the clone's failure falls back to a lost status of unknown outcome, and only the excerpt check of the next pin promotion notices.

Proposal

Give the error a stable bracketed code, as OpenVMM does for its time ABI errors, for example [E_PORT_FORWARD_BIND]. fatal_error_message in openvmm/openvmm_entry/src/microvm/verify.rs already leads the fatal error with the first bracketed E_ code of the chain, so the line would read fatal error: [E_PORT_FORWARD_BIND] failed to launch vm worker, and NVX would match the code at the start of the line, as it matches the time ABI codes of an incompatible host (INCOMPATIBLE_HOST_CODES in nvx-rs/src/host/template/clone/failure.rs).

Acceptance criteria

  • OpenVMM on feature/microvm/dev reports a port forward whose host socket it cannot bind with a stable code that leads its fatal error, documented with its other stable codes, and tested.
  • Once NVX pins that OpenVMM, the launch of a clone attributes the code to forward-bind, and the text match and the excerpt port_forward_socket_creation.rs are removed.

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions