Skip to content

Commit

Permalink
Merge pull request hashicorp#1403 from notogawa/issue-1334
Browse files Browse the repository at this point in the history
Fixes hashicorp#1334, Add power on retry to ESXi Driver.
  • Loading branch information
mitchellh committed Oct 28, 2014
2 parents e422a45 + eacae83 commit 6c44d72
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion builder/vmware/iso/driver_esx5.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@ func (d *ESX5Driver) IsRunning(string) (bool, error) {
}

func (d *ESX5Driver) Start(vmxPathLocal string, headless bool) error {
return d.sh("vim-cmd", "vmsvc/power.on", d.vmId)
for i := 0; i < 20; i++ {
err := d.sh("vim-cmd", "vmsvc/power.on", d.vmId)
if err != nil {
return err
}
time.Sleep((time.Duration(i) * time.Second) + 1)
running, err := d.IsRunning(vmxPathLocal)
if err != nil {
return err
}
if running {
return nil
}
}
return errors.New("Retry limit exceeded")
}

func (d *ESX5Driver) Stop(vmxPathLocal string) error {
Expand Down

0 comments on commit 6c44d72

Please sign in to comment.