-
Notifications
You must be signed in to change notification settings - Fork 554
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
Change layout of mountpoints and mounts #136
Conversation
@@ -1,6 +1,12 @@ | |||
## Mount Configuration | |||
|
|||
Additional filesystems can be declared as "mounts", specified in the *mounts* array. The parameters are similar to the ones in Linux mount system call. [http://linux.die.net/man/2/mount](http://linux.die.net/man/2/mount) | |||
Additional filesystems can be declared as "mounts", specified in the *mounts* object. | |||
Keys in this object are names of mount points from portable config. |
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.
Link with “… of [mount points from the portable config](config.md#mount-points)
”?
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.
The link is now on line 7 (“Only [mounts from …]”), so I'm fine leaving this line as it stands.
On Wed, Sep 02, 2015 at 08:47:03AM -0700, Alexander Morozov wrote:
I don't think so. We need different Go names because we're putting |
Actually we don't need different go name too. |
On Wed, Sep 02, 2015 at 09:45:00AM -0700, Alexander Morozov wrote:
We don't? They're both in the specs package in the same directory. |
@wking It's type name, have nothing in common with field name. |
On Wed, Sep 02, 2015 at 09:51:08AM -0700, Alexander Morozov wrote:
Ah, right. +1 to making both field names Mounts to match the JSON |
@@ -1,8 +1,10 @@ | |||
package specs | |||
|
|||
type RuntimeSpec struct { | |||
// Mounts profile configuration for adding mounts to the container's filesystem. | |||
Mounts []Mount `json:"mounts"` | |||
// Mounts is a mapping of names to mount configuration. |
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.
s/configuration/configurations/
@wking I actually added example of |
On Wed, Sep 02, 2015 at 11:43:07AM -0700, Alexander Morozov wrote:
But it only lists ‘proc’, while the runtime.json example in the runtime docs lists proc, |
"path": "/proc", | ||
} | ||
``` | ||
In `runtime.json`: |
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.
Ah, I wasn't suggesting we copy the runtime.json
side over here. I want to link to it. But I think the config.json
example here should be compatible with the runtime.json
example we link to. I'm happy to PR a fixup against your branch if that's easier ;).
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.
okay
On Wed, Sep 02, 2015 at 11:50:11AM -0700, W. Trevor King wrote:
I've been explaining this poorly, so here's a PR with my suggested |
67313c6
to
497b51f
Compare
// Which mounts will be mounted and where should be chosen with MountPoints | ||
// in Spec. | ||
Mounts map[string]Mount `json:"mounts"` | ||
// Hooks are the commands run at various lifecycle events of the containers. |
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 don't want to touch this comment.
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 don't see what changed in this comment.
Oh, I see 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.
On Wed, Sep 02, 2015 at 01:12:41PM -0700, Alexander Morozov wrote:
- Mounts []Mount
json:"mounts"
- // Hooks are the commands run at various lifecycle events of the container.
…- Mounts map[string]Mount
json:"mounts"
- // Hooks are the commands run at various lifecycle events of the containers.
I don't see what changed in this comment.
The post-Mounts comment should be about hooks, and there's only one
container for lifecycle events.
- // Mounts is a mapping of names to mount configuration.
- // Which mounts will be mounted and where should be chosen with MountPoints
- // in Spec.
The pre-Mounts comment^, on the other hand should be talking about
“mount configurations”, not “mount configuration”.
Each record in this array must have configuration in [runtime config](runtime-config.md#mount-configuration). | ||
|
||
* **name** (string, required) Name of mount point. Used for config lookup. | ||
* **path** (string, required) Destination of mount point: path inside 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.
<nit>
Maybe “Mount destination in the container filesystem”? The colon-separated form works, but it took me a reread to understand what it meant.</nit>
.
LGTM |
LGTM |
"mounts": [ | ||
{ | ||
"mounts": { | ||
"myfancymountpoint": { | ||
"type": "ntfs", | ||
"source": "\\\\?\\Volume\\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\\", | ||
"destination": "C:\\Users\\crosbymichael\\My Fancy Mount Point\\", |
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.
Here is a leftover "destination"
I think the mount order should be clearly defined in the spec. Alternative definitions in my mind:
Any thoughts? |
On Wed, Sep 02, 2015 at 04:53:54PM -0700, Lai Jiangshan wrote:
This is how I'd do it. |
Wait until full discussion? |
On Wed, Sep 02, 2015 at 05:30:18PM -0700, Lai Jiangshan wrote:
Probably wise ;). One thing to consider for auto-ordering, is what
I'm not actually sure ;), but it's possible that /d still looks into |
Added info about MountPoints to config.md. Signed-off-by: Alexander Morozov <lk4d4@docker.com> Signed-off-by: W. Trevor King <wking@tremily.us>
I prefer the strict/exact order. But it needs to be documented in the Spec. |
LGTM (c18c283) |
On Wed, Sep 02, 2015 at 09:25:54PM -0700, Lai Jiangshan wrote:
Looks good to me too. I'm fine punting explicit ordering statements |
I think we have enough LGTMs here and I want to fix spec for now. Feel free to post your suggestions as another PR. |
Change layout of mountpoints and mounts
I think Go's attribute syntax reads more clearly here, especially since there is no 'Spec.MountPoints' after c18c283 (Change layout of mountpoints and mounts, 2015-09-02, opencontainers#136). Signed-off-by: W. Trevor King <wking@tremily.us>
c18c283 (Change layout of mountpoints and mounts, 2015-09-02, opencontainers#136) removed the destination field from the Go type and examples, but forgot to remove it from the documentation [1]. Fix that with this commit. [1]: opencontainers#109 (comment) Reported-by: 梁辰晔 (Liang Chenye) <liangchenye@huawei.com> Signed-off-by: W. Trevor King <wking@tremily.us>
If we don't specify this, some bundle-authors or runtime-implementers might expect the runtime to intelligently order mounts to get the "right" order [1]. But that's not possible because: $ mkdir -p a/b/c d/e/f h # mount --bind a/b h # mount --bind d a/b $ tree --charset=ascii h h `-- c But in the other order: # umount a/b # umount h # mount --bind d a/b # mount --bind a/b h $ tree --charset=ascii h h `-- e `-- f So there's no "right" order. Allowing the bundle-author to specify their intended order is both easy to implement and unambiguous. [1]: opencontainers#136 (comment) Suggested-by: Lai Jiangshan <jiangshanlai@gmail.com> Signed-off-by: W. Trevor King <wking@tremily.us>
'destination' has been the path inside the container since c18c283 (Change layout of mountpoints and mounts, 2015-09-02, opencontainers#136). My personal preference is to have an explicit pivot root and allow paths relative to the current working directory [1], but that would be a big shift from the current OCI spec. The only way the current spec lets you turn off the root pivot is by not setting a mount namespace at all (and even then, it's not clear if that turns off the pivot). And the config's root entry is required (despite my attempts to have it made optional [2]), it's not really clear how containers that don't set a mount namespace are supposed to work if they're supported at all. You might be able to get away with something like: When a mount namespace is not set, destination paths are relative to the runtime's initial working directory (or relative to the config.json, or whatever). When a mount namespace is set, destination paths are relative to the mount namespace's root. but with mount-namespace-less containers already so unclear, it seems better to just require absolute destinations. If/when we get clearer support for explicit pivot-root calls or containers that inherit the host mount namespace (without re-joining it and losing their old working directory), we can consider lifting the absolute-path restriction. [1]: https://github.com/wking/ccon/tree/v0.4.0#mount-namespace [2]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/6ZKMNWujDhU Date: Wed, 26 Aug 2015 12:54:47 -0700 Subject: Dropping the rootfs requirement and restoring arbitrary bundle content Message-ID: <20150826195447.GX21585@odin.tremily.us> Signed-off-by: W. Trevor King <wking@tremily.us>
'destination' has been the path inside the container since c18c283 (Change layout of mountpoints and mounts, 2015-09-02, opencontainers#136). My personal preference is to have an explicit pivot root and allow paths relative to the current working directory [1], but that would be a big shift from the current OCI spec. The only way the current spec lets you turn off the root pivot is by not setting a mount namespace at all (and even then, it's not clear if that turns off the pivot). And the config's root entry is required (despite my attempts to have it made optional [2]), so it's not really clear how containers that don't set a mount namespace are supposed to work (if they're supported at all). You might be able to get away with something like: When a mount namespace is not set, destination paths are relative to the runtime's initial working directory (or relative to the config.json, or whatever). When a mount namespace is set, destination paths are relative to the mount namespace's root. but with mount-namespace-less containers already so unclear, it seems better to just require absolute destinations. If/when we get clearer support for explicit pivot-root calls or containers that inherit the host mount namespace (without re-joining it and losing their old working directory), we can consider lifting the absolute-path restriction. [1]: https://github.com/wking/ccon/tree/v0.4.0#mount-namespace [2]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/6ZKMNWujDhU Date: Wed, 26 Aug 2015 12:54:47 -0700 Subject: Dropping the rootfs requirement and restoring arbitrary bundle content Message-ID: <20150826195447.GX21585@odin.tremily.us> Signed-off-by: W. Trevor King <wking@tremily.us>
Added info about MountPoints to config.md.
Filled after discuss in opencontainers/runc#242
I noticed that
MountPoints
still has json tagmounts
, should I rename it tomountPoints
?