RewireVmNicsToVlans

Phase 3e helper: ensure each existing VM on the Liberator host has its vNIC tagged to the correct VLAN. Drift correction only - EnsureCustomerVms handles initial provisioning.

Note

Maps OS → VLAN tag:

  • OPNsense: 5-NIC layout (Option Y) - net0 untagged WAN, net1..4 tag 10/20/250/254. Handled by ProvisionOpnsenseVm at create time; drift correction here ensures tags weren’t manually flipped.

  • NixDns / DC / Nextcloud / Mail / PMG LXC: tag=10 (server tier).

  • Win11 clients: tag=20 (LAN tier).

Idempotent: only runs qm set <vmid> -netN ...,tag=<vlan> when the current tag is missing or wrong (read via qm config <vmid> + parse). No reboot needed - tag swap is hot-pluggable on virtio NICs.

Gated by NETSetup.Helpers.LiberatorGate.IsFullLiberatorFlow(ISystemHost,NETSetup.Entities.NETSetupConfig).

public static class RewireVmNicsToVlans

1. Methods

1.1. Run(ISystemHost, NETSetupConfig, IServiceProvider)

Inspects each existing VM, retags vNICs only when actual tag differs from desired.

public static void Run(ISystemHost host, NETSetupConfig config, IServiceProvider services)
Table 1. Parameters
Name Type Description

host

ISystemHost

config

NETSetupConfig

services

IServiceProvider