Skip to content

Commit

Permalink
vfkit: Graceful shutdown on Stop() (#20504)
Browse files Browse the repository at this point in the history
We use `HardStop` which seems to do a forced shutdown instead of
graceful shutdown, and to make things worse, always fails with:

    I0309 15:00:42.452986   13723 stop.go:66] stop err: Post "http://_/vm/state": EOF

Which leads to unneeded retry and pointless backup attempt timing out
after 135 seconds because vkfit was stopped.

With this change we do a graceful shutdown, and the time to stop the
cluster decreased from 135 seconds to 3 seconds (45 times faster).

Example stop log:

    I0309 15:34:33.104429   14440 main.go:141] libmachine: Stopping "minikube"...
    I0309 15:34:33.105225   14440 main.go:141] libmachine: get state: {State:VirtualMachineStateRunning}
    I0309 15:34:33.105799   14440 main.go:141] libmachine: set state: {State:Stop}
    I0309 15:34:33.106099   14440 main.go:141] libmachine: get state: {State:VirtualMachineStateRunning}
    I0309 15:34:36.109380   14440 main.go:141] libmachine: Machine "minikube" was stopped.
  • Loading branch information
nirs authored Mar 10, 2025
1 parent bfc97cd commit 3957c12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/drivers/vfkit/vfkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func isBootpdError(err error) bool {
}

func (d *Driver) Stop() error {
if err := d.SetVFKitState("HardStop"); err != nil {
if err := d.SetVFKitState("Stop"); err != nil {
return err
}
return nil
Expand Down

0 comments on commit 3957c12

Please sign in to comment.