Make it structually clear that the code is all using the same value,
making it less likely for the verifier and other uses to get out of sync.
Also avoids some redundant parsing and error paths.
The conversion path looks longer, but that's just moving the parsing
from the called function (which is redundant for other callers).
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
(cherry picked from commit 1f47b38c09)
Make it structually clear that the code is all using the same value,
making it less likely for the verifier and other uses to get out of sync.
Also avoids some redundant parsing and error paths.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
(cherry picked from commit 3beea1e21e)
if the file is created using the object-store flat directory format,
there is no need to set its inodes attributes, as anyway they are
ignored when creating the composefs binary blob.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 1126d65aa7)
if a file was deduplicated with a hard link, do not override its
metadata.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 0f12ecea79)
when it is set, only the file payload is written, but the inode
attributes are ignored.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit f52cbe08c1)
improve the function that combines neighbor chunks. Instead of using
the number of parts, which also includes local files, use only the
number of chunks that must be retrieved from the network.
In addition, introduce a threshold limit to merge chunks so that we
further reduce the number of requested ranges.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
move the check for `enable_partial_images` to GetDiffer so that it
doesn't attempt any operation if the feature is disabled.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
by default enable pulling a partial image, it is still possible to
disable the feature through the configuration file.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
even if we validated the full layer, report the TOC Digest as well so
the upper layer can use both.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
store the UncompressedDigest when the original tarball was converted
to zstd:chunked, since its diffID was computed and validated.
In this way the layer can be reused as any other layer that was fully
retrieved and validated.
Before this change, a layer that was converted to zstd:chunked was
always retrieved since it has not a TOC Digest.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
it prevents clobbering the chunk .Size element later. This filed was
ignored previously, but composefs uses it to retrieve the file size.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
reject a layer if it contains both a zstd:chunked and an eStargz TOC
since there are no guarantees that the two TOCs are consistent.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
drop the rootless argument from DefaultStoreOptions and
UpdateStoreOptions since this can be retrieved internally through the
unshare package.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
so that the users of the function can get access to the already
unmarshalled TOC instead of having to unmarshal it again.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if the "convert_images" option is set in the configuration file, then
convert traditional images to the chunked format on the fly.
This is very expensive at the moment since the entire zstd:chunked
file is created and then processed.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
change the file format to store the tar-split as part of the
zstd:chunked image. This will allow clients to rebuild the entire
tarball without having to download it fully.
also store the uncompressed digest for the tarball, so that it can be
stored into the storage database.
Needs: https://github.com/containers/image/pull/1976
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
gofumpt is a superset of gofmt, enabling some more code formatting
rules.
This commit is brought to you by
gofumpt -w .
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Two error messages suggest that podman-system-migrate is a binary that
can be run, when the command is "podman system migrate".
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We now use the golang error wrapping format specifier `%w` instead of the
deprecated github.com/pkg/errors package.
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
drop host deduplication by just looking at the file path. It could be
useful in very specific use cases, but it is too expensive for generic
images. If the need arises, we first need to create an index of the
files that we can deduplicate so there is no need to calculate the
checksum on the fly.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
after the missing parts are merged, it is necessary to recalculate the
chunks to ask to the server.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Based on a conversation on the Podman mailing list:
Mentioning podman-system-migrate in the error message may help users
resolve their issues faster.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
automatically detect holes in sparse files (the threshold is hardcoded
at 1kb for now) and add this information to the manifest file.
The receiver will create a hole (using unix.Seek and unix.Ftruncate)
instead of writing the actual zeros.
Closes: https://github.com/containers/storage/issues/1091
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>