Skip to content

Conversation

@Mashimiao
Copy link

I think runtime should generate an error, if devices has duplicated device path.
Because we don't know which one is really needed.

Signed-off-by: Ma Shimiao [email protected]

config-linux.md Outdated
* **`uid`** *(uint32, OPTIONAL)* - id of device owner.
* **`gid`** *(uint32, OPTIONAL)* - id of device group.

If a `devices` contains duplicated devices with same `path`, the runtime MUST generate an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplication in the devices array is a subset of this issue, which is that a path in devices already exists in the container filesystem being constructed. Besides an earlier devices entry, this could also happen if a file (in the "everything is a file" sense) exists in the root.path directory at the target location, although you could also have conflicts sure to mounts entries. I think this line should be under the path entry above with text like:

If a file already exists at path that does not match the requested file, the runtime MUST generate an error instead of creating the requested file.

Copy link
Author

Choose a reason for hiding this comment

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

How about this?
If a file already exists at path that does not match the requested device, the runtime MUST generate an error.
We don't care what runtime already did now, we need it to generate an error and return.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we link to POSIX to define file (like I did in my earlier comment)? I think that helps clarify the intended "everything is a file" semantics so readers don't wonder "but what happens if a directory exists at path?" and similar.

@Mashimiao Mashimiao force-pushed the config-linux-fix-device-path branch from 0a2a941 to dc16388 Compare January 5, 2017 07:01
config-linux.md Outdated
* **`path`** *(string, REQUIRED)* - full path to device inside container.
If a file already exists at `path` that does not match the requested device, the runtime MUST generate an error.
* **`major, minor`** *(int64, REQUIRED unless **`type`** is `p`)* - [major, minor numbers][devices] for the device.
Same `major, minor` for different devices is acceptable, but it is not recommended.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move this back outside the properties list and say something like:

Using the same type, major, and minor for multiple devices entries is allowed but not recommend.

@Mashimiao
Copy link
Author

Mashimiao commented Jan 6, 2017 via email

@Mashimiao Mashimiao force-pushed the config-linux-fix-device-path branch from dc16388 to 8850b45 Compare January 6, 2017 01:30
@wking
Copy link
Contributor

wking commented Jan 6, 2017

It doesn't matter about duplicated type, we can add same type devices.

You can use the same major on multiple devices too. What we're recommending is that you don't use the same (type, major, minor) tuple.

@Mashimiao
Copy link
Author

Mashimiao commented Jan 6, 2017 via email

@wking
Copy link
Contributor

wking commented Jan 6, 2017 via email

@Mashimiao
Copy link
Author

Mashimiao commented Jan 6, 2017 via email

@wking
Copy link
Contributor

wking commented Jan 6, 2017 via email

@Mashimiao
Copy link
Author

In major.3, the description says a device ID consist of two parts: major, minor.
In my opinion, As ID, it should be unique. I'm not sure why it is not in Kernel.
I still think let major,minor to be unique is better for devices.
But if @opencontainers/runtime-spec-maintainers object, I can remove it in this PR.

@wking
Copy link
Contributor

wking commented Jan 6, 2017 via email

@Mashimiao
Copy link
Author

Mashimiao commented Jan 6, 2017 via email

@wking
Copy link
Contributor

wking commented Jan 6, 2017 via email

config-linux.md Outdated
[cgroup-v2]: https://www.kernel.org/doc/Documentation/cgroup-v2.txt
[devices]: https://www.kernel.org/doc/Documentation/devices.txt
[devpts]: https://www.kernel.org/doc/Documentation/filesystems/devpts.txt
[file.1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_164
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

fixed, thanks

@Mashimiao Mashimiao force-pushed the config-linux-fix-device-path branch from 8850b45 to 77d8512 Compare January 6, 2017 06:51
@hqhq
Copy link
Contributor

hqhq commented Jan 6, 2017

I agree the recommend against should to the whole (type, major, minor) tuple.

@Mashimiao
Copy link
Author

Mashimiao commented Jan 6, 2017

I'm not sure how Kernel manage devices currently.
From here it seems identify by type and major,minor is reasonable. But Kernel seems does not work like that.

@wking
Copy link
Contributor

wking commented Jan 6, 2017 via email

@Mashimiao
Copy link
Author

@opencontainers/runtime-spec-maintainers PTAL

@hqhq
Copy link
Contributor

hqhq commented Jan 10, 2017

LGTM

Approved with PullApprove

@Mashimiao
Copy link
Author

@mrunalp @vbatts @dqminh PTAL

config-linux.md Outdated
* **`uid`** *(uint32, OPTIONAL)* - id of device owner.
* **`gid`** *(uint32, OPTIONAL)* - id of device group.

Using same `type` and `major, minor` for mulitple devices is allowed, but not recommended.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe replace:

`type` and `major, minor`

with:

`type`, `major`, and `minor`

major and minor are separate properties, so I don't think we want them in the same monospace span.

Copy link
Contributor

Choose a reason for hiding this comment

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

And "allowed but not recommended" sound like "SHOULD NOT".

Copy link
Contributor

Choose a reason for hiding this comment

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

also typo at mulitple

@RobDolinMS RobDolinMS added this to the 1.0.0 milestone Jan 11, 2017
@Mashimiao Mashimiao force-pushed the config-linux-fix-device-path branch from 77d8512 to a78a4c1 Compare January 12, 2017 01:08
@Mashimiao
Copy link
Author

@wking @RobDolinMS @mrunalp @hqhq PTAL

config-linux.md Outdated
* **`uid`** *(uint32, OPTIONAL)* - id of device owner.
* **`gid`** *(uint32, OPTIONAL)* - id of device group.

Same `type`, `major` and `minor` SHOULD NOT be used for multiple devices.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: “Same” → “The same”. Otherwise a78a4c1 looks good to me.

Copy link
Author

Choose a reason for hiding this comment

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

fixed, thanks

@Mashimiao Mashimiao force-pushed the config-linux-fix-device-path branch from a78a4c1 to 1fc1464 Compare January 12, 2017 06:24
I think runtime should generate an error, if devices has
duplicated device path.
Because we don't know which one is really needed.

Signed-off-by: Ma Shimiao <[email protected]>
@hqhq
Copy link
Contributor

hqhq commented Jan 12, 2017

LGTM

Approved with PullApprove

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Jan 12, 2017

LGTM

Approved with PullApprove

@mrunalp mrunalp merged commit c0206be into opencontainers:master Jan 12, 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.

6 participants