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

Fix stop succeeding when instance isn't stopped #3684

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

Sploder12
Copy link
Contributor

resolves #2907

When running stop on an instance that could not be stopped no error would be reported. This was because QemuVirtualMachine::shutdown(force=false) ignored the result of vm_process->wait_for_finished(shutdown_timeout) which indicates if a timeout occurred or not. This issue does not seem to be present in other VM backends.

This PR makes it so the timeout is not ignored and the timeout is properly reported.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.94%. Comparing base (0189211) to head (dd7cfb0).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3684      +/-   ##
==========================================
+ Coverage   88.92%   88.94%   +0.02%     
==========================================
  Files         254      254              
  Lines       14271    14276       +5     
==========================================
+ Hits        12690    12698       +8     
+ Misses       1581     1578       -3     
Flag Coverage Δ
88.94% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ricab
Copy link
Collaborator

ricab commented Sep 19, 2024

Hey @Sploder12, thanks! Would you mind rebasing? Although there doesn't seem to be a conflict, GH still shows a diff to the old version here:

Screenshot from 2024-09-19 12-40-51


machine->state = mp::VirtualMachine::State::running;

EXPECT_THROW(machine->shutdown(), std::runtime_error);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could look into our MP_EXPECT_THROW_THAT macro, which we use to add a matcher for the exception message, so that it's more clear about what you actually expect, not just any random std::runtime_error.

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, code looks good and now the stop command fails as it should. Thanks, @Sploder12!

@andrei-toterman andrei-toterman added this pull request to the merge queue Sep 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 25, 2024
@ricab ricab added this pull request to the merge queue Sep 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 26, 2024
@andrei-toterman andrei-toterman added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit f11f181 Sep 26, 2024
14 checks passed
@andrei-toterman andrei-toterman deleted the fix-stop-failed-no-error branch September 26, 2024 10:49
ricab pushed a commit that referenced this pull request Sep 27, 2024
Fix `stop` succeeding when instance isn't stopped
ricab pushed a commit that referenced this pull request Sep 30, 2024
Fix `stop` succeeding when instance isn't stopped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stop command succeeds even when the instance isn't stopped
3 participants