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

Rework layer handling to return a ResourceCloser #1743

Merged
merged 1 commit into from
May 4, 2023

Conversation

kevpar
Copy link
Member

@kevpar kevpar commented Apr 23, 2023

This is commit 4/6 in a chain. Recommended to review in order. If reviewing a later PR in the chain, you can view individual commits to see just what that PR changes.

Currently, the layers package relies on the caller of Mount*COWLayers to
subsequently call NewImageLayers, which constructs a special ImageLayers
object that can be used to later clean up the layer mounts. However,
this requires the caller to know too much about the internals of the
layer mounting process.

A cleaner approach, which I take here, is to instead return a standard
ResourceCloser from Mount*COWLayers which then knows how to clean up
whatever mounts were done. I have also changed the layers code to use
ResourceCloser in more places internally.

There is a new check in resources_*cow.go, such that the layers closer
is only stored if the container is not a hypervisor-isolated sandbox
container. This duplicates the logic that was previously in
(*ImageLayers).Release.

@msscotb msscotb self-assigned this May 3, 2023
Currently, the layers package relies on the caller of Mount*COWLayers to
subsequently call NewImageLayers, which constructs a special ImageLayers
object that can be used to later clean up the layer mounts. However,
this requires the caller to know too much about the internals of the
layer mounting process.

A cleaner approach, which I take here, is to instead return a standard
ResourceCloser from Mount*COWLayers which then knows how to clean up
whatever mounts were done. I have also changed the layers code to use
ResourceCloser in more places internally.

There is a new check in resources_*cow.go, such that the layers closer
is only stored if the container is not a hypervisor-isolated sandbox
container. This duplicates the logic that was previously in
(*ImageLayers).Release.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
@kevpar kevpar merged commit d1b45c5 into microsoft:main May 4, 2023
14 of 16 checks passed
anmaxvl pushed a commit that referenced this pull request Oct 20, 2023
This PR updates our ADO fork to commits in hcsshim up to commit hash [7769a64](7769a64). This includes support for partitioned scsi devices and ensuring filesystem format for lcow scsi devices.

Related work items: #1728, #1740, #1741, #1742, #1743, #1744, #1745, #1747, #1748, #1749, #1750, #1752, #1754, #1756, #1757, #1767, #1769, #1771, #1772, #1773, #1779
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.

None yet

4 participants