Commit Graph

242 Commits

Author SHA1 Message Date
Thomas Huth
6a7b8a3c0f meson.build: Remove the -Wvla-larger-then flag
The flag has a typo in it, it's "...-than=..." and not "...-then=...",
so this was in fact never used. Since we're also using -Wvla (without
size), we should already get warnings about any variable length arrays
anyway, so the additional "-Wvla-larger-than" does not make much sense
and thus we can simply drop this.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-06-08 13:59:43 +02:00
William Douglas
56fbabf1a1 Add basic driver for the Cloud-Hypervisor
Cloud-Hypervisor is a KVM virtualization using hypervisor. It
functions similarly to qemu and the libvirt Cloud-Hypervisor driver
uses a very similar structure to the libvirt driver.

The biggest difference from the libvirt perspective is that the
"monitor" socket is seperated into two sockets one that commands are
issued to and one that events are notified from. The current
implementation only uses the command socket (running over a REST API
with json encoded data) with future changes to add support for the
event socket (to better handle shutdowns from inside the VM).

This patch adds support for the following initial VM actions using the
Cloud-Hypervsior API:
 * vm.create
 * vm.delete
 * vm.boot
 * vm.shutdown
 * vm.reboot
 * vm.pause
 * vm.resume

To use the Cloud-Hypervisor driver, the v15.0 release of
Cloud-Hypervisor is required to be installed.

Some additional notes:
 * The curl handle is persistent but not useful to detect ch process
 shutdown/crash (a future patch will address this shortcoming)
 * On a 64-bit host Cloud-Hypervisor needs to support PVH and so can
 emulate 32-bit mode but it isn't fully tested (a 64-bit kernel and
 32-bit userspace is fine, a 32-bit kernel isn't validated)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-06-04 10:56:06 +01:00
Andrea Bolognani
b1774e4e0f meson: Style tweaks
These checks look different than most similar ones for no
particular reason.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
2a38cc59e3 meson: Switch to autodetection for driver_test
Match the behavior of most other features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
83ff55b5a2 meson: Switch to autodetection for driver_remote
Match the behavior of most other features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
08c13484da meson: Turn apparmor_profiles into a feature
Similar knobs, such as firewalld_zone and sysctl_config, are
already features, so convert this one as well to comply with
expectations.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
090e8076a9 meson: Rewrite apparmor_profiles check
Attempting to enable apparmor_profiles when apparmor support
is not enabled should result in an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
fe7c07adac meson: Use dependency() when possible
This is the preferred way to figure out whether a library is
available, and for the most part we can just adopt it right
away; in a few cases, unfortunately, we're stuck with using
cc.find_library() until further down the road, when all our
target platforms ship with pkg-config enabled versions of the
various libraries.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
f5298b8589 meson: Rewrite libacl check
libacl is Linux-only, so we don't need to explicitly check for
either the target platform or header availability, and we can
simply rely on cc.find_library() instead. The corresponding
preprocessor define is renamed to more accurately reflect the
nature of the check.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
b6b7897ce8 meson: Fix firewalld check
firewalld is Linux-only, so it should be disabled by default
everywhere else and attempts to explicitly enable firewalld
support on non-Linux targets should result in an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:32:02 +02:00
Andrea Bolognani
a755b74088 meson: Rewrite firewalld check
This makes it possible to explicitly disable firewalld support
regardless of the platform that's being targeted.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:31:57 +02:00
Andrea Bolognani
48fc84a22c meson: Fix disabling netcf
If the feature is disabled, the corresponding flags should not
show up in the compiler command line.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
cc883e1c0c meson: Tweak XDR check
Keep all the platform-specific code in one place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
626303c6fa meson: Rewrite polkit check
The new version will report an error if the user asks for
polkit support to be enabled on Windows instead of silently
ignoring such requests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
d20685c259 meson: Fix sanlock detection
If the user explicitly asked for sanlock support to be enabled,
then failure to find the corresponding library should result in
an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
6f25a5ac8a meson: Fix vstorage detection
We're supposed to error out if the user has explicitly asked
for vstorage support to be enabled and that can't be done, but
we've been looking at the wrong option.

Fixes: 2127d53f2f
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
1834e17097 meson: Drop numactl_version
It's not used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
a608ec8ccd meson: Make libm a required dependency
We use it unconditionally.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
70670d4af7 meson: Use built-in pcap detection
Meson already knows how to look for pcap using pkg-config
first, and falling back to pcap-config if that didn't work.

