From ec891e3f8645fb1e5090bff887366c6c57b21e58 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 8 Aug 2025 11:55:31 +0200 Subject: pkg/gce: set GVNIC feature for Compute images Google Cloud cannot automatically infer it from our images, so we need to explicitly set it. The flag is required to create a GVNIC-based GCE instance (the only type for C4A machines). --- pkg/gce/gce.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pkg/gce') diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go index 20aee4c7c..7100665ef 100644 --- a/pkg/gce/gce.go +++ b/pkg/gce/gce.go @@ -22,6 +22,7 @@ import ( "strings" "time" + "github.com/google/syzkaller/sys/targets" "golang.org/x/oauth2" "golang.org/x/oauth2/google" "google.golang.org/api/compute/v1" @@ -254,7 +255,15 @@ func (ctx *Context) IsInstanceRunning(name string) bool { return inst.Status == "RUNNING" } -func (ctx *Context) CreateImage(imageName, gcsFile string) error { +func (ctx *Context) CreateImage(imageName, gcsFile, OS string) error { + var features []*compute.GuestOsFeature + if OS == targets.Linux { + features = []*compute.GuestOsFeature{ + { + Type: "GVNIC", + }, + } + } image := &compute.Image{ Name: imageName, RawDisk: &compute.ImageRawDisk{ @@ -263,6 +272,7 @@ func (ctx *Context) CreateImage(imageName, gcsFile string) error { Licenses: []string{ "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx", }, + GuestOsFeatures: features, } var op *compute.Operation err := ctx.apiCall(func() (err error) { -- cgit mrf-deployment