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

GPT header rework - Refacto 2 #234

Merged
merged 12 commits into from
Jul 24, 2024
Merged

GPT header rework - Refacto 2 #234

merged 12 commits into from
Jul 24, 2024

Conversation

upils
Copy link
Collaborator

@upils upils commented Jul 16, 2024

Refactoring of calculateRootfsSize() and introducing a dedicated function to know if we are dealing with a "rootfs structure" (see isRootfsStructure()).

I also added as a bonus the up-to-date configuration of mkfs for oracular and removed the one for mantic.

@upils upils self-assigned this Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.27%. Comparing base (d048fec) to head (46f65b8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   94.23%   94.27%   +0.03%     
==========================================
  Files          16       16              
  Lines        3330     3353      +23     
==========================================
+ Hits         3138     3161      +23     
  Misses        123      123              
  Partials       69       69              
Flag Coverage Δ
unittests 94.27% <100.00%> (+0.03%) ⬆️

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.

@upils upils force-pushed the gpt-header-refacto-2 branch from 521e13e to a87480a Compare July 16, 2024 13:17
@upils upils force-pushed the gpt-header-refacto-1 branch from 4f38b3e to 4f6540b Compare July 16, 2024 14:55
@upils upils force-pushed the gpt-header-refacto-2 branch from a87480a to 6050bf9 Compare July 16, 2024 14:56
Base automatically changed from gpt-header-refacto-1 to main July 17, 2024 07:52
@upils upils requested a review from sil2100 July 17, 2024 07:53
upils added 12 commits July 17, 2024 09:56
Signed-off-by: Paul Mars <paul.mars@canonical.com>
We previously sutracted several time some of other structure size/offset. So make sure we
get it right.
Name a couple of magic numbers.

Signed-off-by: Paul Mars <paul.mars@canonical.com>
…eRootfsSize

Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
Split this function in easier to understand bits.
Make sure the size declared in the gadget YAML
is respected.

Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
If the calculated rootfs size is bigger than the requested image size, do not return an error but print a warning. This is consistent with other places where the image-size flag cannot be respected.

Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
Signed-off-by: Paul Mars <paul.mars@canonical.com>
@upils upils force-pushed the gpt-header-refacto-2 branch from 2adb98d to 46f65b8 Compare July 17, 2024 08:01
Copy link
Contributor

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

Looks good in general. I just have some questions re: the size vs min-size. What will happen in case where min-size is not defined for the rootfs, but someone sets say size: 1G but then the rootfs itself will be 2G? Should we handle the case of printing out a warning/error for users, that the rootfs size they provided is too small to hold the rootfs (similarly to the image-size case)?

internal/statemachine/common_states.go Show resolved Hide resolved
internal/statemachine/common_states.go Show resolved Hide resolved
Copy link
Contributor

@sil2100 sil2100 left a comment

Choose a reason for hiding this comment

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

As per our discussion, all good! Let's move to the next PR ;)

@upils upils merged commit b1655f1 into main Jul 24, 2024
11 of 15 checks passed
@upils upils deleted the gpt-header-refacto-2 branch July 24, 2024 15:05
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.

2 participants