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
snap-bootstrap: refactor partition creation #7958
snap-bootstrap: refactor partition creation #7958
Conversation
Refactor filesystem creation, deployment and mounting to act on a single partition instead of a slice of partitions. Based on Michael Vogt's work in PR snapcore#7723. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice, thanks! Makes the creation more atomic, I wonder if we can later use something like the partition (gpt) flags to mark each fully successful partition as pending and done (but that is certainly a followup :)
if err := partition.DeployContent(created, gadgetRoot); err != nil { | ||
return err | ||
} | ||
for _, part := range created { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for this!
err := partition.MakeFilesystem(part) | ||
c.Assert(err, IsNil) | ||
c.Assert(s.mockMkfsVfat.Calls(), HasLen, 1) | ||
c.Assert(s.mockMkfsExt4.Calls(), HasLen, i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a small comment here, when I skimmed over this (admittedly in the early morning) I missed that the first line has a "1" and the second a "i". Maybe something like // single fat partition is created first, then 2 ext4 partitions
. But not a blocker :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think the difference is much more noticeable in the terminal font. Adding the comment, and also changing the variable to n
to prevent misreadings.
Add a comment to the cumulative filesystem creation test and change the iterator variable name to prevent confusion between 1 and i. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Codecov Report
@@ Coverage Diff @@
## master #7958 +/- ##
==========================================
+ Coverage 80.86% 81.05% +0.19%
==========================================
Files 698 698
Lines 54986 55811 +825
==========================================
+ Hits 44462 45240 +778
- Misses 7113 7135 +22
- Partials 3411 3436 +25
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
Refactor filesystem creation, deployment and mounting to act on a single
partition instead of a slice of partitions.
Based on Michael Vogt's work in PR #7723.
Signed-off-by: Claudio Matsuoka claudio.matsuoka@canonical.com