diff options
author | Mehul Arora <aroram18@mcmaster.ca> | 2021-06-19 11:27:24 +0530 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-07-27 15:32:23 +0200 |
commit | 6fe03b25abded53b67a7707abbcd9708042d9151 (patch) | |
tree | 91d3f08eee6a7389873d8f22db9dee1393c05a18 /libpod | |
parent | b6c279be2296ce32fbb36ba39bd948f93be9bede (diff) | |
download | podman-6fe03b25abded53b67a7707abbcd9708042d9151.tar.gz podman-6fe03b25abded53b67a7707abbcd9708042d9151.tar.bz2 podman-6fe03b25abded53b67a7707abbcd9708042d9151.zip |
support container to container copy
Implement container to container copy. Previously data could only be
copied from/to the host.
Fixes: #7370
Co-authored-by: Mehul Arora <aroram18@mcmaster.ca>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 4 | ||||
-rw-r--r-- | libpod/container_copy_linux.go | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 390bba7bb..d221baa77 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -840,7 +840,7 @@ func (c *Container) ShouldRestart(ctx context.Context) bool { // CopyFromArchive copies the contents from the specified tarStream to path // *inside* the container. -func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, chown bool, tarStream io.Reader) (func() error, error) { +func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, chown bool, rename map[string]string, tarStream io.Reader) (func() error, error) { if !c.batched { c.lock.Lock() defer c.lock.Unlock() @@ -850,7 +850,7 @@ func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, c } } - return c.copyFromArchive(ctx, containerPath, chown, tarStream) + return c.copyFromArchive(ctx, containerPath, chown, rename, tarStream) } // CopyToArchive copies the contents from the specified path *inside* the diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go index 01e7ecacb..a35824289 100644 --- a/libpod/container_copy_linux.go +++ b/libpod/container_copy_linux.go @@ -23,7 +23,7 @@ import ( "golang.org/x/sys/unix" ) -func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool, reader io.Reader) (func() error, error) { +func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool, rename map[string]string, reader io.Reader) (func() error, error) { var ( mountPoint string resolvedRoot string @@ -89,6 +89,7 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool GIDMap: c.config.IDMappings.GIDMap, ChownDirs: idPair, ChownFiles: idPair, + Rename: rename, } return c.joinMountAndExec(ctx, |