{
{"v1", no_argument, NULL, '1'},
{"v2", no_argument, NULL, '2'},
+ {"ignore-unmappable", no_argument, NULL, 'i'},
{"rule", required_argument, NULL, 'r'},
{"help", no_argument, NULL, 'h'},
{"copy-from", required_argument, NULL, COPY_FROM_OPTION},
"v1 format\n");
printf(" -2, --v2 Provided parameters are in "
"v2 format\n");
+ printf(" -i, --ignore-unmappable Do not return an error for settings "
+ "that cannot be converted\n");
printf(" -r, --variable <name> Define parameter "\
"to set\n");
printf(" --copy-from <source_cgroup_path> Control group whose "\
struct cgroup *cgroup;
struct cgroup *converted_src_cgroup;
enum cg_version_t src_version = CGROUP_UNK;
+ bool ignore_unmappable = false;
/* no parametr on input */
if (argc < 2) {
/* parse arguments */
while ((c = getopt_long (argc, argv,
- "r:h12", long_options, NULL)) != -1) {
+ "r:h12i", long_options, NULL)) != -1) {
switch (c) {
case 'h':
usage(0, argv[0]);
case '2':
src_version = CGROUP_V2;
break;
+ case 'i':
+ ignore_unmappable = true;
+ break;
default:
usage(1, argv[0]);
ret = -1;
ret = cgroup_convert_cgroup(converted_src_cgroup, CGROUP_DISK,
src_cgroup, src_version);
- if (ret)
+ if (ret == ECGNOVERSIONCONVERT && ignore_unmappable)
+ /* The user has specified that we should ignore
+ * any errors due to being unable to map from v1 to
+ * v2 or vice versa
+ */
+ ret = 0;
+ else if (ret)
goto err;
cgroup_free(&cgroup);