Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --force argument to the stop command #1946

Merged
merged 53 commits into from
Jul 4, 2024
Merged

Add --force argument to the stop command #1946

merged 53 commits into from
Jul 4, 2024

Conversation

luis4a0
Copy link
Contributor

@luis4a0 luis4a0 commented Jan 28, 2021

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

Fixes #1909, Fixes #2492

@townsend2010
Copy link
Contributor

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.

@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Attention: Patch coverage is 84.93151% with 22 lines in your changes missing coverage. Please review.

Project coverage is 88.89%. Comparing base (e923e2d) to head (5173700).

Files Patch % Lines
src/daemon/daemon.cpp 5.00% 19 Missing ⚠️
...rc/platform/backends/qemu/qemu_virtual_machine.cpp 88.88% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1946      +/-   ##
==========================================
+ Coverage   88.83%   88.89%   +0.05%     
==========================================
  Files         253      254       +1     
  Lines       14170    14222      +52     
==========================================
+ Hits        12588    12642      +54     
+ Misses       1582     1580       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@luis4a0
Copy link
Contributor Author

luis4a0 commented Jan 29, 2021

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.

Base automatically changed from master to main March 3, 2021 13:41
@luis4a0 luis4a0 force-pushed the add-force-stop branch 2 times, most recently from 36d6cec to a4f04ff Compare May 26, 2021 14:30
@sharder996 sharder996 marked this pull request as ready for review August 19, 2022 15:56
@sharder996
Copy link
Contributor

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

@ricab
Copy link
Collaborator

ricab commented Jan 30, 2023

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...

Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @townsend2010, thanks for the PR! Not a proper review, but I was looking in order to base my work on top, so leaving a couple of comments.

src/platform/backends/qemu/qemu_virtual_machine.cpp Outdated Show resolved Hide resolved
src/client/cli/cmd/stop.cpp Outdated Show resolved Hide resolved
Chris Townsend and others added 20 commits July 3, 2024 19:25
…o using condition variable wait where is no other thread notifies him. This fix the non-responding bug on qemu force stop.
…nce the state variable is the only one needs to be protected, also convert unique_lock to scoped_lock because manual unlock/ lock is no longer needed.
…eck_state_for_shutdown function since the state variable is the only one needs to be protected, also convert unique_lock to scoped_lock because manual unlock/ lock is no longer needed."
…n boolean of wait_for_finished and log correspondingly.
Copy link
Contributor

@andrei-toterman andrei-toterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, everything seems to be working. Thanks, @georgeliao!

@andrei-toterman andrei-toterman added this pull request to the merge queue Jul 4, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 4, 2024
Add `--force` argument to the `stop` command
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 4, 2024
@georgeliao
Copy link
Contributor

@ricab we might need to manually merge again.

@ricab ricab merged commit 9a9bcf8 into main Jul 4, 2024
13 of 14 checks passed
@ricab ricab deleted the add-force-stop branch July 4, 2024 19:49
ricab added a commit that referenced this pull request Jul 4, 2024
Add `--force` argument to the `stop` command
ricab added a commit that referenced this pull request Jul 6, 2024
Add `--force` argument to the `stop` command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants