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

Fix missing OCI Runtime #7126

Merged
merged 4 commits into from
Oct 20, 2020

Conversation

mheon
Copy link
Member

@mheon mheon commented Jul 28, 2020

Problem: when we create a container with --runtime=/PATH/TO/RUNTIME and then call other Podman commands without that flag, Podman may fail because it can't find the OCI runtime.

Solution: make containers remember the full path of the OCI runtime they were created with (if and only if they were made with an OCI runtime specified by full path) and re-initialize the OCI runtime on subsequently retrieving the container from the database (if and only if the runtime does not already exist).

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 28, 2020
@mheon
Copy link
Member Author

mheon commented Jul 28, 2020

This needs tests, but they can't be E2E tests (all of those specify a full --runtime with every invocation of Podman). I'll look into adding a system test.

// If the path starts with a / and exists, make a new
// OCI runtime for it using the full path.
if strings.HasPrefix(runtimeName, "/") {
if stat, err := os.Stat(runtimeName); err == nil && !stat.IsDir() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to worry about a symlink here?

@TomSweeneyRedHat
Copy link
Member

@mheon all kinds of test unhappiness

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2020
@mheon mheon force-pushed the fix_missing_ociruntime branch 2 times, most recently from b1465a5 to fe9461d Compare July 30, 2020 14:52
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2020
@rhatdan
Copy link
Member

rhatdan commented Aug 1, 2020

LGTM

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2020
@mheon mheon force-pushed the fix_missing_ociruntime branch from fe9461d to 5e5e6f5 Compare August 7, 2020 13:21
@mheon
Copy link
Member Author

mheon commented Aug 7, 2020

Rebased

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon

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

@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2020
@mheon mheon force-pushed the fix_missing_ociruntime branch 2 times, most recently from adf2e7d to a615b88 Compare August 10, 2020 14:18
@mheon
Copy link
Member Author

mheon commented Aug 10, 2020

Rebased, should go green

@mheon mheon force-pushed the fix_missing_ociruntime branch from a615b88 to e565396 Compare August 10, 2020 15:30
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm hold

@vrothberg
Copy link
Member

Restarted what looked like flakes

@vrothberg
Copy link
Member

/lgtm hold

@rhatdan
Copy link
Member

rhatdan commented Aug 11, 2020

Looks like your tests are failing?

@edsantiago
Copy link
Member

Failures are in podman-remote only, f31 and f32, both:

[+0097s] not ok 27 podman run : full path to --runtime is preserved
         ...
         # # podman-remote --url unix:/tmp/podman.G3zrQE inspect --format {{.OCIRuntime}} f0386ab7ed5f1aa0e68dfee9b56744d75d200c7bc6bdfa9fc04ad8c8a68fcc48
         # crun
         # #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
         # #|     FAIL: FIXME
         # #| expected: '/usr/bin/crun'
         # #|   actual: 'crun'
         # #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@mheon
Copy link
Member Author

mheon commented Aug 12, 2020

Remote seems to completely ignore the --runtime option... I'm going to disable the test as remote.

@mheon mheon force-pushed the fix_missing_ociruntime branch from e565396 to e30f9e1 Compare August 12, 2020 18:03
@vrothberg
Copy link
Member

@mheon can you rebase?

@mheon mheon force-pushed the fix_missing_ociruntime branch from e30f9e1 to 1f98838 Compare September 7, 2020 14:54
@mheon
Copy link
Member Author

mheon commented Sep 9, 2020

Added another commit that should (theoretically) properly handle --runtime for the podman-remote case.

@mheon mheon force-pushed the fix_missing_ociruntime branch from c65d45b to c90ab7f Compare September 9, 2020 20:59
@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2020

@mheon need a rebase. Would like to get this in, to fix https://bugzilla.redhat.com/show_bug.cgi?id=1860176

@mheon
Copy link
Member Author

mheon commented Sep 11, 2020

Test failures are legitimate. I know what has to be done, but it'll have to wait until Monday, too busy trying to get 2.1.0-RC1 out the door today.

@mheon mheon force-pushed the fix_missing_ociruntime branch from c90ab7f to c8e13d8 Compare September 14, 2020 17:28
@rhatdan
Copy link
Member

rhatdan commented Sep 15, 2020

LGTM

@github-actions
Copy link

A friendly reminder that this PR had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Oct 16, 2020

@mheon Can we get this Rebased and moved forward?

@mheon mheon force-pushed the fix_missing_ociruntime branch from c8e13d8 to a3373e5 Compare October 19, 2020 15:14
@mheon
Copy link
Member Author

mheon commented Oct 19, 2020

Rebased, let's see what broke

@mheon mheon force-pushed the fix_missing_ociruntime branch 3 times, most recently from 72af2f9 to eaea608 Compare October 19, 2020 17:16
@rhatdan
Copy link
Member

rhatdan commented Oct 20, 2020

@mheon needs another rebase.

mheon added 3 commits October 20, 2020 09:20
Say I start a container with the flag
`--runtime /usr/local/sbin/crun`. I then stop the container, and
restart it without the flag. We previously stored the runtime in
use by a container only by basename when given a path, so the
container only knows that it's using the `crun` OCI runtime - and
on being restarted without the flag, it will use the system crun,
not my special crun build.

Using the full path as the name in these cases ensures we will
still use the correct runtime, even on subsequent runs of Podman.

Signed-off-by: Matthew Heon <[email protected]>
When an OCI runtime is given by full path, we need to ensure we
use the same runtime on subsequent use. Unfortunately, users are
often not considerate enough to use the same `--runtime` flag
every time they invoke runtime - and if the runtime was not in
containers.conf, that means we don't have it stored inn the
libpod Runtime.

Fortunately, since we have the full path, we can initialize the
OCI runtime for use at the point where we pull the container from
the database.

Signed-off-by: Matthew Heon <[email protected]>
My patches to fix `--runtime /usr/bin/crun` being allowed to use
a different version of the crun runtime revealed a problem: we
were actually relying on that exact behavior in our E2E tests. We
specified the runtime path as `/usr/bin/runc` for the Ubuntu
tests, but that didn't exist, so Podman was actively looking for
a different, usable runc binary and using that, instead of the
path we explicitly hardcoded. Fixing the bug broke this, and thus
broke the tests.

Instead of hard-coding OCI runtime paths, swap to just using the
runtime name, `runc` or `crun`, and letting Podman figure out
where the runtime lives - it's quite good at that. This should
un-break the tests and make them more durable.

Signed-off-by: Matthew Heon <[email protected]>
@mheon mheon force-pushed the fix_missing_ociruntime branch from 97305e6 to 07221d9 Compare October 20, 2020 13:21
@mheon mheon force-pushed the fix_missing_ociruntime branch from 07221d9 to 1b49333 Compare October 20, 2020 13:24
@mheon
Copy link
Member Author

mheon commented Oct 20, 2020

@containers/podman-maintainers This should be ready to merge.

@jwhonce
Copy link
Member

jwhonce commented Oct 20, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2020
@openshift-merge-robot openshift-merge-robot merged commit 3668211 into containers:master Oct 20, 2020
@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 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. stale-pr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants