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

o/snapstate, overlord, o/devicestate: support downloading components in snapstate.Download #14835

Conversation

andrewphelpsj
Copy link
Member

This will enable us to download arbitrary components for the purpose of creating a recovery system. Follow-up PR will move where we download the blobs to from the global blob dir, to somewhere under /var/cache/snapd.

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 89.17197% with 17 lines in your changes missing coverage. Please review.

Project coverage is 78.27%. Comparing base (24a0034) to head (6b29345).
Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
overlord/snapstate/snapstate.go 93.81% 3 Missing and 3 partials ⚠️
overlord/snapstate/target.go 78.26% 4 Missing and 1 partial ⚠️
overlord/snapstate/snapmgr.go 82.35% 2 Missing and 1 partial ⚠️
overlord/snapstate/storehelpers.go 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14835      +/-   ##
==========================================
+ Coverage   78.20%   78.27%   +0.06%     
==========================================
  Files        1151     1153       +2     
  Lines      151396   152219     +823     
==========================================
+ Hits       118402   119152     +750     
- Misses      25662    25706      +44     
- Partials     7332     7361      +29     
Flag Coverage Δ
unittests 78.27% <89.17%> (+0.06%) ⬆️

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.

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thanks, did a pass, some comments

@@ -245,6 +248,26 @@ func (compsu *ComponentSetup) Revision() snap.Revision {
return compsu.CompSideInfo.Revision
}

func (compsu *ComponentSetup) MountFile(instanceName string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs a doc comment, also it's slightly strange name for this given that it takes into account a variable BlobDir, this is the mount file only if DownloadBlobDir is unset

Copy link
Member Author

Choose a reason for hiding this comment

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

This is symmetric with the MountFile method on SnapSetup. Maybe they both could be renamed? SourceFile? BlobPath?

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed.

overlord/snapstate/snapstate.go Outdated Show resolved Hide resolved
overlord/snapstate/target.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thank you

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -197,8 +197,10 @@ func (snapsup *SnapSetup) MountDir() string {
return snap.MountDir(snapsup.InstanceName(), snapsup.Revision())
}

// MountFile returns the path to the snap/squashfs file that is used to mount the snap.
func (snapsup *SnapSetup) MountFile() string {
// BlobPath returns the path to the snap/squashfs file that is backs the snap

Choose a reason for hiding this comment

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

typo: s/is //

@andrewphelpsj andrewphelpsj force-pushed the snapstate-download-components branch from c206dcd to 6b29345 Compare December 15, 2024 18:23
@andrewphelpsj
Copy link
Member Author

Only required failure is google:ubuntu-16.04-64:tests/main/degraded, which is a known issue.

@alfonsosanchezbeato alfonsosanchezbeato merged commit 7fb3b60 into canonical:master Dec 16, 2024
55 of 59 checks passed
@andrewphelpsj andrewphelpsj deleted the snapstate-download-components branch December 16, 2024 15:54
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.

3 participants