Skip to content

Conversation

@hqhq
Copy link
Contributor

@hqhq hqhq commented Nov 12, 2015

It's defined in specs, add the support to runC.

Signed-off-by: Qiang Huang [email protected]

@hqhq
Copy link
Contributor Author

hqhq commented Nov 12, 2015

We might have to discuss how CgroupsPath should get alone with Parent. They are doing similar thing, can they combine or we should just remove parent and use CgroupsPath because it's in specs?

@LK4D4
Copy link
Contributor

LK4D4 commented Nov 12, 2015

@hqhq Looks like we should remove Parent if it's not in spec.

@hqhq
Copy link
Contributor Author

hqhq commented Nov 13, 2015

@LK4D4 Yes that what I had in mind, but should we do it in this PR? Since Docker is using Parent, I'm thinking about we have them both for now, after merging this to Docker, we change usage on Docker side to CgroupsPath, then remove Parent smoothly. WDYT?

@ashahab-altiscale
Copy link
Contributor

Thanks for the PR. @hqhq I had a different idea for the cgroupsPath support: #399
Sorry I did not notice your PR before(mine can be combined with yours). However, the important thing is, if cgroups is passed, and it exists, runC must not modify it(other than joining the cgroups). This will allow me to remove cgroups related functionality from #357
Thanks

@mrunalp
Copy link
Contributor

mrunalp commented Nov 13, 2015

The intention behind cgroupsPath in the spec is that the container joins the path rather than creating a sub cgroup under it.

@hqhq
Copy link
Contributor Author

hqhq commented Nov 16, 2015

However, the important thing is, if cgroups is passed, and it exists, runC must not modify it(other than joining the cgroups).

@ashahab-altiscale I think you understand the intention of cgroupsPath wrong, my understanding is the same as @mrunalp . Do you have some background that you need some features work like that? Maybe we can discuss it in specs.

@ashahab-altiscale
Copy link
Contributor

@hqhq So you're saying that even when the operator passes the cgroup using cgroupsPath, it will be modified(in terms of memory, devices, etc) by runC?
If that is the intent of the spec cgroupsPath, then that would not serve the usecase I was thinking of.
My usecase is this: #350. I need to be able to launch containers(with runC) from inside userns containers. I have elaborated on the issues with this in #357. When I launch runC inside a userns container, runC tries to change devices.deny and devices.allow files, which only a host root can do. So there should be a nice way for the operator to pass in the cgroup and telling runC "I know what I'm doing, don't touch this cgroup, just join it". In my previous discussion with @mrunalp, he seemed to indicate this is what "cgroupsPath" does. Are you saying this would require an additional flag in the spec? There can be other cases where the operator wants to opt-out of runC's modifications of cgroup. What if there is an external cgroupsManager that the operator uses? (I think @wking mentioned that usecase).

@LK4D4
Copy link
Contributor

LK4D4 commented Nov 16, 2015

@mrunalp @hqhq @ashahab-altiscale I think cgoupPath won't be modified?

@ashahab-altiscale
Copy link
Contributor

@wking
Copy link
Contributor

wking commented Nov 16, 2015

On Mon, Nov 16, 2015 at 05:26:10AM -0800, Abin Shahab wrote:

@hqhq So you're saying that even when the operator passes the
cgroup, it will be modified(in terms of memory, devices, etc) by
runC? If that is the intent of the spec cgroupsPath, then that
would not serve the usecase I was thinking of.

Re-reading the spec 1, whether cgroupsPath can be modified or just
joined seems to be open to interpretation. I suggest bumping this
over to the spec to get that sorted out before continuing with the
implementation here.

@mrunalp
Copy link
Contributor

mrunalp commented Nov 16, 2015

