Systemd/src/import
Kevin Kuehler 50dfca2eaf import: Only keep RO copy if ETag header is set
We fix the case when the webserver servers container images without
setting the ETag header in the response.  When an image is downloaded to
image root, a read only copy is stored alongside it.  The filename has
the following form:
    .raw-<encoded-url-of-image>.\x22<ETAG-header>\22.raw.
This is so, if the same resource is fetched multiple times, importd can
avoid extra downloads by creating the new image using the local read-only copy.

The current code assumes the ETag header is set because, if the server
does not set the ETag header, the file is stored without the ETag value
in the filename. When importd fetches a duplicate image, it will run
rename_noreplace and fail:

  Failed to rename raw file to /var/lib/machines/.raw-http:\x2f\x2flocalhost:8000\x2fwalkthroughd.raw: File exists

This patch makes importd only store a read-only image if the webserver
has set the ETag header.
2020-03-23 21:39:59 -07:00
..
curl-util.c import: let's disable UNIX signal generation from curl 2020-01-20 22:09:38 +01:00
curl-util.h importd: Avoid need for fd translation table 2019-07-09 10:00:13 +02:00
export-raw.c include missing_fcntl.h where needed 2019-11-07 10:17:44 +00:00
export-raw.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
export-tar.c tree-wide: say "ratelimit" not "rate_limit" 2019-09-20 16:05:53 +02:00
export-tar.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
export.c basic: add new helper call empty_or_dash_to_null() 2019-04-08 12:11:11 +02:00
import-common.c tree-wide: replace strjoina() with prefix_roota() 2019-06-25 01:31:26 +09:00
import-common.h import: rerrange tarball/fs imports that have a single top-level directory containing the OS tree 2018-11-26 18:09:01 +01:00
import-compress.c Make bzip2 an optional dependency for systemd-importd 2018-09-25 10:58:09 +02:00
import-compress.h Make bzip2 an optional dependency for systemd-importd 2018-09-25 10:58:09 +02:00
import-fs.c Drop RATELIMIT macros 2019-09-20 16:05:53 +02:00
import-pubring.gpg import: add image verification using gpg 2015-01-21 04:03:54 +01:00
import-raw.c import: don't complain if FS_NOCOW_FL is not available 2020-01-20 21:10:31 +01:00
import-raw.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
import-tar.c tree-wide: say "ratelimit" not "rate_limit" 2019-09-20 16:05:53 +02:00
import-tar.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
import.c basic: add new helper call empty_or_dash_to_null() 2019-04-08 12:11:11 +02:00
importd.c shared: split out polkit stuff from bus-util.c → bus-polkit.c 2020-01-22 12:34:10 +01:00
meson.build machine: add support for importing containers from plain directories 2018-11-26 18:09:01 +01:00
org.freedesktop.import1.conf machine: add support for importing containers from plain directories 2018-11-26 18:09:01 +01:00
org.freedesktop.import1.policy meson: drop unnecessary "transformation" of policy files 2018-02-16 13:01:12 +01:00
org.freedesktop.import1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
pull-common.c tree-wide: replace strjoina() with prefix_roota() 2019-06-25 01:31:26 +09:00
pull-common.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
pull-job.c tree-wide: get rid of strappend() 2019-07-12 14:31:12 +09:00
pull-job.h import: drop logic of setting up /var/lib/machines as btrfs loopback mount 2018-11-26 18:09:01 +01:00
pull-raw.c import: Only keep RO copy if ETag header is set 2020-03-23 21:39:59 -07:00
pull-raw.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
pull-tar.c util-lib: when copying files make sure to apply some chattrs early, some late 2019-03-28 18:43:04 +01:00
pull-tar.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
pull.c basic: add new helper call empty_or_dash_to_null() 2019-04-08 12:11:11 +02:00
qcow2-util.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
qcow2-util.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
test-qcow2.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00