prevent cgroup renames for disabled cgroups; fixes #797
Costa Tsaousis committed
Aug 21, 2016 at 13:01 UTC
9821d4f781a1b9cd1b1db6559bb621b58d11e6ae
1 file changed
+5
-4
src/sys_fs_cgroup.c
+5
-4
@@ -616,8 +616,8 @@ void cgroup_get_chart_id(struct cgroup *cg) {
616
617
freez(cg->chart_id);
618
cg->chart_id = strdupz(s);
619
-
619
netdata_fix_chart_id(cg->chart_id);
620
+ cg->hash_chart = simple_hash(cg->chart_id);
621
622
debug(D_CGROUP, "cgroup '%s' renamed to '%s' (title: '%s')", cg->id, cg->chart_id, cg->chart_title);
623
}
@@ -679,12 +679,11 @@ struct cgroup *cgroup_add(const char *id) {
679
680
struct cgroup *cg = callocz(1, sizeof(struct cgroup));
681
682
- debug(D_CGROUP, "adding cgroup '%s'", id);
683
-
682
cg->id = strdupz(id);
683
cg->hash = simple_hash(cg->id);
684
685
cg->chart_id = strdupz(chart_id);
686
+ netdata_fix_chart_id(cg->chart_id);
687
cg->hash_chart = simple_hash(cg->chart_id);
688
689
cg->chart_title = strdupz(chart_id);
@@ -701,7 +700,9 @@ struct cgroup *cgroup_add(const char *id) {
700
cgroup_root_count++;
701
702
// fix the name by calling the external script
704
- cgroup_get_chart_id(cg);
703
+ if(def) cgroup_get_chart_id(cg);
704
+
705
+ debug(D_CGROUP, "adding cgroup '%s' with chart id '%s'", id, chart_id);
706
707
char option[FILENAME_MAX + 1];
708
snprintfz(option, FILENAME_MAX, "enable cgroup %s", cg->chart_title);