mirror of
https://github.com/containers/podman
synced 2024-10-19 08:44:11 +00:00
Merge pull request #14470 from shanesmith/machine-force-remove-doesnt-stop
Stop machine before force removing files
This commit is contained in:
commit
f7a54088c3
|
@ -831,8 +831,14 @@ func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func()
|
|||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
if state == machine.Running && !opts.Force {
|
||||
return "", nil, errors.Errorf("running vm %q cannot be destroyed", v.Name)
|
||||
if state == machine.Running {
|
||||
if !opts.Force {
|
||||
return "", nil, errors.Errorf("running vm %q cannot be destroyed", v.Name)
|
||||
}
|
||||
err := v.Stop(v.Name, machine.StopOptions{})
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Collect all the files that need to be destroyed
|
||||
|
|
Loading…
Reference in a new issue