Repository navigation
core/manager: add dbus API to create auxiliary scope from running service - #28836
Conversation
|
@poettering this is similar to what we discussed previously (sd-notify asynchronous API for creating "restart" scopes) but a bit more generic and exposed as a DBus API instead. |
diff --git man/org.freedesktop.systemd1.xml man/org.freedesktop.systemd1.xml
index 19e83f8f14..f01c529b5e 100644
--- man/org.freedesktop.systemd1.xml
+++ man/org.freedesktop.systemd1.xml
@@ -277,8 +277,8 @@ node /org/freedesktop/systemd1 {
GetDynamicUsers(out a(us) users);
DumpUnitFileDescriptorStore(in s name,
out a(suuutuusu) entries);
- StartAuxiliaryScope(in s name,
- in ah pidfds,
+ StartAuxiliaryScope(in s name,
+ in ah pidfds,
out o job);
signals:
UnitNew(s id,It seems to be a whitespace issue. |
Good catch. Thank you @keszybz! |
ab20005 to
8749111
Compare
|
@bluca I think that build warning/error generated in Ubuntu CI is false positive? Can you double check and maybe drop the ci-fails label if appropriate. |
|
As mentioned in the previous comment, I think that build warning causing build failure on Ubuntu CI is a false positive. Dropping the Draft status in order to (hopefully) solicit more feedback. |
|
I am sorry, the copying of cgroup settings is weird. |
---> #28836 (comment) |
|
so i don't like the copying of the cgroup props, I'd not do it. But if everyone thinks this is great, i am oK with it, but please drop at the very least the delegation stuff. That's security relevant, and we shouldn't open up doors needlessly, in particular as it's highly unlikely the scope will need it. |
Yes - the cgroup setup should just be about resource management/access, delegation and other bits should definitely not be duplicated |
|
@msekletar ping - if this is to be merged for 255, then could it be prioritized to fix the review comments? It's a new interface so we need it before rc1 |
|
Punted to next milestone as discussed |
|
We had successfully released a new major release. We are no longer in a development freeze phase. |
|
@poettering Updated. PTAL. I plan to use newly added |
|
I think the pidfds scope specification should be generalized and brought into I find that
The API is inviting for "fork-classify-exec" workflow violation when long-running processes are migrated across horizontal cgroups. (This is a shared critique with Perhaps, in order to avoid the internal cloning of configuration, could there be some shared drop-ins between services and scopes that the scope would load upon start? |
This is exactly what I didn't want to do. Also adding this D-Bus API is fairly cheap because it is not introducing any new operational model or concept, it just creates scope unit that everyone is familiar with already. On the other hand, I don't want to rush merging this if there is opposition or discontent, however, staying with @poettering @bluca any opinions? |
|
This PR looks good to me, StartTransient could also be updated independently if there's a use case for it |
|
@bluca seems to be OK with merging this...what about @poettering ? |
|
This has been waiting for a long time, so unless there are more comments, I'll merge tomorrow - @poettering speak now or forever hold your peace |
| int cgroup_context_add_io_device_limit_dup(CGroupContext *c, CGroupIODeviceLimit *l); | ||
| int cgroup_context_add_io_device_weight_dup(CGroupContext *c, CGroupIODeviceWeight *w); | ||
| int cgroup_context_add_io_device_latency_dup(CGroupContext *c, CGroupIODeviceLatency *l); | ||
| int cgroup_context_add_block_io_device_weight_dup(CGroupContext *c, CGroupBlockIODeviceWeight *w); | ||
| int cgroup_context_add_block_io_device_bandwidth_dup(CGroupContext *c, CGroupBlockIODeviceBandwidth *b); | ||
| int cgroup_context_add_device_allow_dup(CGroupContext *c, CGroupDeviceAllow *a); | ||
| int cgroup_context_add_socket_bind_item_allow_dup(CGroupContext *c, CGroupSocketBindItem *i); | ||
| int cgroup_context_add_socket_bind_item_deny_dup(CGroupContext *c, CGroupSocketBindItem *i); | ||
|
|
||
| static inline int cgroup_context_add_bpf_foreign_program_dup(CGroupContext *c, CGroupBPFForeignProgram *p) { | ||
| return cgroup_context_add_bpf_foreign_program(c, p->attach_type, p->bpffs_path); | ||
| } |
There was a problem hiding this comment.
I will use those functions from other modules in followup PR.
…vice This commit introduces new D-Bus API, StartAuxiliaryScope(). It may be used by services as part of the restart procedure. Service sends an array of PID file descriptors corresponding to processes that are part of the service and must continue running also after service restarts, i.e. they haven't finished the job why they were spawned in the first place (e.g. long running video transcoding job). Systemd creates new scope unit for these processes and migrates them into it. Cgroup properties of scope are copied from the service so it retains same cgroup settings and limits as service had.
|
@yuwata updated, PTAL. |
we already have that in place since a while. It's used by default in systemd-run, and logind and such.
So I would acually agree with you on these too, but as mentioned above I was OK nonetheless if the others think this is important.
I think the assumption is that the scope is short-lived effectively, so I figure this is OK.
Yeah migration actually sucks. But we kinda dug our own grave here. scope units exist after all... I think we might want to document this though, i.e. say that scopes (i.e. migrated processes) should only exist for a short time, or involve an execve() so that they are replaced.
|
No description provided.