Skip to content

Conversation

@weiyuhang2011
Copy link
Contributor

Currently, the IPC namespace is not actually shared when using the --ipc=shareable and --ipc=container:.

Steps to reproduce

nerdctl run -d --name ipc_master --ipc=shareable alpine:latest sleep 3600
nerdctl run -d --name ipc_slave --ipc=container:ipc_master alpine:latest sleep 3600
pid_master=$(nerdctl inspect ipc_master --format '{{.State.Pid}}')
pid_slave=$(nerdctl inspect ipc_slave --format '{{.State.Pid}}')
readlink /proc/$pid_master/ns/ipc
readlink /proc/$pid_slave/ns/ipc

This commit explicitly set the IPC namespace path to the target container’s namespace in container IPC mode.
Add assertions in the shared IPC tests to compare ipc between container1 and container2, including after restart.

Ref: #4702

Signed-off-by: Yuhang Wei <weiyuhang2011@gmail.com>
testFilePath := filepath.Join("/dev/shm",
fmt.Sprintf("%s-%d-%s", testutil.Identifier(t), os.Geteuid(), base.Target))
err := os.WriteFile(testFilePath, []byte(""), 0644)
err := os.WriteFile(testFilePath, []byte(""), 0o644)
Copy link
Member

Choose a reason for hiding this comment

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

this change is irrelevant and should be a separate commit

sc := bufio.NewScanner(bytes.NewBufferString(stdout))
for sc.Scan() {
//removing spaces and tabs separating items
// removing spaces and tabs separating items
Copy link
Member

Choose a reason for hiding this comment

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

this change is irrelevant and should be a separate commit

t.Parallel()
base := testutil.NewBase(t)
var score = "-42"
score := "-42"
Copy link
Member

Choose a reason for hiding this comment

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

this change is irrelevant and should be a separate commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants