From 26f8e508813d78d21a8e59c94f0cb8821baa99ffe6d5a5b672b4eca16aa5db24 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Fri, 24 Oct 2008 13:18:27 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=24 --- cgmajor.patch | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ libvirt.changes | 7 +++++++ libvirt.spec | 10 ++++++++- lxcpty.patch | 48 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 cgmajor.patch create mode 100644 lxcpty.patch diff --git a/cgmajor.patch b/cgmajor.patch new file mode 100644 index 0000000..d314f7a --- /dev/null +++ b/cgmajor.patch @@ -0,0 +1,55 @@ +Index: libvirt-0.4.6/src/cgroup.c +=================================================================== +--- libvirt-0.4.6.orig/src/cgroup.c ++++ libvirt-0.4.6/src/cgroup.c +@@ -761,6 +761,36 @@ out: + return rc; + } + ++/** ++ * virCgroupAllowDeviceMajor: ++ * ++ * @group: The cgroup to allow an entire device major type for ++ * @type: The device type (i.e., 'c' or 'b') ++ * @major: The major number of the device type ++ * ++ * Returns: 0 on success ++ */ ++int virCgroupAllowDeviceMajor(virCgroupPtr group, ++ char type, ++ int major) ++{ ++ int rc; ++ char *devstr = NULL; ++ ++ if (asprintf(&devstr, "%c %i:* rwm", type, major) == -1) { ++ rc = -ENOMEM; ++ goto out; ++ } ++ ++ rc = virCgroupSetValueStr(group, ++ "devices.allow", ++ devstr); ++ out: ++ VIR_FREE(devstr); ++ ++ return rc; ++} ++ + int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares) + { + return virCgroupSetValueU64(group, "cpu.shares", (uint64_t)shares); +Index: libvirt-0.4.6/src/cgroup.h +=================================================================== +--- libvirt-0.4.6.orig/src/cgroup.h ++++ libvirt-0.4.6/src/cgroup.h +@@ -35,6 +35,9 @@ int virCgroupAllowDevice(virCgroupPtr gr + char type, + int major, + int minor); ++int virCgroupAllowDeviceMajor(virCgroupPtr group, ++ char type, ++ int major); + + int virCgroupSetCpuShares(virCgroupPtr group, unsigned long shares); + int virCgroupGetCpuShares(virCgroupPtr group, unsigned long *shares); diff --git a/libvirt.changes b/libvirt.changes index cc31cd7..e5448f9 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 23 16:33:37 MDT 2008 - jfehlig@novell.com + +- Add upstream patches to fix ordering problem with setting up + cgroup containment on LXC domains. + bnc#437816 + ------------------------------------------------------------------- Mon Oct 20 15:00:11 MDT 2008 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index 92c6fec..cde6981 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -49,7 +49,7 @@ License: LGPL v2.1 or later Group: Development/Libraries/C and C++ AutoReqProv: yes Version: 0.4.6 -Release: 3 +Release: 4 Summary: A C toolkit to interract with the virtualization capabilities of Linux Requires: readline Requires: ncurses @@ -77,6 +77,8 @@ Patch7: lxc_res_mem.patch Patch8: cgshares.patch Patch9: lxcsched.patch Patch10: lxcvirsh.patch +Patch11: cgmajor.patch +Patch12: lxcpty.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -178,6 +180,8 @@ Authors: %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 +%patch12 -p1 rm po/no.* %build @@ -310,6 +314,10 @@ rm -rf $RPM_BUILD_ROOT %{py_sitedir}/libvirtmod* %changelog +* Thu Oct 23 2008 jfehlig@novell.com +- Add upstream patches to fix ordering problem with setting up + cgroup containment on LXC domains. + bnc#437816 * Mon Oct 20 2008 jfehlig@novell.com - Remove IA64 from list of architectures supporting Xen. * Fri Oct 10 2008 jfehlig@novell.com diff --git a/lxcpty.patch b/lxcpty.patch new file mode 100644 index 0000000..1147ffc --- /dev/null +++ b/lxcpty.patch @@ -0,0 +1,48 @@ +Index: libvirt-0.4.6/src/lxc_container.h +=================================================================== +--- libvirt-0.4.6.orig/src/lxc_container.h ++++ libvirt-0.4.6/src/lxc_container.h +@@ -40,6 +40,8 @@ enum { + #define LXC_DEV_MAJ_TTY 5 + #define LXC_DEV_MIN_CONSOLE 1 + ++#define LXC_DEV_MAJ_PTY 136 ++ + int lxcContainerSendContinue(int control); + + int lxcContainerStart(virDomainDefPtr def, +Index: libvirt-0.4.6/src/lxc_controller.c +=================================================================== +--- libvirt-0.4.6.orig/src/lxc_controller.c ++++ libvirt-0.4.6/src/lxc_controller.c +@@ -106,6 +106,10 @@ static int lxcSetContainerResources(virD + goto out; + } + ++ rc = virCgroupAllowDeviceMajor(cgroup, 'c', LXC_DEV_MAJ_PTY); ++ if (rc != 0) ++ goto out; ++ + rc = virCgroupAddTask(cgroup, getpid()); + out: + if (rc != 0) { +@@ -452,6 +456,9 @@ lxcControllerRun(virDomainDefPtr def, + goto cleanup; + } + ++ if (lxcSetContainerResources(def) < 0) ++ goto cleanup; ++ + if ((container = lxcContainerStart(def, + nveths, + veths, +@@ -464,9 +471,6 @@ lxcControllerRun(virDomainDefPtr def, + if (lxcControllerMoveInterfaces(nveths, veths, container) < 0) + goto cleanup; + +- if (lxcSetContainerResources(def) < 0) +- goto cleanup; +- + if (lxcContainerSendContinue(control[0]) < 0) + goto cleanup; +