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

Kill Firecracker if SendCtrlAltDel failed #177

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

yitsushi
Copy link
Contributor

What this PR does / why we need it:

Firecracker on arm machines does not support the SendCtrlAltDel action
and luckily it throws back an error instead of silently does nothing.

Why lucky? That way if the SendCtrlAltDel failed, we can rety to kill it
with a graceful SIGINT signal and if it did not work, we can throw back
an error and say "we did what we could".

Error message from Firecracker:

{"fault_message":"SendCtrlAltDel does not supported on aarch64."}

Which issue(s) this PR fixes:
Fixes #152

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Firecracker on arm machines does not support the SendCtrlAltDel action
and luckily it throws back an error instead of silently does nothing.

Why lucky? That way if the SendCtrlAltDel failed, we can rety to kill it
with a graceful SIGINT signal and if it did not work, we can throw back
an error and say "we did what we could".

Error message from Firecracker:

    {"fault_message":"SendCtrlAltDel does not supported on aarch64."}

Fixes liquidmetal-dev#152
@yitsushi yitsushi added the kind/feature New feature or request label Oct 27, 2021
pkg/process/process.go Outdated Show resolved Hide resolved
Comment on lines +167 to +176
if errors.Is(err, &url.Error{}) {
logger.Info("microvm is not running")
} else if pid, pidErr := vmState.PID(); pidErr != nil {
logger.Infof("sending SIGINT to %d", pid)

if sigErr := process.SendSignal(pid, os.Interrupt); sigErr != nil {
return fmt.Errorf("failed to create halt action: %w", err)
}
} else {
return fmt.Errorf("failed to create halt action: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

i am slightly worried that this section could become a bit unwieldy the more error/check variations we add... but happy to leave it until we actually see it happening

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in both cases the result is the same, failed delete and the wrapped error will tell why.

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2021

Codecov Report

Merging #177 (eb4f286) into main (94ab549) will increase coverage by 7.16%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
+ Coverage   47.00%   54.16%   +7.16%     
==========================================
  Files          45       45              
  Lines        1951     1968      +17     
==========================================
+ Hits          917     1066     +149     
+ Misses        930      795     -135     
- Partials      104      107       +3     
Impacted Files Coverage Δ
infrastructure/firecracker/provider.go 0.00% <0.00%> (ø)
infrastructure/firecracker/config.go 0.00% <0.00%> (ø)
core/steps/runtime/dir_create.go 73.07% <0.00%> (+30.76%) ⬆️
core/steps/runtime/initrd_mount.go 100.00% <0.00%> (+100.00%) ⬆️
core/steps/runtime/kernel_mount.go 100.00% <0.00%> (+100.00%) ⬆️
core/steps/runtime/volume_mount.go 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3217c47...eb4f286. Read the comment docs.

@yitsushi yitsushi requested a review from Callisto13 October 29, 2021 09:10
@yitsushi yitsushi merged commit 5c4d0d5 into liquidmetal-dev:main Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kill firecracker on shutdown if CtrlAltDel action did not work (ARM)
3 participants