forked from pool/libvirt
- Fix starting domains when kernel has no cgroups support
bbe97ae9-no-cgroups.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=262
This commit is contained in:
parent
9f17752b70
commit
63e2ee1ac4
102
bbe97ae9-no-cgroups.patch
Normal file
102
bbe97ae9-no-cgroups.patch
Normal file
@ -0,0 +1,102 @@
|
||||
commit bbe97ae968eba60b71e0066d49f9fc909966d9d6
|
||||
Author: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Fri May 10 12:05:00 2013 -0600
|
||||
|
||||
Fix starting domains when kernel has no cgroups support
|
||||
|
||||
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 propagate errors returned by
|
||||
its callees. Also check for ENOENT in qemuInitCgroup() when determining
|
||||
if cgroups support is available.
|
||||
|
||||
Index: libvirt-1.0.5/src/qemu/qemu_cgroup.c
|
||||
===================================================================
|
||||
--- libvirt-1.0.5.orig/src/qemu/qemu_cgroup.c
|
||||
+++ libvirt-1.0.5/src/qemu/qemu_cgroup.c
|
||||
@@ -445,7 +445,8 @@ int qemuInitCgroup(virQEMUDriverPtr driv
|
||||
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;
|
||||
}
|
||||
Index: libvirt-1.0.5/src/util/vircgroup.c
|
||||
===================================================================
|
||||
--- libvirt-1.0.5.orig/src/util/vircgroup.c
|
||||
+++ libvirt-1.0.5/src/util/vircgroup.c
|
||||
@@ -1167,14 +1167,14 @@ static int virCgroupPartitionEscape(char
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static char *virCgroupSetPartitionSuffix(const char *path)
|
||||
+static int virCgroupSetPartitionSuffix(const char *path, char **res)
|
||||
{
|
||||
char **tokens = virStringSplit(path, "/", 0);
|
||||
size_t i;
|
||||
- char *ret = NULL;
|
||||
+ int ret = -1;
|
||||
|
||||
if (!tokens)
|
||||
- return NULL;
|
||||
+ return ret;
|
||||
|
||||
for (i = 0 ; tokens[i] != NULL ; i++) {
|
||||
/* Whitelist the 3 top level fixed dirs
|
||||
@@ -1193,20 +1193,27 @@ static char *virCgroupSetPartitionSuffix
|
||||
!strchr(tokens[i], '.')) {
|
||||
if (VIR_REALLOC_N(tokens[i],
|
||||
strlen(tokens[i]) + strlen(".partition") + 1) < 0) {
|
||||
+ ret = -ENOMEM;
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
strcat(tokens[i], ".partition");
|
||||
}
|
||||
|
||||
- if (virCgroupPartitionEscape(&(tokens[i])) < 0) {
|
||||
- virReportOOMError();
|
||||
+ ret = virCgroupPartitionEscape(&(tokens[i]));
|
||||
+ if (ret < 0) {
|
||||
+ if (ret == -ENOMEM)
|
||||
+ virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
- if (!(ret = virStringJoin((const char **)tokens, "/")))
|
||||
+ if (!(*res = virStringJoin((const char **)tokens, "/"))) {
|
||||
+ ret = -ENOMEM;
|
||||
goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
|
||||
cleanup:
|
||||
virStringFreeList(tokens);
|
||||
@@ -1241,9 +1248,9 @@ int virCgroupNewPartition(const char *pa
|
||||
|
||||
/* XXX convert all cgroups APIs to use error report
|
||||
* APIs instead of returning errno */
|
||||
- if (!(newpath = virCgroupSetPartitionSuffix(path))) {
|
||||
+ rc = virCgroupSetPartitionSuffix(path, &newpath);
|
||||
+ if (rc < 0) {
|
||||
virResetLastError();
|
||||
- rc = -ENOMEM;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon May 13 09:32:56 MDT 2013 - jfehlig@suse.com
|
||||
|
||||
- Fix starting domains when kernel has no cgroups support
|
||||
bbe97ae9-no-cgroups.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 2 13:14:00 MDT 2013 - jfehlig@suse.com
|
||||
|
||||
|
@ -423,6 +423,7 @@ Source1: libvirtd.init
|
||||
Source2: libvirtd-relocation-server.fw
|
||||
Source99: baselibs.conf
|
||||
# Upstream patches
|
||||
Patch0: bbe97ae9-no-cgroups.patch
|
||||
# Need to go upstream
|
||||
Patch100: xen-name-for-devid.patch
|
||||
Patch101: clone.patch
|
||||
@ -563,6 +564,7 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch100 -p1
|
||||
%patch101
|
||||
%patch102 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user