fix: ensure we use the snapshot for the highest image layer #346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This fixes a bug where we where using the snapshot of the first layer of
a container image always. This wasn't a problem previously as the image
we where using for the root filesystem had a single layer. However, when
we started using an image with multiple layers the microvm wasn't
seeing the contents of any additional layers and instead it just saw the
first layer, which in our case meant that the additional apt packages
(like systemd) weren't available to the microvm.
For example, when using
docker.io/richardcase/capmvm-ubuntu-base:20.04
which has 2 layers, it creates 2 snapshots when the image is unpacked:
We where using
sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b
but we should be using
sha256:6bee76bc089d04f0afe71e48cf0f385a20b5f251380fb48364106e50101a7fbd
when creating the active snapshot for the microvm. Notice the parent column.
This change makes sure we use the snapshot for the highest layer.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Checklist: