multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Add `--force` argument to the `stop` command

Open luis4a0 opened this issue 4 years ago • 6 comments

Add a new parameter to force the shutdown instances (i.e., power down them).

Fixes #1909, Fixes #2492

luis4a0 avatar Jan 28 '21 19:01 luis4a0

Hey @luis4a0,

I know this is still in draft, but I always envisioned just adding a bool force flag to shutdown() and stop() (it also can be argued that either shutdown() or stop() can be dropped altogether, but that's for a different day). That way, you are not having to duplicate any special handling or logic that you are currently doing if some of the force_shutdown() implementations.

townsend2010 avatar Jan 28 '21 20:01 townsend2010

Codecov Report

Attention: Patch coverage is 64.70588% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 88.85%. Comparing base (697e2f5) to head (45dcacd).

Files Patch % Lines
src/daemon/daemon.cpp 8.33% 11 Missing :warning:
...tform/backends/libvirt/libvirt_virtual_machine.cpp 36.36% 7 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1946      +/-   ##
==========================================
- Coverage   88.89%   88.85%   -0.04%     
==========================================
  Files         254      254              
  Lines       14081    14118      +37     
==========================================
+ Hits        12517    12545      +28     
- Misses       1564     1573       +9     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 28 '21 20:01 codecov[bot]

Hey @townsend2010, thanks a lot for your comment! What you propose makes complete sense, I'll finish testing if the commands I used indeed work to turn off VM's and then rework the code.

luis4a0 avatar Jan 29 '21 13:01 luis4a0

Added a few small changes; mostly refactoring with the current state of main and some wiring that got missed.

Fixes #2492

and

#2693 can be closed as its no longer needed

sharder996 avatar Aug 19 '22 15:08 sharder996

Once this is in, I think we should also change delete such that running instances get force-stopped if a regular stop is not enough. I don't think it makes a lot of sense for deleted instances to keep running...

ricab avatar Jan 30 '23 18:01 ricab