Commit Graph

13 Commits

Author SHA1 Message Date
Roman Bogorodskiy
b63c7a0b39 virt-host-validate: fix build with clang
Building with clang 3.8 triggers the following error:

  CC       virt_host_validate-virt-host-validate-qemu.o
virt-host-validate-qemu.c:36:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    char *kvmhint = _("Check that CPU and firmware supports virtualization "
          ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virt-host-validate-qemu.c:46:17: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are "
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Fix by using 'const' for kvmhint declaration.
2016-06-14 08:02:45 +03:00
Riku Voipio
fc1b2428ac virt-host-validate: improve tests for arm/aarch64
ARM/Aarch64 /proc/cpuinfo has no virtualization related flags.
Refactor the Qemu/KVM test a bit:

1) run the "for hardware virtualization" test only on plaforms with known
   cpuinfo flags (x86, s390)
2) test for /dev/kvm also on platforms where no cpu flags are set

Finally Add a more generic error hint message for non-x86 plaforms
when /dev/kvm is missing.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-13 12:50:28 +02:00
Bjoern Walk
71714e8549 tools: virt-host-validate: HW virt support on s390
Extend the detection of hardware virtualization to the s390 platform.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Bjoern Walk
efc23df251 tools: virt-host-validate: improve error handling
When virHostValidateCPUFlag returns NULL, that's more an unexpected
error than the sign of missing CPU flags. Let's react to this
appropriately.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Bjoern Walk
45c2dcfb91 tools: virt-host-validate: fix missing translation marker
Fix a minor typo.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2016-05-04 16:30:30 +02:00
Andrea Bolognani
c661b675f1 host-validate: Improve CPU flags processing
Instead of relying on substring search, tokenize the input
and process each CPU flag separately. This ensures CPU flag
detection will continue to work correctly even if we start
looking for CPU flags whose name might appear as part of
other CPU flags' names.

The result of processing is stored in a virBitmap, which
means we don't have to parse /proc/cpuinfo in its entirety
for each single CPU flag we want to check.

Moreover, use of the newly-introduced virHostValidateCPUFlag
enumeration ensures we don't go looking for random CPU flags
which might actually be simple typos.
2016-04-07 17:31:41 +02:00
Michal Privoznik
d55e11a302 virt-host-validate: Check those CGroups that we actually use
Since the introduction of virt-host-validate tool the set of
cgroup controllers we use has changed so the tool is checking for
some cgroups that we don't need (e.g. net_cls, although I doubt
we have ever used that one) and is not checking for those we
actually use (e.g. cpuset).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-01-25 16:53:18 +01:00
Daniel P. Berrange
9139b46a6b virt-host-validate: check for IOMMU support
This looks for existance of DMAR (Intel) and IVRS (AMD)
files under /sys/firmware/acpi/tables/, as a sign that
the platform has IOMMU present & enabled in the BIOS.

If these are present and /sys/kernel/iommu_groups does
not contain any entries this is taken as a sign that
the kernel has not enabled the IOMMU currently.

If no ACPI tables are found we can't distinguish between
disabled in BIOS and not present in the hardware, so we
have to give the user a generic hint.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-13 10:54:09 +01:00
Daniel P. Berrange
9bf595b172 virt-host-validate: check for required cgroups
Extend the virt-host-validate checks to see if the required
cgroups are compiled into the kernel and that they are
mounted on the system. The cgroups are all optional except
for 3 that LXC mandates

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-12 13:15:00 +01:00
Daniel P. Berrange
fd6d506c50 virt-host-validate: distinguish exists vs accessible for devices
Currently we just check that various devices are accessible.
This leads to inaccurate errors reported for /dev/kvm and
/dev/vhost-net if they exist but an unprivileged user lacks
access. Switch existing checks to look for file existance,
and add a separate check for accessibility of /dev/kvm
since some distros don't grant users access by default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-12 13:15:00 +01:00
Eric Blake
4ecb723b9e maint: fix up copyright notice inconsistencies
https://www.gnu.org/licenses/gpl-howto.html recommends that
the 'If not, see <url>.' phrase be a separate sentence.

* tests/securityselinuxhelper.c: Remove doubled line.
* tests/securityselinuxtest.c: Likewise.
* globally: s/;  If/.  If/
2012-09-20 16:30:55 -06:00
Osier Yang
f9ce7dad60 Desert the FSF address in copyright
Per the FSF address could be changed from time to time, and GNU
recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)

  You should have received a copy of the GNU General Public License
  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

This patch removes the explicit FSF address, and uses above instead
(of course, with inserting 'Lesser' before 'General').

Except a bunch of files for security driver, all others are changed
automatically, the copyright for securify files are not complete,
that's why to do it manually:

  src/security/security_selinux.h
  src/security/security_driver.h
  src/security/security_selinux.c
  src/security/security_apparmor.h
  src/security/security_apparmor.c
  src/security/security_driver.c
2012-07-23 10:50:50 +08:00
Daniel P. Berrange
54a38915d8 Add a virt-host-validate command to sanity check HV config
To assist people in verifying that their host is operating in an
optimal manner, provide a 'virt-host-validate' command. For each
type of hypervisor, it will check any pre-requisites, or other
good recommendations and report what's working & what is not.

eg

  # virt-host-validate
  QEMU: Checking for device /dev/kvm                                         : FAIL (Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization)
  QEMU: Checking for device /dev/vhost                                       : WARN (Load the 'vhost_net' module to improve performance of virtio networking)
  QEMU: Checking for device /dev/net/tun                                     : PASS
   LXC: Checking for Linux >= 2.6.26                                         : PASS

This warns people if they have vmx/svm, but don't have /dev/kvm. It
also warns about missing /dev/vhost net.
2012-01-27 17:53:18 +00:00