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 ipc namespace inspect logic #17200

Closed
wants to merge 1 commit into from
Closed

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Jan 24, 2023

The ipc ns inspect logic did not work, the switch case was just broken because it will only execute the first branch. Therefore it always showed shareable or container:... as mode.

This fixes the logic and adds tests for all modes.

Fixes #17189

Does this PR introduce a user-facing change?

Fixed a bug in the the container inspect output where it showed the incorrect ipc namespace mode.

The ipc ns inspect logic did not work, the switch case was just broken
because it will only execute the first branch. Therefore it always
showed `shareable` or `container:...` as mode.

This fixes the logic and adds tests for all modes.

Fixes containers#17189

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 24, 2023
@mheon
Copy link
Member

mheon commented Jan 24, 2023

We also have #17201 - solutions basically identical. Maybe combine the tests though?

Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

Sorry y'all, this is not a decision I can make. Tests look great to me (side note: I am really, really, really appreciative of all the thought everyone is giving to tests). But the changes in setting IpcMode are beyond my ability to understand.

case c.config.NoShm:
hostConfig.IpcMode = "none"
case c.config.NoShmShare:
hostConfig.IpcMode = "private"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not qualified to judge if this excision is OK.

assert "$output" != "$hostipc" "containeripc should != hostipc"

run_podman container inspect --format "{{.HostConfig.IpcMode}}" $cname
assert "none" "inspect should show none ipc"
Copy link
Member

Choose a reason for hiding this comment

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

Same feedback (nonblocking, just for future reference) as in #17201 :

Just as a suggestion for future, not a blocker: I like my failure messages to make it clear why something is expected, not what is expected. (The "what" will be shown as part of the error message). Something like

is "$output" "host" ".HostConfig.IpcMode when --ipc=host"

That makes the error message something like:

FAIL: .HostConfig.IpcMode when --ipc=host
expected: host
got: slaartibartfast

@Luap99 Luap99 closed this Jan 25, 2023
@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 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 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. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: podman run --ipc=host not work as expected
3 participants