https://mesonbuild.com/Dependencies.html#pcap

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
c32c5ca29a meson: Use get_pkgconfig_variable('cflags')
Meson offers a native convenience method that can be used to
fetch pkg-config variables from a dependency, so we can use
that instead of calling pkg-config manually.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
5ca06d703b meson: Drop netinet workaround
It appears to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
ce72f0e37b meson: Drop curl workaround
It appears to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
d3fb78f8b3 meson: Don't use 'required: true'
It's the default.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Andrea Bolognani
cfef539743 meson: Whitespace tweaks
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-06-01 14:30:39 +02:00
Jiri Denemark
a2d57d49d7 Post-release version bump to 7.5.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-06-01 12:05:41 +02:00
Andrea Bolognani
cd76a97aa6 meson: Add yajl kludge
If this looks familiar, that's because it's literally *the
same code* that we used to work around *the same issue* in
readline before 1635dca26f :)

Note that the issue only really affects people building from
source on Apple Silicon: on Intel, Homebrew installs header
files under directories that are part of the default search
path, which explains why our CI pipeline never ran into it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
2021-05-18 15:19:47 +02:00
Michal Privoznik
e0c6691e78 meson: Declare GLIB_VERSION_* macros at configure
So far we have three places where glib version is recorded:
meson.build and then in config.h. The latter is so well hidden
that it's easy to miss when bumping minimal glib version in the
former. With a bit of python^Wmeson string magic
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED macros can
be defined to match glib_version from meson.build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 12:08:26 +02:00
Jiri Denemark
f953e37846 Post-release version bump to 7.4.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-05-03 11:08:50 +02:00
Daniel P. Berrangé
3c3c55be66 meson: don't probe for -Werror if --werror is enabled
Meson has its own mechanism to turn on -Werror with the --werror option.
If this is set, then there is no reason for libvirt to check for -Werror
itself.

We remove the summary line output because it is potentially misleading
when libvirt hasn't enabled -Werror, but meson has.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:13:56 +01:00
Daniel P. Berrangé
a9461d456c meson: honour meson warning_level option
Meson defines a warning_level option which has the following behaviour
with C code

 0:  no warning flags
 1: -Wall
 2: -Wall -Wextra
 3: -Wall -Wextra -Wpedantic

Currently we add our extra warning flags unconditionally if the compiler
supports them, regardless of the meson warning_level setting. This has
effectively nullified the warning_level setting in meson, and also
results in meson printing these messages:

  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".

Semantically we can think of our huge list of flags as being an "extra"
set of warnings, and thus we ought to only add them when meson would
itself use -Wextra. aka warning_level == 2 or 3.

In practice libvirt code can't be built with -Wpedantic so we can ignore
meson warning_level 3, and only add our flags when warning_level==2.

In doing this change, we no longer have to check -Wall/-Wextra ourselves
as we can assume meson already set them.

-W is an alias of -Wextra so it is removed too.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
8f28944fd5 meson: avoid checking compiler flags twice
In several cases we check if a compiler flag is supported, and then add
it to the 'cc_flags' array. The entire 'cc_flags' array is then later
tested to see if each flag is supported, which duplicates the check in
some cases.

Move the check of cc_flags earlier, and for the extra flags append
directly to supported_cc_flags to avoid the duplicate check

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
8394f08e9d meson: merge all cc_flags arrays into one
The split of arrays is fairly arbitrary and a hang over from the way we
had to structure lists of flags when we used GNULIB's compiler flag
checking m4 logic.

The separate lists leads to cases where we enable a flag in one list and
have contradictory setting in another list, which leads to confusion.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
2e85a83abe meson: remove obsolete comment about stack frame size
The virStrerror function no longer exists in libvirt so is not a
constraint. At the current stack limit of 4k, and default Linux
stack size of 8 MB, we have a recursion limit of 2048 in the
absolute worst case, and much higher in common case. Even with
smaller stack sizes, we're going to be fine as we don't deeply
recurse in code.

Thus it is not worth spending effort to optimize below our current
4k worst case limit. Removing the comment will stop encouraging
people to spend time on this in future.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
36489081b0 meson: actually check for -Wframe-larger-than
All other warning flags are checked for compiler support, so we
shouldn't blindly assume this one always exists.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:52 +01:00
Daniel P. Berrangé
a0e5aca072 meson: get rid of list of unused warning flags
We're not using these warning flags with libvirt, and it is not worth
keeping them just to issue a warning if someone tries to enable them.
If someone does try to enable them, either libvirt will build cleanly
or it won't.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:52 +01:00
Pavel Hrdina
7e88184b8e meson: don't check collie as program for sheepdog
Upstream sheepdog changed collie to dog back in 2013 in version 0.7.0.
Looking into repology that version is no longer used by any distribution
supported by libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-21 14:19:54 +02:00
Andrea Bolognani
1635dca26f meson: Drop readline kludge
Both FreeBSD ports and Homebrew on macOS have readline 8.1 now,
and that version contains a correct pkg-config file so the kludge
is no longer necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-12 09:55:27 +02:00
Olaf Hering
2fc3a704e7 libxl: use API 4.13 to support domUs with more than 4TB
To support domUs with more than 4TB memory it is required to use
LIBXL_API_VERSION >= 0x040800, which uses uint64_t for certained guest
memory related quantities.

