aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-29 11:02:43 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-29 13:56:59 +0100
commit27a9e3872eb3a229cced88c14a2011188fa968df (patch)
tree0071cf5e258f6d1e7b8f226014b6e678879b7c7d
parent38b877e9ed19a16abc19e91b5571f485f3912b16 (diff)
vm/qemu: scale ssh timeout
Increase ssh wait timeout according to the target slowdown.
-rw-r--r--vm/qemu/qemu.go8
-rw-r--r--vm/vm.go19
-rw-r--r--vm/vmimpl/vmimpl.go20
3 files changed, 26 insertions, 21 deletions
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index eaa82cbb2..d66f208b1 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -79,6 +79,7 @@ type instance struct {
workdir string
sshkey string
sshuser string
+ timeouts targets.Timeouts
port int
monport int
mon net.Conn
@@ -319,6 +320,7 @@ func (pool *Pool) ctor(workdir, sshkey, sshuser string, index int) (vmimpl.Insta
image: pool.env.Image,
debug: pool.env.Debug,
os: pool.env.OS,
+ timeouts: pool.env.Timeouts,
workdir: workdir,
sshkey: sshkey,
sshuser: sshuser,
@@ -476,7 +478,7 @@ func (inst *instance) boot() error {
}
}
}()
- if err := vmimpl.WaitForSSH(inst.debug, 10*time.Minute, "localhost",
+ if err := vmimpl.WaitForSSH(inst.debug, 10*time.Minute*inst.timeouts.Scale, "localhost",
inst.sshkey, inst.sshuser, inst.os, inst.port, inst.merger.Err); err != nil {
bootOutputStop <- true
<-bootOutputStop
@@ -538,7 +540,7 @@ func (inst *instance) Copy(hostSrc string) (string, error) {
if inst.debug {
log.Logf(0, "running command: scp %#v", args)
}
- _, err := osutil.RunCmd(10*time.Minute, "", "scp", args...)
+ _, err := osutil.RunCmd(10*time.Minute*inst.timeouts.Scale, "", "scp", args...)
if err != nil {
return "", err
}
@@ -643,7 +645,7 @@ func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) {
}
func (inst *instance) ssh(args ...string) ([]byte, error) {
- return osutil.RunCmd(time.Minute, "", "ssh", inst.sshArgs(args...)...)
+ return osutil.RunCmd(time.Minute*inst.timeouts.Scale, "", "ssh", inst.sshArgs(args...)...)
}
func (inst *instance) sshArgs(args ...string) []string {
diff --git a/vm/vm.go b/vm/vm.go
index 94f072545..541096ba0 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -77,15 +77,16 @@ func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) {
return nil, fmt.Errorf("unknown instance type '%v'", cfg.Type)
}
env := &vmimpl.Env{
- Name: cfg.Name,
- OS: cfg.TargetOS,
- Arch: cfg.TargetVMArch,
- Workdir: cfg.Workdir,
- Image: cfg.Image,
- SSHKey: cfg.SSHKey,
- SSHUser: cfg.SSHUser,
- Debug: debug,
- Config: cfg.VM,
+ Name: cfg.Name,
+ OS: cfg.TargetOS,
+ Arch: cfg.TargetVMArch,
+ Workdir: cfg.Workdir,
+ Image: cfg.Image,
+ SSHKey: cfg.SSHKey,
+ SSHUser: cfg.SSHUser,
+ Timeouts: cfg.Timeouts,
+ Debug: debug,
+ Config: cfg.VM,
}
impl, err := typ.Ctor(env)
if err != nil {
diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go
index 0ef8636ee..5a8fed098 100644
--- a/vm/vmimpl/vmimpl.go
+++ b/vm/vmimpl/vmimpl.go
@@ -19,6 +19,7 @@ import (
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
+ "github.com/google/syzkaller/sys/targets"
)
// Pool represents a set of test machines (VMs, physical devices, etc) of particular type.
@@ -62,15 +63,16 @@ type Instance interface {
type Env struct {
// Unique name
// Can be used for VM name collision resolution if several pools share global name space.
- Name string
- OS string // target OS
- Arch string // target arch
- Workdir string
- Image string
- SSHKey string
- SSHUser string
- Debug bool
- Config []byte // json-serialized VM-type-specific config
+ Name string
+ OS string // target OS
+ Arch string // target arch
+ Workdir string
+ Image string
+ SSHKey string
+ SSHUser string
+ Timeouts targets.Timeouts
+ Debug bool
+ Config []byte // json-serialized VM-type-specific config
}
// BootError is returned by Pool.Create when VM does not boot.