From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> Change bbe97ae968eba60b71e0066d49f9fc909966d9d6 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: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/qemu/qemu_cgroup.c | 3 +-- src/util/vircgroup.c | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index aaf94cf..9784f31 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -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; } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 5780785..07ea2c3 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -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: -- 1.8.2.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list