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
};

View File

@@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: libguestfs 1.51.1\n"
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
"component=libguestfs&product=Virtualization+Tools\n"
"POT-Creation-Date: 2023-02-10 11:09+0000\n"
"POT-Creation-Date: 2023-02-16 11:55+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3933,7 +3933,7 @@ msgstr ""
msgid "you must call guestfs_add_drive before guestfs_launch"
msgstr ""
#: lib/launch-direct.c:902 lib/launch-libvirt.c:707
#: lib/launch-direct.c:902 lib/launch-libvirt.c:698
msgid "qemu launched and contacted daemon, but state != READY"
msgstr ""
@@ -3960,25 +3960,20 @@ msgstr ""
msgid "direct mode flag is not supported yet for libvirt backend"
msgstr ""
#: lib/launch-libvirt.c:358
#, c-format
msgid "you must have libvirt >= %d.%d.%d to use the libvirt backend"
msgstr ""
#: lib/launch-libvirt.c:391
#: lib/launch-libvirt.c:382
#, c-format
msgid "could not connect to libvirt (URI = %s)"
msgstr ""
#: lib/launch-libvirt.c:420
#: lib/launch-libvirt.c:411
msgid "could not get libvirt capabilities"
msgstr ""
#: lib/launch-libvirt.c:441
#: lib/launch-libvirt.c:432
msgid "could not get libvirt domain capabilities"
msgstr ""
#: lib/launch-libvirt.c:636
#: lib/launch-libvirt.c:627
msgid ""
"could not create appliance through libvirt.\n"
"\n"
@@ -3988,21 +3983,21 @@ msgid ""
"Original error from libvirt"
msgstr ""
#: lib/launch-libvirt.c:772
#: lib/launch-libvirt.c:763
msgid "unable to parse capabilities XML returned by libvirt"
msgstr ""
#: lib/launch-libvirt.c:778 lib/launch-libvirt.c:880 lib/libvirt-domain.c:397
#: lib/launch-libvirt.c:769 lib/launch-libvirt.c:871 lib/libvirt-domain.c:397
#: lib/libvirt-domain.c:481
msgid "unable to create new XPath context"
msgstr ""
#: lib/launch-libvirt.c:788 lib/launch-libvirt.c:888 lib/launch-libvirt.c:904
#: lib/launch-libvirt.c:779 lib/launch-libvirt.c:879 lib/launch-libvirt.c:895
#, c-format
msgid "unable to evaluate XPath expression: %s"
msgstr ""
#: lib/launch-libvirt.c:827
#: lib/launch-libvirt.c:818
#, c-format
msgid ""
"libvirt hypervisor doesnt support qemu or KVM,\n"
@@ -4017,47 +4012,47 @@ msgid ""
"For further help, read the guestfs(3) man page and libguestfs FAQ."
msgstr ""
#: lib/launch-libvirt.c:874
#: lib/launch-libvirt.c:865
msgid "unable to parse domain capabilities XML returned by libvirt"
msgstr ""
#: lib/launch-libvirt.c:1509 lib/launch-libvirt.c:1767 lib/qemu.c:816
#: lib/launch-libvirt.c:1500 lib/launch-libvirt.c:1758 lib/qemu.c:816
#, c-format
msgid "realpath: could not convert %s to absolute path"
msgstr ""
#: lib/launch-libvirt.c:1592
#: lib/launch-libvirt.c:1583
msgid ""
"libvirt does not support the qemu curl driver protocols (ftp, http, etc.); "
"try setting LIBGUESTFS_BACKEND=direct"
msgstr ""
#: lib/launch-libvirt.c:1982
#: lib/launch-libvirt.c:1973
msgid "could not define libvirt secret"
msgstr ""
#: lib/launch-libvirt.c:1993
#: lib/launch-libvirt.c:1984
msgid "rbd protocol secret must be base64 encoded"
msgstr ""
#: lib/launch-libvirt.c:1997
#: lib/launch-libvirt.c:1988
#, c-format
msgid "base64_decode_alloc: %m"
msgstr ""
#: lib/launch-libvirt.c:2018
#: lib/launch-libvirt.c:2009
msgid "could not set libvirt secret value"
msgstr ""
#: lib/launch-libvirt.c:2031
#: lib/launch-libvirt.c:2022
msgid "could not get UUID from libvirt secret"
msgstr ""
#: lib/launch-libvirt.c:2204
#: lib/launch-libvirt.c:2195
msgid "could not destroy libvirt domain"
msgstr ""
#: lib/launch-libvirt.c:2225 lib/launch-libvirt.c:2258
#: lib/launch-libvirt.c:2216 lib/launch-libvirt.c:2249
#, c-format
msgid "%s: internal error forming error message"
msgstr ""