shared/condition: add ConditionControlGroupController=v1|v2
Before, we only allowed conditionalizing on controllers, not the hierarchy.
This commit extends this to allow a simple check for v1 (i.e. classic or hybrid),
and v2 (full unified).
An alternative approach would be to add a separate Condition for this, but I'm
not too keen on that, considering that v1 is already being deprecrecated
(c.f. 82f3063218).
This commit is contained in:
@@ -354,6 +354,15 @@ static int condition_test_control_group_controller(Condition *c, char **env) {
|
||||
assert(c->parameter);
|
||||
assert(c->type == CONDITION_CONTROL_GROUP_CONTROLLER);
|
||||
|
||||
if (streq(c->parameter, "v2"))
|
||||
return cg_all_unified();
|
||||
if (streq(c->parameter, "v1")) {
|
||||
r = cg_all_unified();
|
||||
if (r < 0)
|
||||
return r;
|
||||
return !r;
|
||||
}
|
||||
|
||||
r = cg_mask_supported(&system_mask);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to determine supported controllers: %m");
|
||||
|
||||
Reference in New Issue
Block a user