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

config: Clarify mounts[].source relative path anchor #735

Merged
merged 1 commit into from
Jun 1, 2017

Conversation

wking
Copy link
Contributor

@wking wking commented Mar 16, 2017

Borrowing language from root.path for absolute/relative and from linux.namespaces[].path for the runtime mount namespace.

In #509 I'd floated a generic rule for anchoring relative runtime-namespace paths, but there aren't all that many relative runtime-namespace paths, so this PR takes a narrower approach.

@tianon
Copy link
Member

tianon commented May 11, 2017

The code implementing this behavior in runc is at: https://github.com/opencontainers/runc/blob/653207bc29a6d2d62b5d4f55b596467cb715a128/libcontainer/specconv/spec_linux.go#L253-L257

	if m.Type == "bind" {
		if !filepath.IsAbs(source) {
			source = filepath.Join(cwd, m.Source)
		}
	}

According to @crosbymichael, that cwd will sometimes be the bundle path, but not always.

It's also often the case where source is a dummy value, not a path at all (such as tmpfs, proc, devpts, or none), in which case the value ought to be passed to the kernel as-is (since making them "absolute" doesn't make any sense).

IMO, runc's behavior here is fine behavior, but I'm not sure it's worth codifying in the specification, especially since it matches mount(1)'s behavior -- perhaps something to discuss clarifying for 1.1.0 (doesn't seem like much of a 1.0 blocker to me)? I don't mind leaving relative paths as entirely implementation-dependent.

@wking
Copy link
Contributor Author

wking commented May 11, 2017 via email

@wking wking changed the title config: Clarify mounts[].source relative path anchor WIP: config: Clarify mounts[].source relative path anchor May 11, 2017
config.md Outdated
@@ -62,6 +62,7 @@ For Windows, see [mountvol][mountvol] and [SetVolumeMountPoint][set-volume-mount
* Windows: the type of file system on the volume, e.g. "ntfs".
* Solaris: corresponds to "type" of the fs resource in [zonecfg(1M)][zonecfg.1m].
* **`source`** (string, OPTIONAL) A device name, but can also be a directory name or a dummy.
Path values are in the [runtime mount namespace](glossary.md#runtime-namespace) and are either absolute or relative to the bundle.
Copy link
Contributor

Choose a reason for hiding this comment

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

Take out language around runtime mount namespace. Rest is fine.

@wking wking force-pushed the relative-mount-source branch from 604205e to 8353080 Compare May 12, 2017 22:18
@wking wking changed the title WIP: config: Clarify mounts[].source relative path anchor config: Clarify mounts[].source relative path anchor May 12, 2017
@wking
Copy link
Contributor Author

wking commented May 12, 2017

I've punted on the mount namespace issues with 604205e8353080. Per the call, either @crosbymichael or @mrunalp will file follow-up work clarifying that issue.

@mrunalp
Copy link
Contributor

mrunalp commented May 12, 2017

LGTM

Approved with PullApprove

@vbatts
Copy link
Member

vbatts commented May 24, 2017

rebase pls

@vbatts vbatts added this to the 1.0 freeze milestone May 24, 2017
@mrunalp
Copy link
Contributor

mrunalp commented May 24, 2017

Needs rebase.

@wking wking force-pushed the relative-mount-source branch from 8353080 to 67aca31 Compare May 24, 2017 16:20
@wking
Copy link
Contributor Author

wking commented May 24, 2017 via email

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 24, 2017
…tion

Namespaces are not all hierarchical and processes aren't always in
leaves.  Also punt to config-linux.md for details about namespace
creation, although currently that section doesn't talk much about how
the runtime namespaces relate to new container namespaces [1].

Also mention resource access, because runtime namespaces play a role
even if no new container namespaces are created.  I've used resources
that currently explicitly mention runtime namespaces as examples,
although I think more resources (e.g. root.path and mounts[].source
[2,3]) deserve wording about that as well and would be better examples
if they'd already landed such wording.

[1]: opencontainers#795 (comment)
[2]: opencontainers#735 (comment)
[3]: opencontainers@604205e#diff-c9c91c29b41257aea3a3403cc606ad99R65

Signed-off-by: W. Trevor King <wking@tremily.us>
@vbatts vbatts modified the milestones: 1.0 freeze, 1.0.0 May 31, 2017
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 31, 2017
…tion

Namespaces are not all hierarchical and processes aren't always in
leaves.  Also punt to config-linux.md for details about namespace
creation, although currently that section doesn't talk much about how
the runtime namespaces relate to new container namespaces [1].

Also mention resource access, because runtime namespaces play a role
even if no new container namespaces are created.  I've used resources
that currently explicitly mention runtime namespaces as examples,
although I think more resources (e.g. root.path and mounts[].source
[2,3]) deserve wording about that as well and would be better examples
if they'd already landed such wording.

[1]: opencontainers#795 (comment)
[2]: opencontainers#735 (comment)
[3]: opencontainers@604205e#diff-c9c91c29b41257aea3a3403cc606ad99R65

Signed-off-by: W. Trevor King <wking@tremily.us>
Borrowing language from root.path for absolute/relative.

I think we also need to talk about 'mounts' being in the container
mount namespace (after creating it with the runtime mount namespace as
a seed) and before the pivot into root.path.  But Michael and/or
Mrunal are going to file follow-up work to address that.

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking wking force-pushed the relative-mount-source branch from 67aca31 to 50e13d9 Compare June 1, 2017 15:01
@wking
Copy link
Contributor Author

wking commented Jun 1, 2017

Rebased around #846 with 67aca3150e13d9.

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 1, 2017
…tion

Namespaces are not all hierarchical and processes aren't always in
leaves.  Also punt to config-linux.md for details about namespace
creation, although currently that section doesn't talk much about how
the runtime namespaces relate to new container namespaces [1].

Also mention resource access, because runtime namespaces play a role
even if no new container namespaces are created.  I've used resources
that currently explicitly mention runtime namespaces as examples,
although I think more resources (e.g. root.path and mounts[].source
[2,3]) deserve wording about that as well and would be better examples
if they'd already landed such wording.

Examples of resources retrieved from this namespace include
linux.namespaces[].path and the resctrl psuedo-filesystem used for
`linux.intelRdt`, but Mrunal and Michael didn't want me to include the
examples in the glossary entry (probably because they could go stale).

[1]: opencontainers#795 (comment)
[2]: opencontainers#735 (comment)
[3]: opencontainers@604205e#diff-c9c91c29b41257aea3a3403cc606ad99R65

Signed-off-by: W. Trevor King <wking@tremily.us>
@crosbymichael
Copy link
Member

crosbymichael commented Jun 1, 2017

LGTM

Approved with PullApprove

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Jun 1, 2017

LGTM

Approved with PullApprove

@mrunalp mrunalp merged commit 2719e66 into opencontainers:master Jun 1, 2017
@wking wking deleted the relative-mount-source branch June 2, 2017 04:18
@vbatts vbatts mentioned this pull request Jul 5, 2017
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.

5 participants