-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman-remote cp, varlink API CopyTo &CopyFrom #3568
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: QiWang19 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@jwhonce |
☔ The latest upstream changes (presumably #3531) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of debug and error msg that don't appear to have context when run on a system with multiple users.
I believe this covers the requirements. /cc @baude
pkg/adapter/containers_remote.go
Outdated
if strings.HasSuffix(dest, "/") { | ||
destPath = fmt.Sprintf("%s/", destPath) | ||
} | ||
reply, err := iopodman.CopyTo().Send(r.Conn, varlink.Upgrade, location, srcPath, 0600, destPath, extract, pause, ctr.ID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't mode match Src file vs. hard coded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the source file is from the remote file system this augument is not useful under this situation.
pkg/adapter/containers_remote.go
Outdated
} | ||
reply, err := iopodman.CopyTo().Send(r.Conn, varlink.Upgrade, location, srcPath, 0600, destPath, extract, pause, ctr.ID()) | ||
if err != nil { | ||
return errors.Wrapf(err, "varlink call CopyTo error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does err have context to what happened?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pkg/adapter/containers_remote.go
Outdated
return nil | ||
} | ||
|
||
err := r.CopyToContainer(src, dest, srcPath, destPath, extract, pause, ctr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No mode?
} | ||
|
||
// untar tempFile under os.TempDir() if the source is a file and not archive | ||
tempTarball, err := os.Open(srcFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the tarball carry the modes for the source files and directory path? If so that could clean up the API a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I'll check. But the mode argument is only useful when using CopyTo() to copy to remote. It is not useful in the CopyFrom or the varlink call
☔ The latest upstream changes (presumably #3767) made this pull request unmergeable. Please resolve the merge conflicts. |
1ffe7e5
to
5e4ae2c
Compare
☔ The latest upstream changes (presumably #4001) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #4165) made this pull request unmergeable. Please resolve the merge conflicts. |
cbe485d
to
bc0799e
Compare
☔ The latest upstream changes (presumably #4197) made this pull request unmergeable. Please resolve the merge conflicts. |
a349a6b
to
33fb8e8
Compare
☔ The latest upstream changes (presumably #4220) made this pull request unmergeable. Please resolve the merge conflicts. |
0e60d46
to
911d8e6
Compare
@jwhonce cleaned the reviews and rebased. PTAL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is currently a lot of duplication, but knowing we're going to refactor this code to run as the container in the future We can live with it.
pkg/util/utils.go
Outdated
"github.com/containers/storage/pkg/idtools" | ||
v1 "github.com/opencontainers/image-spec/specs-go/v1" | ||
v1 "github.com/opencontainers/image-spec/specs-go/v1" // "github.com/opencontainers/image-spec/specs-go/v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add the comment?
} | ||
|
||
// ParsePath parses the input of cp command returns the path and the container | ||
func (r *LocalRuntime) ParsePath(path string) (*Container, string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move this code to pkg/util/utils.go you won't need to duplicate it between local and remote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there will be an import circle cmd/podman imports adapter, adapter imports util, util imports adapter. Because ParsePath needs adapter.Runtime to check the input container. Can I get rid of this circle?
docs/podman-container.1.md
Outdated
@@ -17,7 +17,7 @@ The container command allows you to manage containers | |||
| checkpoint | [podman-container-checkpoint(1)](podman-container-checkpoint.1.md) | Checkpoints one or more running containers. | | |||
| cleanup | [podman-container-cleanup(1)](podman-container-cleanup.1.md) | Cleanup the container's network and mountpoints. | | |||
| commit | [podman-commit(1)](podman-commit.1.md) | Create new image based on the changed container. | | |||
| cp | [podman-cp(1)](podman-cp.1.md) | Copy files/folders between a container and the local filesystem. | | |||
| cp | [podman-cp(1)](podman-cp.1.md) | Copy files/folders between a container and the local filesystem | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the period?
Implemented podman-remote cp adding varlink API CopyTo & CopyFrom Copy inside remote machine ``` // source file: from remote container // destination: remote file system $ bin/podman-remote cp adc8:/ctrfile local:/home/qiwang/Documents/file ``` ``` // source file: from remote container // destination: local file system $ bin/podman-remote cp adc8:/ctrfile remote:/home/qiwan/Documents/file ``` Copy between local and remote container ``` // source file: local file system // destination: remote container $ bin/podman-remote cp remote:/home/qiwan/Documents/f.txt adc8:/ctrfile ``` ``` // source file: from remote machine // destination: remote container $ bin/podman-remote cp local:/home/qiwang/Documents/f.txt adc8:/f26 ``` Varlink API ``` // Copy file ctrf from containrt de3f to /home/qiwan/Documents/ctrfile $ sudo varlink call -m unix:/run/podman/io.podman/io.podman.CopyFrom '{"dest": "local", "srcPath": "/ctrf", "srcfMode": 0600, "destPath": "/home/qiwan/Documents/ctrfile", "extract": false, "pause": true, "ctrNameorId": "de3f"}' { "path": [ "/home/qiwan/Documents/ctrfile" ] } ``` ``` // Copy and extract /home/qiwan/Documents/f1.tar to container de3f $ sudo varlink call -m unix:/run/podman/io.podman/io.podman.CopyTo '{"src": "local", "srcPath": "/home/qiwan/Documents/f1.tar", "srcfMode":0600, "destPath": "/archivef", "extract":true, "pause": true, "ctrNameorId": "de3f"}' { "path": "/var/lib/containers/storage/overlay/e451e85006f6215f805b33257b2bea8dad60ab390af758060af0587f345bdfb2/merged/archivef" } ``` Signed-off-by: Qi Wang <qiwan@redhat.com>
you mean I should refactor my PR now or the whole podman-remote code will be refactored and I need to refactor my PR after that? |
☔ The latest upstream changes (presumably #4310) made this pull request unmergeable. Please resolve the merge conflicts. |
This pull request had no activity for 30 days. In the absence of activity or the "do-not-close" label, the pull request will be automatically closed within 7 days. |
@QiWang19: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@QiWang19 Needs a rebase. |
This pull request had no activity for 30 days. In the absence of activity or the "do-not-close" label, the pull request will be automatically closed within 7 days. |
Implemented podman-remote cp adding varlink API CopyTo & CopyFrom
close #4207
Copy inside remote machine
Copy between local and remote container
Varlink API
Signed-off-by: Qi Wang qiwan@redhat.com