Skip to content

Commit

Permalink
Improve hyperkit vm stop
Browse files Browse the repository at this point in the history
  • Loading branch information
josedonizetti authored and medyagh committed Jun 28, 2019
1 parent 9dfe660 commit 7fe2247
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion pkg/drivers/hyperkit/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,26 @@ func (d *Driver) Stop() error {
return err
}
d.cleanupNfsExports()
return d.sendSignal(syscall.SIGTERM)
err := d.sendSignal(syscall.SIGTERM)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("hyperkit sigterm failed"))
}

// wait 5s for graceful shutdown
for i := 0; i < 5; i++ {
log.Debug("waiting for graceful shutdown")
time.Sleep(time.Second * 1)
s, err := d.GetState()
if err != nil {
return errors.Wrap(err, fmt.Sprintf("hyperkit waiting graceful shutdown failed"))
}
if s == state.Stopped {
return nil
}
}

log.Debug("sending sigkill")
return d.Kill()
}

func (d *Driver) extractKernel(isoPath string) error {
Expand Down

0 comments on commit 7fe2247

Please sign in to comment.