diff --git a/pkg/machine/hyperv/config.go b/pkg/machine/hyperv/config.go index 9f92e59b65..763117d710 100644 --- a/pkg/machine/hyperv/config.go +++ b/pkg/machine/hyperv/config.go @@ -212,11 +212,8 @@ func (v HyperVVirtualization) RemoveAndCleanMachines() error { prevErr = handlePrevError(err, prevErr) } - // If the VM is not stopped, we need to stop it - // TODO stop might not be enough if the state is dorked. we may need - // something like forceoff hard switch if vm.State() != hypervctl.Disabled { - if err := vm.Stop(); err != nil { + if err := vm.StopWithForce(); err != nil { prevErr = handlePrevError(err, prevErr) } } diff --git a/pkg/machine/hyperv/machine.go b/pkg/machine/hyperv/machine.go index eb7a55cd7c..260babdf7e 100644 --- a/pkg/machine/hyperv/machine.go +++ b/pkg/machine/hyperv/machine.go @@ -359,7 +359,8 @@ func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, fu if !opts.Force { return "", nil, &machine.ErrVMRunningCannotDestroyed{Name: m.Name} } - if err := vm.Stop(); err != nil { + // force stop bc we are destroying + if err := vm.StopWithForce(); err != nil { return "", nil, err } }