Add boot disk type and confidential VM options to up

up created every boot disk as pd-standard, which C3 machine types reject, and it had no way to ask for a confidential instance. This adds --disk-type and --confidential, both through just lab up.

flowchart TD
  A[machine family] --> B{family boots pd-standard?}
  B -->|yes| C{--disk-type named?}
  C -->|no| D[pd-standard]
  C -->|yes| E[the named type]
  B -->|no: c3, c3d, c4, c4a, c4d, n4| F{--disk-type named?}
  F -->|no| G[family default, logged: pd-balanced or hyperdisk-balanced]
  F -->|yes, a type the family boots| E
  F -->|yes, any other| H[refused before create, types listed]

--confidential tdx|sev|sev-snp passes --confidential-compute-type with maintenance policy TERMINATE (sev-snp adds the AMD Milan platform). Before create, up checks that the machine family offers the mode (tdx: c3, sev: c2d, c3d, n2d, sev-snp: n2d) and that the boot image carries the matching capability flag, read from the image family. Fedora carries none, so a confidential rig boots --image-family almalinux-9 on the omnibus base. Both choices are recorded in instance state.

Proof, on c3-standard-4, --base omnibus --image-family almalinux-9 --confidential tdx --disk-type pd-balanced:

$ gcloud compute instances describe <rig> --format='value(confidentialInstanceConfig.confidentialInstanceType,scheduling.onHostMaintenance,machineType.basename())'
TDX	TERMINATE	c3-standard-4
$ gcloud compute disks describe <rig> --format='value(type.basename())'
pd-balanced
$ dmesg | grep -i tdx | head -5
[    0.000000] tdx: Guest detected
[    1.469018] process: using TDX aware idle routine
[    1.469018] Memory Encryption Features active: Intel TDX
[    1.469018] smpboot: CPU0: Intel TDX (family: 0x6, model: 0x8f, stepping: 0x8)
[    3.889069] systemd[1]: Detected confidential virtualization tdx.

Control: main's up --machine-type c3-standard-4 fails at create with pd-standard disk type cannot be used by c3-standard-4 machine type.

The self-test covers the default, the fallback on c3 and c4, a refused type, each mode's flags, the single maintenance policy when a GPU and a confidential mode are both named, and the refusals for image, family and unknown mode.

Merge request reports

Loading
Loading