[libvirt] [PATCH] Fix starting domains when kernel has no cgroups support

Daniel P. Berrange berrange at redhat.com
Fri May 10 18:54:08 UTC 2013


On Fri, May 10, 2013 at 12:40:40PM -0600, Jim Fehlig wrote:
> Found that I was unable to start existing domains after updating
> to a kernel with no cgroups support
> 
>   # zgrep CGROUP /proc/config.gz
>   # CONFIG_CGROUPS is not set
>   # virsh start test
>   error: Failed to start domain test
>   error: Unable to initialize /machine cgroup: Cannot allocate memory
> 
> virCgroupPartitionNeedsEscaping() correctly returns errno (ENOENT) when
> attempting to open /proc/cgroups on such a system, but it was being
> dropped in virCgroupSetPartitionSuffix().
> 
> Change virCgroupSetPartitionSuffix() to propogate errors returned by
> its callees.  Also check for ENOENT in qemuInitCgroup() when determining
> if cgroups support is available.
> ---
>  src/qemu/qemu_cgroup.c |  3 ++-
>  src/util/vircgroup.c   | 19 +++++++++++++------
>  2 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 9c45b76..40777aa 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -414,7 +414,8 @@ int qemuInitCgroup(virQEMUDriverPtr driver,
>          if (rc != 0) {
>              if (rc == -ENXIO ||
>                  rc == -EPERM ||
> -                rc == -EACCES) { /* No cgroups mounts == success */
> +                rc == -EACCES ||
> +                rc == -ENOENT) { /* 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 473d2fc..ef619dc 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -1167,14 +1167,14 @@ static int virCgroupPartitionEscape(char **path)
>      return 0;
>  }
>  
> -static char *virCgroupSetPartitionSuffix(const char *path)
> +static int virCgroupSetPartitionSuffix(const char *path, char **res)

You're changing the signature, but I don't see you changing any
callers to adapt.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list