aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/gce/gce.go5
-rw-r--r--vm/gce/gce.go18
2 files changed, 13 insertions, 10 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index 79e4d4b35..b0100b749 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -97,7 +97,8 @@ func NewContext() (*Context, error) {
return ctx, nil
}
-func (ctx *Context) CreateInstance(name, machineType, image, sshkey string, preemptible bool) (string, error) {
+func (ctx *Context) CreateInstance(name, machineType, image, sshkey string,
+ preemptible, displayDevice bool) (string, error) {
prefix := "https://www.googleapis.com/compute/v1/projects/" + ctx.ProjectID
sshkeyAttr := "syzkaller:" + sshkey
oneAttr := "1"
@@ -141,7 +142,7 @@ func (ctx *Context) CreateInstance(name, machineType, image, sshkey string, pree
OnHostMaintenance: "TERMINATE",
},
DisplayDevice: &compute.DisplayDevice{
- EnableDisplay: true,
+ EnableDisplay: displayDevice,
},
}
retry:
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 93a96c5e8..91f76ff68 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -39,11 +39,12 @@ func init() {
}
type Config struct {
- Count int `json:"count"` // number of VMs to use
- MachineType string `json:"machine_type"` // GCE machine type (e.g. "n1-highcpu-2")
- GCSPath string `json:"gcs_path"` // GCS path to upload image
- GCEImage string `json:"gce_image"` // pre-created GCE image to use
- Preemptible bool `json:"preemptible"` // use preemptible VMs if available (defaults to true)
+ Count int `json:"count"` // number of VMs to use
+ MachineType string `json:"machine_type"` // GCE machine type (e.g. "n1-highcpu-2")
+ GCSPath string `json:"gcs_path"` // GCS path to upload image
+ GCEImage string `json:"gce_image"` // pre-created GCE image to use
+ Preemptible bool `json:"preemptible"` // use preemptible VMs if available (defaults to true)
+ DisplayDevice bool `json:"display_device"` // enable a virtual display device
}
type Pool struct {
@@ -71,8 +72,9 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
return nil, fmt.Errorf("config param name is empty (required for GCE)")
}
cfg := &Config{
- Count: 1,
- Preemptible: true,
+ Count: 1,
+ Preemptible: true,
+ DisplayDevice: true,
}
if err := config.LoadData(env.Config, cfg); err != nil {
return nil, fmt.Errorf("failed to parse gce vm config: %v", err)
@@ -150,7 +152,7 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
}
log.Logf(0, "creating instance: %v", name)
ip, err := pool.GCE.CreateInstance(name, pool.cfg.MachineType, pool.cfg.GCEImage,
- string(gceKeyPub), pool.cfg.Preemptible)
+ string(gceKeyPub), pool.cfg.Preemptible, pool.cfg.DisplayDevice)
if err != nil {
return nil, err
}