I see 4 cases; 3 of which were discussed in the PR that merged cgroupPath into the spec -

  1. Specify resources: runtimes creates a path and updates values per resources.
  2. Specify cgroupsPath: runtime joins the cgroupsPath.
  3. Specify both: runtime joins the cgroupsPath and updates resources under that path (opencontainers/runtime-spec@429f936#diff-34c30be66233f08b447fb608ea0e66bbR30).
  4. Specify none: Don't do anything with cgroups i.e. let the kernel give me something I run under automatically. This is useful for usernamespaced desktop applications such as gimp under xdg-app.

@ashahab-altiscale
Copy link
Contributor

@mrunalp As discussed, case (2) will work for me if cgroupsPath + no resrouce specification also prevents runC from setting devices.allow and devices.deny. That's what fails when the host launching runC is itself a usernamespaced container( see #350 ). Either I can update my PR or @hqhq can update this. My userns PR(#357) is blocked on this.

@wking
Copy link
Contributor

wking commented Nov 16, 2015

On Mon, Nov 16, 2015 at 11:39:11AM -0800, Mrunal Patel wrote:

I see 4 cases; 3 of which were discussed in the PR that merged
cgroupPath into the spec -

Ah, good (I hadn't gone back to re-read opencontainers/runtime-spec#137.

  1. Specify both: runtime joins the cgroupsPath and updates resources
    under that path
    (opencontainers/runtime-spec@429f936#diff-34c30be66233f08b447fb608ea0e66bbR30).

Should I file a spec PR to echo this (informative?) Go comment in the
(normative?) Markdown description? Or are the Go comments also
normative? I feel like the Markdown was supposed to be stand-alone,
but I haven't looked up a reference to quote for that.

@ashahab-altiscale
Copy link
Contributor

@wking That would be good. Lets not leave it to interpretation.

@mrunalp
Copy link
Contributor

mrunalp commented Nov 16, 2015

@wking Yeah, go for it.

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Nov 16, 2015
This should help clarify the cgroupsPath setting added in opencontainers#137, which
was the subject of some confusion in opencontainers/runc#397.  Issues
I'm trying to clarify here:

* If you specify a cgroupsPath, is the container added to that path or
  a sub-cgroup underneath it [1]?  (This commit rules in favor of
  "added to that path")

* If you specify a cgroupsPath, can the runtime modify that cgroup
  [2]?  (This commit rules "yes, if 'resources' is specified",
  following [3] and the Go comment from opencontainers#137 [4]).

To help make the distinctions clearer, I've added a facet list to help
folks think about the difference between cgroup creation, process
assignment, and resource configuration.  cgroupsPath is just about
cgroup creation and process assignment.  'resources' is just about
resource configuration.  I've listed out Mrunal's first three cases
[3] to be even clearer.  I stayed away from the "neither are set"
case, since I covered that fairly directly in opencontainers#237, which that was
punted back to the list [5] and has seen no further interest.  So I'm
not clear on what the intended semantics are there, although Mrunal's
wording in [4] seems to agree with the proposal in opencontainers#237.

[1]: opencontainers/runc#397 (comment)
[2]: opencontainers/runc#397 (comment)
[3]: opencontainers/runc#397 (comment)
[4]: opencontainers@429f936#diff-34c30be66233f08b447fb608ea0e66bbR30
[5]: https://groups.google.com/a/opencontainers.org/d/msg/dev/qWHoKs8Fsrk/c9mv6qXtDAAJ
     Message-ID: <[email protected]>

Signed-off-by: W. Trevor King <[email protected]>
It's defined in specs, add the support to runC.

Signed-off-by: Qiang Huang <[email protected]>
@hqhq hqhq force-pushed the hq_add_cgrouppaht branch from e50c039 to 70611b6 Compare November 17, 2015 12:37
@hqhq
Copy link
Contributor Author

hqhq commented Nov 17, 2015

I understood the intention of cgroupsPath wrong, if it's specified, it should replace the cgroup path rule in runc (combined by parent and name), now updated and this should work as expected in specs.

@ashahab-altiscale I didn't handle devices cgroup in this PR since I think that's a separate issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to avoid adding an additional field, we could overload Name and treat it as cgroupsPath if it is absolute. That way we don't need to have Parent, Name as well as CgroupsPath. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what I planed, when we merge this, we can start removing Parent and Name.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm i think we can just start removing them here ? I think it's also clearer when we integrate this with docker too since there will be complication errors :p

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Dec 16, 2015
This should help clarify the cgroupsPath setting added in opencontainers#137, which
was the subject of some confusion in opencontainers/runc#397.  Issues
I'm trying to clarify here:

* If you specify a cgroupsPath, is the container added to that path or
  a sub-cgroup underneath it [1]?  (This commit rules in favor of
  "added to that path")

* If you specify a cgroupsPath, can the runtime modify that cgroup
  [2]?  (This commit rules "yes, if 'resources' is specified",
  following [3] and the Go comment from opencontainers#137 [4]).

To help make the distinctions clearer, I've added a facet list to help
folks think about the difference between cgroup creation, process
assignment, and resource configuration.  cgroupsPath is just about
cgroup creation and process assignment.  'resources' is just about
resource configuration.  I've listed out Mrunal's first three cases
[3] to be even clearer.  I stayed away from the "neither are set"
case, since I covered that fairly directly in opencontainers#237, which that was
punted back to the list [5] and has seen no further interest.  So I'm
not clear on what the intended semantics are there, although Mrunal's
wording in [4] seems to agree with the proposal in opencontainers#237.

[1]: opencontainers/runc#397 (comment)
[2]: opencontainers/runc#397 (comment)
[3]: opencontainers/runc#397 (comment)
[4]: opencontainers@429f936#diff-34c30be66233f08b447fb608ea0e66bbR30
[5]: https://groups.google.com/a/opencontainers.org/d/msg/dev/qWHoKs8Fsrk/c9mv6qXtDAAJ
     Message-ID: <[email protected]>

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Dec 16, 2015
This should help clarify the cgroupsPath setting added in opencontainers#137, which
was the subject of some confusion in opencontainers/runc#397.  Issues
I'm trying to clarify here:

* If you specify a cgroupsPath, is the container added to that path or
  a sub-cgroup underneath it [1]?  (This commit rules in favor of
  "added to that path")

* If you specify a cgroupsPath, can the runtime modify that cgroup
  [2]?  (This commit rules "yes, if 'resources' is specified",
  following [3] and the Go comment from opencontainers#137 [4]).

To help make the distinctions clearer, I've added a facet list to help
folks think about the difference between cgroup creation, process
assignment, and resource configuration.  cgroupsPath is just about
cgroup creation and process assignment.  'resources' is just about
resource configuration.  I've listed out Mrunal's first three cases
[3] to be even clearer.  I stayed away from the "neither are set"
case, since I covered that fairly directly in opencontainers#237, which that was
punted back to the list [5] and has seen no further interest.  So I'm
not clear on what the intended semantics are there, although Mrunal's
wording in [4] seems to agree with the proposal in opencontainers#237.

[1]: opencontainers/runc#397 (comment)
[2]: opencontainers/runc#397 (comment)
[3]: opencontainers/runc#397 (comment)
[4]: opencontainers@429f936#diff-34c30be66233f08b447fb608ea0e66bbR30
[5]: https://groups.google.com/a/opencontainers.org/d/msg/dev/qWHoKs8Fsrk/c9mv6qXtDAAJ
     Message-ID: <[email protected]>

Signed-off-by: W. Trevor King <[email protected]>
@cyphar
Copy link
Member

cyphar commented Jan 26, 2016

IMHO, we should error out if the systemd manager has CgroupPath set (because systemd doesn't allow you to set arbitrary "slice" paths).

@hqhq
Copy link
Contributor Author

hqhq commented Jan 27, 2016

Yeah I start thinking maybe we still need to separate --cgroup-parent and --slice usage.

@crosbymichael crosbymichael modified the milestones: 0.0.8, 0.0.9 Feb 4, 2016
@LK4D4 LK4D4 closed this in #497 Feb 10, 2016
@hqhq hqhq deleted the hq_add_cgrouppaht branch February 14, 2016 01:34
stefanberger pushed a commit to stefanberger/runc that referenced this pull request Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants