internal/cloud/gcp/compute: Add TDX_CAPABLE guest OS feature

Latest RHEL images (from 9.6 on) should be able to run as TDX guests.
CentOS guests also fully support it at the moment.

See: https://issues.redhat.com/browse/COS-3111
See: https://github.com/coreos/coreos-assembler/pull/4006
See: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5979
This commit is contained in:
Beñat Gartzia Arruabarrena 2025-01-22 17:10:37 +01:00 committed by Tomáš Hozza
parent 9b850de9f1
commit d5a77ffcb5

View file

@ -29,6 +29,18 @@ var GuestOsFeaturesRHEL9 []*computepb.GuestOsFeature = []*computepb.GuestOsFeatu
{Type: common.ToPtr(computepb.GuestOsFeature_GVNIC.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_SEV_SNP_CAPABLE.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_SEV_LIVE_MIGRATABLE_V2.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_TDX_CAPABLE.String())},
}
// Guest OS Features for RHEL images up to RHEL9.5.
// The TDX support was added since RHEL-9.6.
var GuestOsFeaturesRHEL95 []*computepb.GuestOsFeature = []*computepb.GuestOsFeature{
{Type: common.ToPtr(computepb.GuestOsFeature_UEFI_COMPATIBLE.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_VIRTIO_SCSI_MULTIQUEUE.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_SEV_CAPABLE.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_GVNIC.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_SEV_SNP_CAPABLE.String())},
{Type: common.ToPtr(computepb.GuestOsFeature_SEV_LIVE_MIGRATABLE_V2.String())},
}
// Guest OS Features for RHEL9.1 images.
@ -71,6 +83,14 @@ func GuestOsFeaturesByDistro(distroName string) []*computepb.GuestOsFeature {
// TODO: this should be updated for the dot-notation
case distroName == "rhel-91":
return GuestOsFeaturesRHEL91
case distroName == "rhel-92":
fallthrough
case distroName == "rhel-93":
fallthrough
case distroName == "rhel-94":
fallthrough
case distroName == "rhel-95":
return GuestOsFeaturesRHEL95
case strings.HasPrefix(distroName, "centos-9"):
fallthrough
case strings.HasPrefix(distroName, "rhel-9"):