]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: be less alarming when creating cgroups 3412/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 May 2020 14:05:27 +0000 (16:05 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 May 2020 14:08:31 +0000 (16:08 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 892fd915bb72de34ba768776d63d3327fd2b11ef..cc94fb094ab2b8b51197ab3b78ad4856d5aa80b4 100644 (file)
@@ -1148,7 +1148,7 @@ static int mkdir_eexist_on_last(const char *dir, mode_t mode)
 
                ret = mkdir(makeme, mode);
                if (ret < 0 && ((errno != EEXIST) || (orig_len == cur_len)))
-                       return log_error_errno(-1, errno, "Failed to create directory \"%s\"", makeme);
+                       return log_warn_errno(-1, errno, "Failed to create directory \"%s\"", makeme);
        } while (tmp != dir);
 
        return 0;
@@ -1178,9 +1178,9 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
 
                ret = mkdir_eexist_on_last(limit_path, 0755);
                if (ret < 0)
-                       return log_error_errno(false, errno,
-                                              "Failed to create %s limiting cgroup",
-                                              limit_path);
+                       return log_debug_errno(false,
+                                             errno, "Failed to create %s limiting cgroup",
+                                             limit_path);
 
                h->cgfd_limit = lxc_open_dirfd(limit_path);
                if (h->cgfd_limit < 0)
@@ -1207,7 +1207,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
                 * directory for us to ensure correct initialization.
                 */
                if (ret_cpuset != 1 || cgroup_tree)
-                       return log_error_errno(false, errno, "Failed to create %s cgroup", path);
+                       return log_debug_errno(false, errno, "Failed to create %s cgroup", path);
        }
 
        if (payload) {
@@ -1350,7 +1350,7 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
                                               monitor_cgroup, false, NULL))
                                continue;
 
-                       ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->monitor_full_path ?: "(null)");
+                       DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->monitor_full_path ?: "(null)");
                        for (int j = 0; j < i; j++)
                                cgroup_tree_leaf_remove(ops->hierarchies[j], false);
 
@@ -1360,7 +1360,7 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
        } while (ops->hierarchies[i] && idx > 0 && idx < 1000 && suffix);
 
        if (idx == 1000 || (!suffix && idx != 0))
-               return ret_set_errno(false, ERANGE);
+               return log_error_errno(false, ERANGE, "Failed to create monitor cgroup");
 
        ops->monitor_cgroup = move_ptr(monitor_cgroup);
        return log_info(true, "The monitor process uses \"%s\" as cgroup", ops->monitor_cgroup);
@@ -1454,7 +1454,7 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
                                               limiting_cgroup))
                                continue;
 
-                       ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)");
+                       DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)");
                        for (int j = 0; j < i; j++)
                                cgroup_tree_leaf_remove(ops->hierarchies[j], true);
 
@@ -1464,7 +1464,7 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
        } while (ops->hierarchies[i] && idx > 0 && idx < 1000 && suffix);
 
        if (idx == 1000 || (!suffix && idx != 0))
-               return ret_set_errno(false, ERANGE);
+               return log_error_errno(false, ERANGE, "Failed to create container cgroup");
 
        ops->container_cgroup = move_ptr(container_cgroup);
        INFO("The container process uses \"%s\" as cgroup", ops->container_cgroup);