Declare the network interface a selected microvm archetype needs, and no address #28
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/archetypes#28
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Give a selected microVM the network interface it needs to have a NIC at all, and prove the public guest definition still carries no address to reach it on.
Primary goals:
macfact, so a microvm guest gets a virtio-net device instead of no network hardware at all.allod/nexuscan hand toip tuntap addand that upstream's 15-character limit accepts, with an archetypes-side diagnostic naming the machine rather than only upstream's generic one.systemd-networkdvalue enters the guest, and the inventoryipfact that sits one attribute away frommacmust be shown not to reach it.Current state and specifics
A microvm guest today has no network interface.
allod/archetypesflake.nix:327setsnetworking.hostNameand nothing else network-related anywhere in the repo, and the only guest-side networking the framework configures isallod/vmmodules/qemu-guest.nix:24-25, which enables NetworkManager for the libvirt guest.allod/vmmodules/microvm-guest.nixdeclares no interface, somicrovm.interfacesstays at upstream's[]default and the generated QEMU command has no-netdevor-device virtio-net-*argument. A libvirt guest gets its addressing from the host's libvirt XML; a microvm guest has no equivalent, which is why the interface has to be declared in the guest itself.The host half already exists and is waiting for this declaration.
allod/nexusnix/microvm/host.nix:89-91readsguest.microvm.interfaces, filterstype == "tap", and maps each entry to itsid;nix/microvm/launcher.nix:347-364then runsip tuntap add name '<id>' mode tap user '<principal>'because upstream's generatedtap-uphardcodesuser = "microvm"and would otherwise hand the device to the shared account. Soidis the host TAP device name, not a guest-side name, andallod/nexuschecks/microvm/fixtures.nix:82,172-174already assumes thetap-<machine>shape for it.Upstream at the pinned revision
39a499ab85311b56dddb09ec43351cc3658f22c1declaresmicrovm.interfacesas a list of submodules withtype(enumuser/tap/macvtap/bridge),id(str, "interface name on the host"),mac(str, no default),bridge,macvtap.*, andtap.vhost—nixos-modules/microvm/options.nix:314-371. Its assertions innixos-modules/microvm/asserts.nix:20-58cover duplicateids, bridge/non-bridge consistency, and a 15-character name limit; there is no MAC-format check and no check that anidis a usable interface name.lib/runners/qemu.nix:307-357renders each entry into-netdev tap,id=<id>,ifname=<id>,script=no,downscript=noplus-device virtio-net-...,netdev=<id>,mac=<mac>, so a malformed value lands in the QEMU argument list rather than failing earlier.The MAC is inventory data.
allod/inventoryflake.nix:25,57,90gives every machine amac, andflake.nix:179exports it throughlib.vmSpecsJsonalongsideip. That adjacency is the specific accident worth testing against:machines.<name>.ipis one attribute away frommachines.<name>.mac, and the public examples carry real-shaped values (192.0.2.10,192.0.2.11). Only the MAC may cross into the guest.The gating pattern is settled.
flake.nix:485,517add the persistent-volume module withlib.optional (runtime == "microvm")on the builder's module list, andflake.nix:98-104records why:microvm.*options do not exist undervm.nixosModules.qemuGuest, so an ungated definition is an unmatched-option error on every libvirt machine, andlib.mkIfdoes not help because it defers the value rather than the definition.runtime-module-selectionalready proves the gating stays outside the module system withlib.hasAttrByPath, because an undeclared option is a raw attribute error thatbuiltins.tryEvaldoes not catch.Scope
In scope: one TAP interface declared per selected microvm archetype in
allod/archetypesflake.nix, its derived host interface ID, the inventory MAC as the only value crossing into the guest, archetypes-side validation of the mergedconfig.microvm.interfacesand of the guest's address-bearing option surface, a scanner over the evaluated guest configuration and the generated runner that rejects address-shaped values, and a paired sabotage fixture for every assertion and for the scanner itself.Out of scope and tracked elsewhere in the same arc: host TAP attachment, addressing, routes, DNS, and
systemd-networkdconfiguration, which stay deployment inputs; runtime credential delivery and the guest credential root; theextendModuleshost integration; exporting the runtime throughvmFacts; and the nested-boot test that proves the interface actually reaches a fixture network, which needs the boot slice that does not exist yet.This is public work. The only machine-derived value it introduces is the inventory MAC, and the change's own tests are what prove nothing else follows it.
Part of allod/strategy#20