From 97b58e7eae01ebe5df5d0bfdff4e6154e7ca869b Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Jun 2017 14:34:02 +0200 Subject: syz-manager/mgrconfig: move sshkey from vm config to manager config Sshkey is a property of image, which is in manager config. Move sshkey to the same location as image. The motivation for the move is as follows. Continuous build produces an image and the key, both need to be passed manager instance. Continuous build system should not distinguish different VM types and mess with their configs. NOTE FOR USERS: this breaks manager configs again. Hopefully the last time for now. Docs are updated. --- vm/odroid/odroid.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'vm/odroid') diff --git a/vm/odroid/odroid.go b/vm/odroid/odroid.go index 69c77b9c6..2d1f0482e 100644 --- a/vm/odroid/odroid.go +++ b/vm/odroid/odroid.go @@ -39,7 +39,6 @@ type Config struct { Hub_Bus int // host USB bus number for the USB hub Hub_Device int // host USB device number for the USB hub Hub_Port int // port on the USB hub to which Odroid is connected - Sshkey string // root ssh key for the image } type Pool struct { @@ -49,6 +48,7 @@ type Pool struct { type instance struct { cfg *Config + sshkey string closed chan bool debug bool } @@ -56,7 +56,7 @@ type instance struct { func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { cfg := &Config{} if err := config.LoadData(env.Config, cfg); err != nil { - return nil, err + return nil, fmt.Errorf("failed to parse odroid vm config: %v", err) } if cfg.Host_Addr == "" { return nil, fmt.Errorf("config param host_addr is empty") @@ -76,8 +76,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { if cfg.Hub_Port == 0 { return nil, fmt.Errorf("config param hub_port is empty") } - if !osutil.IsExist(cfg.Sshkey) { - return nil, fmt.Errorf("ssh key '%v' does not exist", cfg.Sshkey) + if !osutil.IsExist(env.Sshkey) { + return nil, fmt.Errorf("ssh key '%v' does not exist", env.Sshkey) } if !osutil.IxExist(cfg.Console) { return nil, fmt.Errorf("console file '%v' does not exist", cfg.Console) @@ -96,6 +96,7 @@ func (pool *Pool) Count() int { func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { inst := &instance{ cfg: pool.cfg, + sshkey: pool.env.Sshkey, closed: make(chan bool), debug: pool.env.Debug, } @@ -397,7 +398,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin func (inst *instance) sshArgs(portArg string) []string { args := []string{ - "-i", inst.cfg.Sshkey, + "-i", inst.sshkey, portArg, "22", "-F", "/dev/null", "-o", "ConnectionAttempts=10", -- cgit mrf-deployment