Skip to content
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

Copy the content from the underlying image into the newly created volume #10970

Merged
merged 1 commit into from
Jul 21, 2021
Merged

Copy the content from the underlying image into the newly created volume #10970

merged 1 commit into from
Jul 21, 2021

Conversation

vikas-goel
Copy link
Contributor

Fixes: #10262

Signed-off-by: Vikas Goel [email protected]

@vikas-goel
Copy link
Contributor Author

@mheon , @rhatdan , @Luap99 , @TomSweeneyRedHat ,
I am facing two issues, one related to test case and another about the code change. I am posting them separately. I will appreciate any guidance.

@vikas-goel
Copy link
Contributor Author

I am using config/containers-volume.conf in test case but the execution failing to find the file. I have tried creating the file runtime in tmp directory instead of static file, that doesn't help either.

[+0935s] Running: /var/tmp/go/src/github.com/containers/podman/bin/podman --storage-opt vfs.imagestore=/tmp/podman/imagecachedir --root /tmp/podman_test791424325/crio --runroot /tmp/podman_test791424325/crio-run --runtime crun --conmon /usr/bin/conmon --cni-config-dir /etc/cni/net.d --cgroup-manager cgroupfs --tmpdir /tmp/podman_test791424325 --events-backend file --storage-driver vfs create --name ctr-copy dataimg
[+0935s] time="2021-07-19T15:47:35Z" level=error msg="Error streaming contents of container c15a6d0d258da0180568a3a4a502dc19e9c9a8984b48bedeb52d292e1cfa3608 directory for volume copy-up: error in copier subprocess: time=\"2021-07-19T15:47:35Z\" level=error msg=\"finding config on system: CONTAINERS_CONF file: stat config/containers-volume.conf: no such file or directory\"\n"
[+0935s] Error: error copying up to volume d2e89f0d1df08c3999078ff13be71a999bf6d507468b348956ebe0ce360e9f71: error in copier subprocess: time="2021-07-19T15:47:35Z" level=error msg="finding config on system: CONTAINERS_CONF file: stat config/containers-volume.conf: no such file or directory"

@vikas-goel
Copy link
Contributor Author

vikas-goel commented Jul 19, 2021

I am facing an issue where removing the container and volume created using prepare_volume_on_create = true show the following error message. Both the container and volume get removed, though.

# ~/go/src/github.com/containers/podman/bin/podman rm -afv
Error: error removing container 58865407f8f7c1858704375a173a1cc93da4280cdb079aad44be536069540eff root filesystem: 2 errors occurred:
        * unlinkat /var/lib/containers/storage/overlay-containers/58865407f8f7c1858704375a173a1cc93da4280cdb079aad44be536069540eff/userdata/shm: device or resource busy
        * unlinkat /var/lib/containers/storage/overlay-containers/58865407f8f7c1858704375a173a1cc93da4280cdb079aad44be536069540eff/userdata/shm: device or resource busy

If I run container init and container cleanup after creating the container with prepare_volume_on_create = true option, then the error does not happen.

libpod/runtime_ctr.go Show resolved Hide resolved
libpod/runtime_ctr.go Outdated Show resolved Hide resolved
pkg/specgen/generate/container_create.go Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2021
libpod/runtime_ctr.go Outdated Show resolved Hide resolved
@mheon
Copy link
Member

mheon commented Jul 19, 2021

@vikas-goel I've identified the problem. The issue is that mountStorage() is not setting c.state.Mounted which unmountStorage() checks before doing anything. After mounting storage you need to do a c.state.Mounted = true and then a c.save().

@vikas-goel
Copy link
Contributor Author

@vikas-goel I've identified the problem. The issue is that mountStorage() is not setting c.state.Mounted which unmountStorage() checks before doing anything. After mounting storage you need to do a c.state.Mounted = true and then a c.save().

That works. The missing save() was the reason. Thank you @mheon .

@TomSweeneyRedHat
Copy link
Member

LGTM
assuming happy tests

@vikas-goel
Copy link
Contributor Author

/assign @TomSweeneyRedHat

libpod/runtime_ctr.go Outdated Show resolved Hide resolved
libpod/runtime_ctr.go Outdated Show resolved Hide resolved
libpod/runtime_ctr.go Outdated Show resolved Hide resolved
@vikas-goel
Copy link
Contributor Author

vikas-goel commented Jul 20, 2021

Hi @TomSweeneyRedHat , could you help merge the PR if no other feedback?

@rhatdan
Copy link
Member

rhatdan commented Jul 21, 2021

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, vikas-goel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Member

rhatdan commented Jul 21, 2021

Thanks @vikas-goel

@openshift-merge-robot openshift-merge-robot merged commit a7dcae5 into containers:main Jul 21, 2021
@vikas-goel
Copy link
Contributor Author

Thank you @rhatdan , @mheon , @TomSweeneyRedHat , @Luap99

@vikas-goel vikas-goel deleted the prepare-volume branch July 21, 2021 12:39
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data not copying up to volumes for containers created but not started
6 participants