Merge pull request #597 from ehazlett/no-error-vbox-start

virtualbox: check state before attempting start
This commit is contained in:
Evan Hazlett 2015-02-24 14:55:02 -05:00
commit 808b4cff6d
1 changed files with 10 additions and 2 deletions

View File

@ -339,10 +339,18 @@ func (d *Driver) Create() error {
} }
func (d *Driver) Start() error { func (d *Driver) Start() error {
if err := vbm("startvm", d.MachineName, "--type", "headless"); err != nil { s, err := d.GetState()
if err != nil {
return err return err
} }
log.Infof("Waiting for VM to start...")
if s == state.Stopped {
if err := vbm("startvm", d.MachineName, "--type", "headless"); err != nil {
return err
}
log.Infof("Waiting for VM to start...")
}
return ssh.WaitForTCP(fmt.Sprintf("localhost:%d", d.SSHPort)) return ssh.WaitForTCP(fmt.Sprintf("localhost:%d", d.SSHPort))
} }