-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix podman container exists and diff for storage containers #7908
Conversation
@mrunalp PTAL |
run_podman container exists myctr | ||
|
||
# Create a container that podman does not know about | ||
run buildah from $IMAGE |
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.
We cannot guarantee having buildah in the test environment. I have a test for this (storage containers) in the works, but (sigh) it's in a side branch and I forgot to submit it last week. Basically it runs 'podman build', with a RUN sleep 15
but with PODMAN_TIMEOUT=5
so the build is likely to leave behind a buildah container. Unfortunately it also requires other changes to helpers.bash
. May I submit that next week?
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.
What do we need to do to make sure buildah is installed? It would seem a better solution especially as I add more container/storage features into podman,
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.
in CI: go through the build-new-VMs dance. In Fedora/RHEL: add Requires: buildah
to the -tests
subpackage.
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.
@edsantiago is this OK now?
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.
Tests would not pass if it was not.
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.
It's OK in CI, but gating tests are failing because of missing buildah. On my list for today.
I do not agree with 'exists'. Openstack requested that command to make sure
containers were present and *ready to use* so they did not need to recreate
them. We are breaking the intent of the command if it reports that a
container is present but said container is Buildah or CRI-O.
…On Sat, Oct 3, 2020, 08:34 Ed Santiago ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/system/030-run.bats
<#7908 (comment)>:
> @@ -432,4 +432,19 @@ json-file | f
is "$output" "$expect" "podman run with --tz=local, matches host"
}
***@***.*** "podman container exists" {
+ rand=$(random_string 30)
+ run_podman 1 container exists myctr
+
+ run_podman create --name myctr $IMAGE /bin/true
+ run_podman container exists myctr
+
+ # Create a container that podman does not know about
+ run buildah from $IMAGE
in CI: go through the build-new-VMs dance. In Fedora/RHEL: add Requires:
buildah to the -tests subpackage.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#7908 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3AOCC34VW3VOUA2DKW54LSI4K5HANCNFSM4SCTFPVQ>
.
|
Again, these will not happen by accident, you have to check by name if a container exists. I would be willing to add a flag to say we want a specific type, (But I would guess no one would ever use it, but by default we should do what human beings would expect). |
da923e5
to
8509107
Compare
It looks like Github managed to lose my response email, so pasting here: My concern is that the exists command will answer true after a partially failed deletion, where we remove the container in the database but fail to remove it in c/storage. This has come up on a regular basis in Openstack. They use scripts to check that containers exist and work with them, recreating if necessary. I think what you are doing has real potential to break this workflow. |
43c892e
to
c396443
Compare
@edsantiago this tests just hit the timeout also "8 seconds" |
@containers/podman-maintainers PTAL |
@mheon PTAL, this now does not do exists by default, you have to specify --external. |
LGTM |
@@ -12,10 +12,10 @@ var ( | |||
containerExistsDescription = `If the named container exists in local storage, podman container exists exits with 0, otherwise the exit code will be 1.` | |||
|
|||
existsCommand = &cobra.Command{ | |||
Use: "exists CONTAINER", | |||
Use: "exists [flags] CONTAINER", |
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.
You've 'flags' here and 'options' in the man page, I think it should be options everywhere.
Use: "exists [flags] CONTAINER", | |
Use: "exists [options] CONTAINER", |
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.
Let's do this in a different PR. We exchange flags and options all over the place, and one of the tests is looking for flags.
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.
grep -r Use.*'[flags' cmd | wc -l
82
completions/bash/podman
Outdated
@@ -2696,7 +2695,7 @@ _podman_ps() { | |||
--pod -p | |||
--quiet -q | |||
--size -s | |||
--storage | |||
--external |
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.
since you've another nit to fix, can you alphabetize this please? Also namespace on the line below.
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 would prefer to do this in a separate PR. Lets go through the entire contrib and alphabetize it all.
|
||
**--pod**, **-p** | ||
|
||
Display the pods the containers are associated with | ||
|
||
**--storage** | ||
**--external** |
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.
alphabetize this option please
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.
Done
@@ -17,22 +17,30 @@ was an issue accessing the local storage. | |||
**-h**, **--help** | |||
Print usage statement | |||
|
|||
**--external**=*true|false* |
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.
move above help please
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.
Done
I'm fine with picking the man page nits in another PR. If @edsantiago thinks the testing end is gtg, then LGTM. |
Current these commands only check if a container exists in libpod. With this fix, the commands will also check if they are in containers/storage. This allows users to look at differences within a buildah or CRI-O container. Currently buildah diff does not exists, so this helps out in that situation as well as in CRI-O since the cri does not implement a diff command. Signed-off-by: Daniel J Walsh <[email protected]>
External containers are containers created outside of Podman. For example Buildah and CRI-O Containers. $ buildah from alpine alpine-working-container $ buildah run alpine-working-container touch /test $ podman container exists --external alpine-working-container $ podman container diff alpine-working-container C /etc A /test Added --external flag to refer to external containers, rather then --storage. Added --external for podman container exists and modified podman ps to use --external rather then --storage. It was felt that --storage would confuse the user into thinking about changing the storage driver or options. --storage is still supported through the use of aliases. Finally podman contianer diff, does not require the --external flag, since it there is little change of users making the mistake, and would just be a pain for the user to remember the flag. podman container exists --external is required because it could fool scripts that rely on the existance of a Podman container, and there is a potential for a partial deletion of a container, which could mess up existing users. Signed-off-by: Daniel J Walsh <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
@containers/podman-maintainers @saschagrunert This is ready to merge. |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, saschagrunert 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 |
Current these commands only check if a container exists in libpod. With
this fix, the commands will also check if they are in containers/storage.
This allows users to look at differences within a buildah or CRI-O container.
Currently buildah diff does not exists, so this helps out in that situation
as well as in CRI-O since the cri does not implement a diff command.
Signed-off-by: Daniel J Walsh [email protected]