Skip to content

Commit 0261b66

Browse files
committed
dashboard, buildlet: add a disabled builder with nested virt, for testing
This adds a linux-amd64 COS builder that should be just like our existing linux-amd64 COS builder except that it's using a forked image that has the VMX license bit enabled for nested virtualization. (GCE appears to be using the license mechanism as some sort of opt-in mechanism for features that aren't yet GA; might go away?) Once this is in, it won't do any new builds as regular+trybot builders are disabled. But it means I can then use gomote + debugnewvm to work on preparing the other four image types. Updates golang/go#15581 (solaris) Updates golang/go#23060 (dragonfly) Updates golang/go#30262 (riscv) Updates golang/go#30267 (fuchsia) Updates golang/go#23824 (android) Change-Id: Ic55f17eea17908dba7f58618d8cd162a2ed9b015 Reviewed-on: https://go-review.googlesource.com/c/162959 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 5d2b366 commit 0261b66

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

buildlet/gce.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,34 @@ func StartNewVM(creds *google.Credentials, buildEnv *buildenv.Environment, instN
142142
}
143143

144144
srcImage := "https://www.googleapis.com/compute/v1/projects/" + projectID + "/global/images/" + hconf.VMImage
145+
minCPU := hconf.MinCPUPlatform
145146
if hconf.IsContainer() {
146-
var err error
147-
srcImage, err = cosImage(ctx, computeService)
148-
if err != nil {
149-
return nil, fmt.Errorf("error find Container-Optimized OS image: %v", err)
147+
if hconf.NestedVirt {
148+
minCPU = "Intel Haswell" // documented minimum from https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances
149+
// TODO: use some variant of cosImage that finds our local
150+
// forked copy of cos-stable with the VMX license added. For
151+
// now, I just manually once ran:
152+
// gcloud compute images create cos-stable-72-11316-136-0-vmx --source-image=cos-stable-72-11316-136-0 --source-image-project=cos-cloud --licenses=https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx
153+
// And we'll use that version for now. Perhaps when Nested
154+
// Virtualization reaches GA it'll just become a boolean we
155+
// can set in our compute.Instance creation request and this
156+
// license opt-in mechanism will be unnecessary.
157+
const coxVMXImage = "cos-stable-72-11316-136-0-vmx"
158+
srcImage = "https://www.googleapis.com/compute/v1/projects/" + projectID + "/global/images/" + coxVMXImage
159+
} else {
160+
var err error
161+
srcImage, err = cosImage(ctx, computeService)
162+
if err != nil {
163+
return nil, fmt.Errorf("error find Container-Optimized OS image: %v", err)
164+
}
150165
}
151166
}
152167

153168
instance := &compute.Instance{
154169
Name: instName,
155170
Description: opts.Description,
156171
MachineType: machType,
157-
MinCpuPlatform: hconf.MinCPUPlatform,
172+
MinCpuPlatform: minCPU,
158173
Disks: []*compute.AttachedDisk{
159174
{
160175
AutoDelete: true,

dashboard/builders.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ var Hosts = map[string]*HostConfig{
4141
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
4242
SSHUsername: "root",
4343
},
44+
"host-linux-stretch-vmx": &HostConfig{
45+
Notes: "Debian Stretch w/ Nested Virtualization (VMX CPU bit) enabled, for testing",
46+
ContainerImage: "linux-x86-stretch:latest",
47+
NestedVirt: true,
48+
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
49+
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
50+
SSHUsername: "root",
51+
},
4452
"host-linux-armhf-cross": &HostConfig{
4553
Notes: "Debian Jessie with armhf cross-compiler, built from env/crosscompile/linux-armhf-jessie",
4654
ContainerImage: "linux-armhf-jessie:latest",
@@ -576,6 +584,9 @@ type HostConfig struct {
576584
ExpectNum int // expected number of reverse buildlets of this type
577585
HermeticReverse bool // whether reverse buildlet has fresh env per conn
578586

587+
// Container image options, if ContainerImage != "":
588+
NestedVirt bool // container requires VMX nested virtualization
589+
579590
// Optional base env. GOROOT_BOOTSTRAP should go here if the buildlet
580591
// has Go 1.4+ baked in somewhere.
581592
env []string
@@ -1204,6 +1215,13 @@ func init() {
12041215
numTryTestHelpers: 4,
12051216
RunBench: true,
12061217
})
1218+
addBuilder(BuildConfig{
1219+
Name: "linux-amd64-vmx",
1220+
HostType: "host-linux-stretch-vmx",
1221+
MaxAtOnce: 1,
1222+
TryOnly: true, // don't run regular build
1223+
tryBot: nil, // and don't run trybots (only gomote)
1224+
})
12071225

12081226
const testAlpine = false // Issue 22689 (hide all red builders), Issue 19938 (get Alpine passing)
12091227
if testAlpine {

0 commit comments

Comments
 (0)