lib: Get rid of minimum libvirt version check

We require libvirt >= 0.10.2, and we included code to check this at
configure-, compile- and run-time.  Remove the checks at compile and
run time (keep the ./configure check).  Libvirt 0.10.2 was released
over 10 years ago so it's safe to assume that everyone has it by now.
This commit is contained in:
Richard W.M. Jones
2023-02-16 11:24:37 +00:00
parent bbf396fc55
commit b9ccfe3e03
4 changed files with 26 additions and 55 deletions

View File

@@ -44,23 +44,8 @@
*/
typedef struct hash_table Hash_table;
/* Minimum required version of libvirt for the libvirt backend.
*
* This is also checked at runtime because you can dynamically link
* with a different version from what you were compiled with.
*/
#define MIN_LIBVIRT_MAJOR 0
#define MIN_LIBVIRT_MINOR 10
#define MIN_LIBVIRT_MICRO 2 /* XXX patches in > 2 already */
#define MIN_LIBVIRT_VERSION (MIN_LIBVIRT_MAJOR * 1000000 + \
MIN_LIBVIRT_MINOR * 1000 + \
MIN_LIBVIRT_MICRO)
#ifdef HAVE_LIBVIRT
#include <libvirt/libvirt.h>
#if LIBVIR_VERSION_NUMBER >= MIN_LIBVIRT_VERSION
#define HAVE_LIBVIRT_BACKEND
#endif
#endif
/* https://stackoverflow.com/a/1597129 */
@@ -159,7 +144,7 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
* hardware with PCI. Necessary only before libvirt 3.8.0. Refer to
* RHBZ#2034160.
*/
#ifdef HAVE_LIBVIRT_BACKEND
#ifdef HAVE_LIBVIRT
#if defined(__arm__) || defined(__s390x__)
#define VIRTIO_NET_PCI_ADDR ""
#else
@@ -514,7 +499,7 @@ struct guestfs_h {
int ml_debug_calls; /* Extra debug info on each FUSE call. */
#endif
#ifdef HAVE_LIBVIRT_BACKEND
#ifdef HAVE_LIBVIRT
/* Used by lib/libvirt-auth.c. */
#define NR_CREDENTIAL_TYPES 9
unsigned int nr_supported_credentials;
@@ -783,7 +768,7 @@ extern void guestfs_int_cleanup_cmd_close (struct command **);
/* launch-*.c constructors */
void guestfs_int_init_direct_backend (void) __attribute__((constructor));
#ifdef HAVE_LIBVIRT_BACKEND
#ifdef HAVE_LIBVIRT
void guestfs_int_init_libvirt_backend (void) __attribute__((constructor));
#endif

View File

@@ -71,7 +71,7 @@
#endif
/* End of fixes for Mac OS X */
#ifdef HAVE_LIBVIRT_BACKEND
#ifdef HAVE_LIBVIRT
#ifndef HAVE_XMLBUFFERDETACH
/* Added in libxml2 2.8.0. This is mostly a copy of the function from
@@ -352,15 +352,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
data->libvirt_version.v_major,
data->libvirt_version.v_minor,
data->libvirt_version.v_micro);
if (!guestfs_int_version_ge (&data->libvirt_version,
MIN_LIBVIRT_MAJOR, MIN_LIBVIRT_MINOR,
MIN_LIBVIRT_MICRO)) {
error (g, _("you must have libvirt >= %d.%d.%d "
"to use the libvirt backend"),
MIN_LIBVIRT_MAJOR, MIN_LIBVIRT_MINOR, MIN_LIBVIRT_MICRO);
return -1;
}
guestfs_int_launch_send_progress (g, 0);
/* Create a random name for the guest. */
@@ -2305,4 +2296,4 @@ guestfs_int_init_libvirt_backend (void)
guestfs_int_register_backend ("libvirt", &backend_libvirt_ops);
}
#endif /* HAVE_LIBVIRT_BACKEND */
#endif /* HAVE_LIBVIRT */

View File

@@ -420,7 +420,7 @@ guestfs_int_set_backend (guestfs_h *g, const char *method)
void *
guestfs_int_force_load_backends[] = {
guestfs_int_init_direct_backend,
#ifdef HAVE_LIBVIRT_BACKEND
#ifdef HAVE_LIBVIRT
guestfs_int_init_libvirt_backend,
#endif
};