@@ -323,6 +323,7 @@ int main(int argc, char *argv[], char *envp[])
{ "extra", no_argument, 0, 1077 },
{ "experimental", no_argument, 0, 1078 },
{ "all", no_argument, 0, 1079 },
+ { "cgroup-only", required_argument, 0, 1080 },
{ },
};
@@ -627,6 +628,13 @@ int main(int argc, char *argv[], char *envp[])
opts.check_extra_features = true;
opts.check_experimental_features = true;
break;
+ case 1080:
+ if (xrealloc_safe(&opts.cgroup_only,
+ sizeof(char *) * (opts.nr_cgroup_only + 1)))
+ return 1;
+ opts.cgroup_only[opts.nr_cgroup_only] = optarg;
+ opts.nr_cgroup_only++;
+ break;
case 'V':
pr_msg("Version: %s\n", CRIU_VERSION);
if (strcmp(CRIU_GITID, "0"))
@@ -98,6 +98,8 @@ struct cr_options {
unsigned int manage_cgroups;
char *new_global_cg_root;
struct list_head new_cgroup_roots;
+ char **cgroup_only;
+ size_t nr_cgroup_only;
bool autodetect_ext_mounts;
bool enable_external_sharing;
bool enable_external_masters;
@@ -2160,6 +2160,7 @@ int parse_cgroup_file(FILE *f, struct list_head *retl, unsigned int *n)
while (fgets(buf, BUF_SIZE, f)) {
struct cg_ctl *ncc, *cc;
char *name, *path = NULL, *e;
+ size_t i;
ncc = xmalloc(sizeof(*cc));
if (!ncc)
@@ -2185,6 +2186,19 @@ int parse_cgroup_file(FILE *f, struct list_head *retl, unsigned int *n)
if (e)
*e = '\0';
+ if (opts.nr_cgroup_only) {
+ for (i = 0; i < opts.nr_cgroup_only; i++) {
+ if (!strncmp(name, opts.cgroup_only[i],
+ strlen(opts.cgroup_only[i])))
+ break;
+ }
+ if (i >= opts.nr_cgroup_only) {
+ pr_debug("cg: Skip controller %s\n", name);
+ xfree(ncc);
+ continue;
+ }
+ }
+
ncc->name = xstrdup(name);
ncc->path = xstrdup(path);
ncc->cgns_prefix = 0;