8000 stage1/kvm: Avoid writing misleading subcgroup by euank · Pull Request #3107 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

stage1/kvm: Avoid writing misleading subcgroup #3107

Merged
merged 1 commit into from
Aug 30, 2016

Conversation

euank
Copy link
Member
@euank euank commented Aug 23, 2016

Ref #2664

This also documents the existing behavior as an optional stage1 feature/contract. Ref #3072.

The init.go code does not run nspawn with --register=true for kvm, but
does write a subcgroup file of that form.

This makes it a little saner, and also simplifies it down to only one
dbus call rather than calling it several times in different places.

@@ -581,7 +582,12 @@ func stage1() int {
return 1
}

args, env, err := getArgsEnv(p, flavor, debug, n, insecureOptions)
canMachinedRegister := false
if flavor != "kvm" {
Copy link
Member
@lucab lucab Aug 24, 2016

Choose a reason for hiding this comment

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

How does fly fit into this PR? Should it be taken into account here?

Copy link
Member Author

Choose a reason for hiding this comment

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

fly neither writes a file nor does machined registration (this init.go code is not called for it and there is no analogue in the stage1_fly/run/run.go code).

@lucab
Copy link
Member
lucab commented Aug 24, 2016

I see this is not trying to tackle the kvm-machined registration issue but just accommodating cgroups info for api-service. This is not what I was thinking about initially, but it makes sense too as it can help decoupling api-service from machined on the host.

What I'm not completely sure at this point is how does "fly" (and everything else without subcgroup file) fit into this picture. If the subcgroup is missing, do we just read cgroup info from /proc (and assume there won't be races with machined)?

@euank
Copy link
Member Author
euank commented Aug 24, 2016

Good call on the title being misleading, I'll fix that.

No other stage1s attempt to do machined registration, so their cgroups will be accurate and there will be no such race. We do just read /proc in the default case.

I don't think we have a good answer for what to do if an external system moves our cgroup after we're running in general (e.g. writing our ppid to the tasks file in some arbitrary cgroup), but I think if you have an external system interfering with cgroups it's an external responsibility to fix any issues there.

In this case, it's a stage1 responsibility because the external-cgroup-fiddling is at the behest of internal stage1 code, and any other stage1 that triggers a change to its cgroup can use the file similarly.

Ref rkt#2664

The `init.go` code does not run nspawn with --register=true for kvm, but
does write a subcgroup file of that form.

This makes it a little saner, and also simplifies it down to only one
dbus call rather than calling it several times in different places.
@euank euank force-pushed the improve-machined-registration-logc branch from b4227f5 to 0a2760f Compare August 24, 2016 14:53
@euank euank changed the title stage1-kvm: Improve machined registration logic stage1-kvm: Avoid writing misleading subcgroup Aug 24, 2016
@euank
Copy link
Member Author
euank commented Aug 24, 2016

cc @jjlakis @jellonek as well; you might have more context on the kvm registration stuff.

@euank euank added this to the v1.14.0 milestone Aug 25, 2016
@euank
Copy link
Member Author
euank commented Aug 26, 2016

Are your concerns addressed, @lucab?

Does anyone else want to weigh in on whether this seems right?

@lucab
Copy link
Member
lucab commented Aug 27, 2016

Yes, it seems fine. I'm leaving some time for @iaguis to express any concerns on this till next Monday, and then merge.

@lucab
Copy link
Member
lucab commented Aug 30, 2016

It already looked good to me before and I think we can just land it at this point, dealing with concerns/fallouts (if any) later.

@lucab lucab changed the title stage1-kvm: Avoid writing misleading subcgroup stage1/kvm: Avoid writing misleading subcgroup Aug 30, 2016
@lucab lucab merged commit cbe2f65 into rkt:master Aug 30, 2016
@euank euank deleted the improve-machined-registration-logc branch August 30, 2016 16:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0