Unfortunately this change is not straight forward. While most of the
code in libxl.h handles the various LIBXL_API_VERSION variants
correctly, the check for valid a LIBXL_API_VERSION at the beginning of
the file was broken between Xen 4.7 and 4.13 - it did not cover for
API changes introduced in Xen 4.7 and 4.8. This was fixed with
xen-project/xen@c3999835df, which for libvirt means in practice either
the libxl API from Xen 4.5 or 4.13+ can be used.

This change uses pkgconfig to decide which API can be safely selected.
Xen provides a pkgconfig file since Xen 4.6, which is also the lowest
version expected by libvirt.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Jiri Denemark
caaadd28a1 Post-release version bump to 7.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-04-01 12:21:23 +02:00
Daniel P. Berrangé
695bdb3841 src: ensure GSource background unref happens in correct event loop
The g_idle_add function adds a callback to the primary GMainContext.

To workaround the GSource unref bugs, we need to add our callbacks
to the GMainContext that is associated with the GSource being
unref'd. Thus code using the per-VM virEventThread must use its
private GMainContext.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-17 09:16:05 +00:00
Michal Privoznik
53454b7b34 meson: Don't check for addr2line
In the past, we used to have this oomtrace.pl script that
attempted to print the stack trace of where an OOM error
occurred and it used addr2line for that. But since v5.8.0-rc1~189
we don't really care about OOM anymore and the script is long
gone so there's no need to check for addr2line program either.

Fixes: 2c52ecd960
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-03-15 20:37:51 +01:00
Chris Mayo
ee4a392dda meson: Add documentation installation directory option
Allow the directory to be chosen at installation time, to support local
conventions e.g. versioning.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-03-09 12:13:38 +01:00
Martin Kletzander
8964564550 util: Move glib event loop workaround to glibcompat
This way it can be used from other places as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-05 10:17:26 +01:00
Jim Fehlig
9386eadad4 build: Require glib >= 2.56
There are a few uses of g_autoslist in the qemu driver and likely more
will come throughout the codebase in the future. g_autoslist first
appeared in glib 2.56, so bump the minimum version

https://developer.gnome.org/glib/stable/glib-Miscellaneous-Macros.html#g-autoslist

Bumping the minimum version is an opportune time to update the list of
minimum glib versions found on the distros targeted by libvirt's
platform support policy

   RHEL-7: 2.56.1
   RHEL-8: 2.56.4
   Debian (Buster): 2.58.3
   OpenBSD (Ports): 2.66.7
   FreeBSD (Ports): 2.66.7
   openSUSE Leap 15.2, SLE15-SP2: 2.62.6
   Ubuntu (Bionic): 2.56.1
   macOS (Homebrew): 2.66.7

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-03-04 10:32:45 -07:00
Jiri Denemark
62bd8833db Post-release version bump to 7.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-03-01 11:58:58 +01:00
Michal Privoznik
1f8e6a6172 esx: Bump minimal version of curl
According to meson.build the minimal version of curl needed is
7.18.0 which was released in January 2008. If the minimal version
is bumped to 7.19.1 (released in November 2008) we can drop some
workarounds because this newer version provides APIs we need.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-02-17 10:21:26 +01:00
Andrea Bolognani
82ffb81c9c cpu: Only include <sys/auxv.h> if available
This header is not present on several non-Linux targets that
nonetheless support aarch64.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-02-09 09:14:05 +01:00
Laine Stump
06169a115d build: support explicitly disabling netcf
placing "-Dnetcf=disabled" on the meson commandline was ignored,
meaning that even with that option the build would get WITH_NETCF if
the netcf-devel package was found - the only way to disable it was to
uninstall netcf-devel.

This patch adds the small bit of logic to check the netcf meson
commandline option (in addition to whether netcf-devel is installed)
before defining WITH_NETCF.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-31 02:43:31 -05:00
Helmut Grohne
44b348134c meson: Fix cross-building of dtrace probes
dtrace invokes the C compiler, so when cross-building we need
to make sure that $CC is set in the environment and that it
points to the cross-compiler rather than the native one.

Until https://github.com/mesonbuild/meson/issues/266
is addressed, the workaround is to call dtrace via env(1).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980334

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-26 10:59:45 +01:00
Nikolay Shirokovskiy
2127d53f2f meson: build vstorage only on linux
This should fix CI error:

    ../dist-unpack/libvirt-7.1.0/src/storage/storage_backend_vstorage.c:10:10: fatal error: 'mntent.h' file not found
    #include <mntent.h>
    ^~~~~~~~~~

on freebsd and mac.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-19 20:25:42 +03:00