The lxc monitor does not store the container's cgroups, rather it
recalculates them whenever needed.
Systemd moves itself into a /init.scope cgroup for the systemd
controller.
It might be worth changing that (by storing all cgroup info in the
lxc_handler), but for now go the hacky route and chop off any
trailing /init.scope.
I definately thinkg we want to switch to storing as that will be
more bullet-proof, but for now we need a quick backportable fix
for systemd 226 guests.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
info = find_info_for_subsystem(info, subsystem);
if (!info)
return NULL;
+ prune_init_scope(info->cgroup_path);
return info->cgroup_path;
}
nerr = nih_error_get();
nih_free(nerr);
}
+ prune_init_scope(cgroup);
return cgroup;
}
{
return ops->driver;
}
+
+#define INIT_SCOPE "/init.scope"
+void prune_init_scope(char *cg)
+{
+ char *point = cg + strlen(cg) - strlen(INIT_SCOPE);
+ if (point < cg)
+ return;
+ if (strcmp(point, INIT_SCOPE) == 0) {
+ if (point == cg)
+ *(point+1) = '\0';
+ else
+ *point = '\0';
+ }
+}
extern void cgroup_disconnect(void);
extern cgroup_driver_t cgroup_driver(void);
+extern void prune_init_scope(char *cg);
+
#endif