qemu: Move capability checks for IOMMU features
[libvirt/ericb.git] / tools / virt-host-validate-lxc.c
blob8613f37cc76256dc1e26d721a891d2b05d2c4c74
1 /*
2 * virt-host-validate-lxc.c: Sanity check a LXC hypervisor host
4 * Copyright (C) 2012 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
22 #include <config.h>
24 #include "virt-host-validate-lxc.h"
25 #include "virt-host-validate-common.h"
26 #include "vircgroup.h"
28 int virHostValidateLXC(void)
30 int ret = 0;
32 if (virHostValidateLinuxKernel("LXC", (2 << 16) | (6 << 8) | 26,
33 VIR_HOST_VALIDATE_FAIL,
34 _("Upgrade to a kernel supporting namespaces")) < 0)
35 ret = -1;
37 if (virHostValidateNamespace("LXC", "ipc",
38 VIR_HOST_VALIDATE_FAIL,
39 _("IPC namespace support is required")) < 0)
40 ret = -1;
42 if (virHostValidateNamespace("LXC", "mnt",
43 VIR_HOST_VALIDATE_FAIL,
44 _("Mount namespace support is required")) < 0)
45 ret = -1;
47 if (virHostValidateNamespace("LXC", "pid",
48 VIR_HOST_VALIDATE_FAIL,
49 _("PID namespace support is required")) < 0)
50 ret = -1;
52 if (virHostValidateNamespace("LXC", "uts",
53 VIR_HOST_VALIDATE_FAIL,
54 _("UTS namespace support is required")) < 0)
55 ret = -1;
57 if (virHostValidateNamespace("LXC", "net",
58 VIR_HOST_VALIDATE_WARN,
59 _("Network namespace support is recommended")) < 0)
60 ret = -1;
62 if (virHostValidateNamespace("LXC", "user",
63 VIR_HOST_VALIDATE_WARN,
64 _("User namespace support is recommended")) < 0)
65 ret = -1;
67 if (virHostValidateCGroupControllers("LXC",
68 (1 << VIR_CGROUP_CONTROLLER_MEMORY) |
69 (1 << VIR_CGROUP_CONTROLLER_CPU) |
70 (1 << VIR_CGROUP_CONTROLLER_CPUACCT) |
71 (1 << VIR_CGROUP_CONTROLLER_CPUSET) |
72 (1 << VIR_CGROUP_CONTROLLER_DEVICES) |
73 (1 << VIR_CGROUP_CONTROLLER_FREEZER) |
74 (1 << VIR_CGROUP_CONTROLLER_BLKIO),
75 VIR_HOST_VALIDATE_FAIL) < 0) {
76 ret = -1;
79 #if WITH_FUSE
80 if (virHostValidateDeviceExists("LXC", "/sys/fs/fuse/connections",
81 VIR_HOST_VALIDATE_FAIL,
82 _("Load the 'fuse' module to enable /proc/ overrides")) < 0)
83 ret = -1;
84 #endif
86 return ret;