提交 c2cf5f1c 编写于 作者: D Daniel P. Berrange

Fix failure to detect missing cgroup partitions

Change bbe97ae9 caused the
QEMU driver to ignore ENOENT errors from cgroups, in order
to cope with missing /proc/cgroups. This is not good though
because many other things can cause ENOENT and should not
be ignored. The callers expect to see ENXIO when cgroups
are not present, so adjust the code to report that errno
when /proc/cgroups is missing
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 7bebd888
......@@ -456,8 +456,7 @@ int qemuInitCgroup(virQEMUDriverPtr driver,
if (rc != 0) {
if (rc == -ENXIO ||
rc == -EPERM ||
rc == -EACCES ||
rc == -ENOENT) { /* No cgroups mounts == success */
rc == -EACCES) { /* No cgroups mounts == success */
VIR_DEBUG("No cgroups present/configured/accessible, ignoring error");
goto done;
}
......
......@@ -1110,8 +1110,13 @@ static int virCgroupPartitionNeedsEscaping(const char *path)
path[0] == '.')
return 1;
if (!(fp = fopen("/proc/cgroups", "r")))
if (!(fp = fopen("/proc/cgroups", "r"))) {
/* The API contract is that we return ENXIO
* if cgroups are not available on a host */
if (errno == ENOENT)
errno = ENXIO;
return -errno;
}
/*
* Data looks like this:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册