[libvirt] [PATCH] Fix starting domains when kernel has no cgroups support
Jim Fehlig
jfehlig at suse.com
Fri May 10 19:13:20 UTC 2013
Daniel P. Berrange wrote:
> 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.
>
Opps, that wouldn't even compile :). I created/tested this patch on a
test machine and somehow dropped a hunk when merging on my dev machine.
Unfortunately, I also didn't run my pre-patch-submit-tests on my dev
setup, totally missing this.
Here's the updated patch.
Regards,
Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no-cgroups.patch
Type: text/x-patch
Size: 3606 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130510/05f1ced3/attachment-0001.bin>
More information about the libvir-list
mailing list