[libvirt] [PATCH] spec: Automatically turn on cgconfig service

From: Daniel P. Berrange <berrange@redhat.com> A number of the libvirt APIs require the use of cgroups. This is not enabled by default on a RHEL6 install. After discussion with cgroups team, it was decided that upon installation of the libvirt RPM, we should automatically turn on the cgroups service. This will activate a default configuration that turns on all cgroups controllers libvirt requires for full operation. --- libvirt.spec.in | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 7c60eba..5ea3422 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -68,6 +68,7 @@ %define with_libnl 0%{!?_without_libnl:0} %define with_audit 0%{!?_without_audit:0} %define with_dtrace 0%{!?_without_dtrace:0} +%define with_cgconfig 0%{!?_without_cgconfig:0} # Non-server/HV driver defaults which are always enabled %define with_python 0%{!?_without_python:1} @@ -169,6 +170,13 @@ %define with_dtrace 1 %endif +# Pull in cgroups config system +%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 +%if %{with_qemu} || %{with_lxc} +%define with_cgconfig 0%{!?_without_cgconfig:1} +%endif +%endif + # Force QEMU to run as non-root %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 %define qemu_user qemu @@ -271,6 +279,9 @@ Requires: parted # For multipath support Requires: device-mapper %endif +%if %{with_cgconfig} +Requires: libcgroup +%endif %if %{with_xen} BuildRequires: xen-devel %endif @@ -725,6 +736,12 @@ then fi %endif +%if %{with_cgconfig} +if [ "$1" -eq "1" ]; then +/sbin/chkconfig cgconfig on +fi +%endif + /sbin/chkconfig --add libvirtd if [ "$1" -ge "1" ]; then /sbin/service libvirtd condrestart > /dev/null 2>&1 -- 1.7.3.4

Interesting approach. Any idea which RHEL 6.x release this will apply to? It sounds like Scott will need to update the relevant Virtualization Guide, to ensure this is communicated properly. On 23/12/2010, at 10:52 PM, Jiri Denemark wrote:
From: Daniel P. Berrange <berrange@redhat.com>
A number of the libvirt APIs require the use of cgroups. This is not enabled by default on a RHEL6 install. After discussion with cgroups team, it was decided that upon installation of the libvirt RPM, we should automatically turn on the cgroups service. This will activate a default configuration that turns on all cgroups controllers libvirt requires for full operation. --- libvirt.spec.in | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 7c60eba..5ea3422 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -68,6 +68,7 @@ %define with_libnl 0%{!?_without_libnl:0} %define with_audit 0%{!?_without_audit:0} %define with_dtrace 0%{!?_without_dtrace:0} +%define with_cgconfig 0%{!?_without_cgconfig:0}
# Non-server/HV driver defaults which are always enabled %define with_python 0%{!?_without_python:1} @@ -169,6 +170,13 @@ %define with_dtrace 1 %endif
+# Pull in cgroups config system +%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 +%if %{with_qemu} || %{with_lxc} +%define with_cgconfig 0%{!?_without_cgconfig:1} +%endif +%endif + # Force QEMU to run as non-root %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 %define qemu_user qemu @@ -271,6 +279,9 @@ Requires: parted # For multipath support Requires: device-mapper %endif +%if %{with_cgconfig} +Requires: libcgroup +%endif %if %{with_xen} BuildRequires: xen-devel %endif @@ -725,6 +736,12 @@ then fi %endif
+%if %{with_cgconfig} +if [ "$1" -eq "1" ]; then +/sbin/chkconfig cgconfig on +fi +%endif + /sbin/chkconfig --add libvirtd if [ "$1" -ge "1" ]; then /sbin/service libvirtd condrestart > /dev/null 2>&1 -- 1.7.3.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 12/23/2010 04:52 AM, Jiri Denemark wrote:
From: Daniel P. Berrange <berrange@redhat.com>
A number of the libvirt APIs require the use of cgroups. This is not enabled by default on a RHEL6 install. After discussion with cgroups team, it was decided that upon installation of the libvirt RPM, we should automatically turn on the cgroups service. This will activate a default configuration that turns on all cgroups controllers libvirt requires for full operation. --- libvirt.spec.in | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

From: Daniel P. Berrange <berrange@redhat.com>
A number of the libvirt APIs require the use of cgroups. This is not enabled by default on a RHEL6 install. After discussion with cgroups team, it was decided that upon installation of the libvirt RPM, we should automatically turn on the cgroups service. This will activate a default configuration that turns on all cgroups controllers libvirt requires for full operation. --- libvirt.spec.in | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
ACK.
Thanks, pushed. Jirka
participants (3)
-
Eric Blake
-
Jiri Denemark
-
Justin Clift