ProxmoxDiskFilterResolver

Picks the correct udev filter key+value for Proxmox auto-install’s disk-setup.filter.

Windows WMI Win32_DiskDrive.SerialNumber on NVMe disks returns a MANGLED EUI (underscore-separated hex chunks plus trailing dot) that does NOT match Linux udev ID_SERIAL at install time. Linux udev ID_SERIAL for NVMe is <model>_<real-namespace-serial> and the real WWN lives in ID_WWN (lowercase eui.-prefixed).

Resolution chain (highest → lowest priority): WWN (via MSFT_PhysicalDisk.UniqueId when UniqueIdFormat is in {1,2,3,8}) → Model (when unique on this host, or when MSFT enumeration is empty so we cannot tell) → Serial (legacy fallback, lower-cased).

Fail-safe: if MSFT WMI throws, returns no rows, or any property is null, the resolver falls back gracefully so a WMI hiccup never bricks the auto-install path.

public static class ProxmoxDiskFilterResolver

1. Methods

1.1. Resolve(IDisk, ILogger, Func<IEnumerable<MsftDiskInfo>>)

Resolve the filter key+value for the given targetDisk.

public static (string FilterKey, string FilterValue) Resolve(IDisk targetDisk, ILogger logger, Func<IEnumerable<MsftDiskInfo>> msftDiskProvider = null)
Table 1. Parameters
Name Type Description

targetDisk

IDisk

The disk Proxmox should install onto.

logger

ILogger

Logger - debug on the picked branch, warning on every fallback.

msftDiskProvider

Func<IEnumerable<MsftDiskInfo>>

Test seam. When null, queries live MSFT_PhysicalDisk via LiveStorage.

Returns: (string FilterKey, string FilterValue) — (FilterKey, FilterValue) where FilterKey is one of ID_WWN, ID_MODEL, ID_SERIAL and FilterValue is normalised (lower-cased, spaces → underscores for the model branch). The extension layer is responsible for wrapping the value in *...* wildcards.