Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2874 from jeanlaurent/rm-infinite-loop
Browse files Browse the repository at this point in the history
Fix infinite loop when deleting machine in ultra weird state
  • Loading branch information
jeanlaurent committed Jan 19, 2016
2 parents 291533a + e466ee9 commit 62bcc30
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions drivers/virtualbox/virtualbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,22 +615,16 @@ func (d *Driver) Kill() error {
}

func (d *Driver) Remove() error {
s, err := d.GetState()
_, err := d.GetState()
if err != nil {
if err == ErrMachineNotExist {
log.Infof("machine does not exist, assuming it has been removed already")
return nil
}
return err
}
if s == state.Running {
if err := d.Stop(); err != nil {
return err
}
} else if s != state.Stopped {
if err := d.Kill(); err != nil {
return err
}
if err := d.Kill(); err != nil {
return err
}
// vbox will not release it's lock immediately after the stop
d.sleeper.Sleep(1 * time.Second)
Expand Down

0 comments on commit 62bcc30

Please sign in to comment.