Since libvirt uses cgroups for various aspects of guest tuning, we need to
make sure that the host is configured with them enabled out of the box.
The libcgroup maintainer has now provided a suitable default config that
mounts them all in /cgroup. So libvirt simply needs to depend on libcgroup
RPM, and turn on the 'cgconfig' initscript at install time if QEMU or LXC
is enabled.
diff -u -r1.81 libvirt.spec
--- libvirt.spec 3 Feb 2010 17:54:54 -0000 1.81
+++ libvirt.spec 9 Feb 2010 12:49:25 -0000
@@ -61,6 +61,7 @@
%define with_udev 0%{!?_without_udev:0}
%define with_hal 0%{!?_without_hal:0}
%define with_yajl 0%{!?_without_yajl:0}
+%define with_cgconfig 0%{!?_without_cgconfig:0}
# Non-server/HV driver defaults which are always enabled
%define with_python 0%{!?_without_python:1}
@@ -147,6 +148,13 @@
%define with_yajl 0%{!?_without_yajl:%{server_drivers}}
%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
@@ -244,6 +252,9 @@
# For multipath support
Requires: device-mapper
%endif
+%if %{with_cgconfig}
+Requires: libcgroup
+%endif
%if %{with_xen}
BuildRequires: xen-devel
%endif
@@ -634,6 +645,12 @@
fi
%endif
+%if %{with_cgconfig}
+if [ "$1" = "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
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|