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: restore the id parameter default #4154

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

pb8o
Copy link
Contributor

@pb8o pb8o commented Oct 9, 2023

Changes

Restore the default value of the --id parameter, since it can cause a panic. And move the "running" message after the option is processed.

Reason

Without the change:

% sudo ./firecracker
2023-10-09T09:49:41.031007002 [anonymous-instance:main] Running Firecracker v1.5.0-dev
2023-10-09T09:49:41.031082658 [anonymous-instance:main] Firecracker panicked at 'called `Option::unwrap()` on a `None` value', src/firecracker/src/main.rs:291:52
[1]    980007 IOT instruction  ./build/cargo_target/x86_64-unknown-linux-musl/debug/firecracker
% sudo ./firecracker --id myname
2023-10-09T09:50:40.670878137 [anonymous-instance:main] Running Firecracker v1.5.0-dev

With the change:

% sudo ./firecracker
2023-10-09T10:01:11.604960827 [anonymous-instance:main] Running Firecracker v1.5.0-dev
# [doesn't panic]
% sudo ./firecracker --id myname
2023-10-09T10:00:39.098812475 [myname:main] Running Firecracker v1.5.0-dev

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following
Developer Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@pb8o pb8o self-assigned this Oct 9, 2023
@pb8o pb8o added Priority: High Indicates than an issue or pull request should be resolved ahead of issues or pull requests labelled Type: Fix Indicates a fix to existing code labels Oct 9, 2023
roypat
roypat previously approved these changes Oct 9, 2023
Copy link
Contributor

@roypat roypat left a comment

Choose a reason for hiding this comment

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

Is it easy to add a regression test for this?

@pb8o
Copy link
Contributor Author

pb8o commented Oct 9, 2023

Is it easy to add a regression test for this?

Yeah it should be. Let me add one.

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (fa4b299) 82.97% compared to head (96ed457) 82.99%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4154      +/-   ##
==========================================
+ Coverage   82.97%   82.99%   +0.01%     
==========================================
  Files         223      223              
  Lines       28452    28448       -4     
==========================================
  Hits        23609    23609              
+ Misses       4843     4839       -4     
Flag Coverage Δ
4.14-c7g.metal 78.53% <0.00%> (+0.01%) ⬆️
4.14-m5d.metal 80.32% <0.00%> (+<0.01%) ⬆️
4.14-m6a.metal 79.46% <0.00%> (+0.01%) ⬆️
4.14-m6g.metal 78.53% <0.00%> (+0.01%) ⬆️
4.14-m6i.metal 80.31% <0.00%> (+0.01%) ⬆️
5.10-c7g.metal 81.44% <0.00%> (+0.01%) ⬆️
5.10-m5d.metal 83.00% <0.00%> (+0.01%) ⬆️
5.10-m6a.metal 82.23% <0.00%> (+0.01%) ⬆️
5.10-m6g.metal 81.44% <0.00%> (+0.01%) ⬆️
5.10-m6i.metal 82.99% <0.00%> (+0.01%) ⬆️
6.1-c7g.metal 81.44% <0.00%> (+0.01%) ⬆️
6.1-m5d.metal 83.00% <0.00%> (+0.01%) ⬆️
6.1-m6a.metal 82.23% <0.00%> (+0.01%) ⬆️
6.1-m6g.metal 81.44% <0.00%> (+0.01%) ⬆️
6.1-m6i.metal 82.99% <0.00%> (+0.01%) ⬆️

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

Files Coverage Δ
src/firecracker/src/main.rs 0.22% <0.00%> (+<0.01%) ⬆️

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

@pb8o pb8o added the Status: Awaiting author Indicates that an issue or pull request requires author action label Oct 9, 2023
Running Firecracker without parameters causes a panic.

```
[anonymous-instance:main] Running Firecracker v1.5.0-dev
[anonymous-instance:main] Firecracker panicked at 'called
`Option::unwrap()` on a `None` value',
src/firecracker/src/main.rs:291:52
[1] 980007 IOT instruction
./firecracker
```

Fixes: 332f218

Signed-off-by: Pablo Barbáchano <[email protected]>
@pb8o pb8o merged commit c723745 into firecracker-microvm:main Oct 9, 2023
4 of 5 checks passed
@pb8o pb8o deleted the id-param-fix branch October 9, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Indicates than an issue or pull request should be resolved ahead of issues or pull requests labelled Status: Awaiting author Indicates that an issue or pull request requires author action Type: Fix Indicates a fix to existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants