294 lines
9.2 KiB
Diff
294 lines
9.2 KiB
Diff
|
From 517e4a2f490ff56c8b3fbf9a56c8d4a6e167c2b6 Mon Sep 17 00:00:00 2001
|
||
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||
|
Date: Wed, 29 May 2019 16:09:59 +0100
|
||
|
Subject: [PATCH 1/9] Disable VXHS support
|
||
|
|
||
|
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
||
|
Message-id: <1559146199-30110-1-git-send-email-mrezanin@redhat.com>
|
||
|
Patchwork-id: 88273
|
||
|
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH] Disable VXHS support
|
||
|
Bugzilla: 1714937
|
||
|
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
||
|
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||
|
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||
|
|
||
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||
|
|
||
|
As we ended our partnership with Veritas, we do not support VXHS anymore.
|
||
|
Reverting our downstream changes included in "Initial redhat commit".
|
||
|
|
||
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||
|
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||
|
---
|
||
|
block/Makefile.objs | 2 +-
|
||
|
block/vxhs.c | 119 ++++--------------------------------------
|
||
|
configure | 33 ++++++++++--
|
||
|
redhat/qemu-kvm.spec.template | 11 +---
|
||
|
4 files changed, 41 insertions(+), 124 deletions(-)
|
||
|
|
||
|
diff --git a/block/Makefile.objs b/block/Makefile.objs
|
||
|
index f4cf03b..7a81892 100644
|
||
|
--- a/block/Makefile.objs
|
||
|
+++ b/block/Makefile.objs
|
||
|
@@ -30,7 +30,7 @@ block-obj-$(CONFIG_LIBNFS) += nfs.o
|
||
|
block-obj-$(CONFIG_CURL) += curl.o
|
||
|
block-obj-$(CONFIG_RBD) += rbd.o
|
||
|
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
|
||
|
-#block-obj-$(CONFIG_VXHS) += vxhs.o
|
||
|
+block-obj-$(CONFIG_VXHS) += vxhs.o
|
||
|
block-obj-$(CONFIG_LIBSSH2) += ssh.o
|
||
|
block-obj-y += accounting.o dirty-bitmap.o
|
||
|
block-obj-y += write-threshold.o
|
||
|
diff --git a/block/vxhs.c b/block/vxhs.c
|
||
|
index 3dbb954..2e18229 100644
|
||
|
--- a/block/vxhs.c
|
||
|
+++ b/block/vxhs.c
|
||
|
@@ -9,8 +9,7 @@
|
||
|
*/
|
||
|
|
||
|
#include "qemu/osdep.h"
|
||
|
-#include "block/vxhs_shim.h"
|
||
|
-#include <gmodule.h>
|
||
|
+#include <qnio/qnio_api.h>
|
||
|
#include <sys/param.h>
|
||
|
#include "block/block_int.h"
|
||
|
#include "block/qdict.h"
|
||
|
@@ -60,97 +59,6 @@ typedef struct BDRVVXHSState {
|
||
|
char *tlscredsid; /* tlscredsid */
|
||
|
} BDRVVXHSState;
|
||
|
|
||
|
-#define LIBVXHS_FULL_PATHNAME "/usr/lib64/qemu/libvxhs.so.1"
|
||
|
-static bool libvxhs_loaded;
|
||
|
-static GModule *libvxhs_handle;
|
||
|
-
|
||
|
-static LibVXHSFuncs libvxhs;
|
||
|
-
|
||
|
-typedef struct LibVXHSSymbols {
|
||
|
- const char *name;
|
||
|
- gpointer *addr;
|
||
|
-} LibVXHSSymbols;
|
||
|
-
|
||
|
-static LibVXHSSymbols libvxhs_symbols[] = {
|
||
|
- {"iio_init", (gpointer *) &libvxhs.iio_init},
|
||
|
- {"iio_fini", (gpointer *) &libvxhs.iio_fini},
|
||
|
- {"iio_min_version", (gpointer *) &libvxhs.iio_min_version},
|
||
|
- {"iio_max_version", (gpointer *) &libvxhs.iio_max_version},
|
||
|
- {"iio_open", (gpointer *) &libvxhs.iio_open},
|
||
|
- {"iio_close", (gpointer *) &libvxhs.iio_close},
|
||
|
- {"iio_writev", (gpointer *) &libvxhs.iio_writev},
|
||
|
- {"iio_readv", (gpointer *) &libvxhs.iio_readv},
|
||
|
- {"iio_ioctl", (gpointer *) &libvxhs.iio_ioctl},
|
||
|
- {NULL}
|
||
|
-};
|
||
|
-
|
||
|
-static void bdrv_vxhs_set_funcs(GModule *handle, Error **errp)
|
||
|
-{
|
||
|
- int i = 0;
|
||
|
- while (libvxhs_symbols[i].name) {
|
||
|
- const char *name = libvxhs_symbols[i].name;
|
||
|
- if (!g_module_symbol(handle, name, libvxhs_symbols[i].addr)) {
|
||
|
- error_setg(errp, "%s could not be loaded from libvxhs: %s",
|
||
|
- name, g_module_error());
|
||
|
- return;
|
||
|
- }
|
||
|
- ++i;
|
||
|
- }
|
||
|
-}
|
||
|
-
|
||
|
-static void bdrv_vxhs_load_libs(Error **errp)
|
||
|
-{
|
||
|
- Error *local_err = NULL;
|
||
|
- int32_t ver;
|
||
|
-
|
||
|
- if (libvxhs_loaded) {
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- if (!g_module_supported()) {
|
||
|
- error_setg(errp, "modules are not supported on this platform: %s",
|
||
|
- g_module_error());
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- libvxhs_handle = g_module_open(LIBVXHS_FULL_PATHNAME,
|
||
|
- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
|
||
|
- if (!libvxhs_handle) {
|
||
|
- error_setg(errp, "The VXHS library from Veritas might not be installed "
|
||
|
- "correctly (%s)", g_module_error());
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- g_module_make_resident(libvxhs_handle);
|
||
|
-
|
||
|
- bdrv_vxhs_set_funcs(libvxhs_handle, &local_err);
|
||
|
- if (local_err) {
|
||
|
- error_propagate(errp, local_err);
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- /* Now check to see if the libvxhs we are using here is supported
|
||
|
- * by the loaded version */
|
||
|
-
|
||
|
- ver = (*libvxhs.iio_min_version)();
|
||
|
- if (ver > QNIO_VERSION) {
|
||
|
- error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
|
||
|
- "only %"PRId32" or newer is supported by %s",
|
||
|
- QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- ver = (*libvxhs.iio_max_version)();
|
||
|
- if (ver < QNIO_VERSION) {
|
||
|
- error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
|
||
|
- "only %"PRId32" or earlier is supported by %s",
|
||
|
- QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
|
||
|
- return;
|
||
|
- }
|
||
|
-
|
||
|
- libvxhs_loaded = true;
|
||
|
-}
|
||
|
-
|
||
|
static void vxhs_complete_aio_bh(void *opaque)
|
||
|
{
|
||
|
VXHSAIOCB *acb = opaque;
|
||
|
@@ -318,7 +226,7 @@ static void vxhs_refresh_limits(BlockDriverState *bs, Error **errp)
|
||
|
static int vxhs_init_and_ref(void)
|
||
|
{
|
||
|
if (vxhs_ref++ == 0) {
|
||
|
- if ((*libvxhs.iio_init)(QNIO_VERSION, vxhs_iio_callback)) {
|
||
|
+ if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
|
||
|
return -ENODEV;
|
||
|
}
|
||
|
}
|
||
|
@@ -328,7 +236,7 @@ static int vxhs_init_and_ref(void)
|
||
|
static void vxhs_unref(void)
|
||
|
{
|
||
|
if (--vxhs_ref == 0) {
|
||
|
- (*libvxhs.iio_fini)();
|
||
|
+ iio_fini();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -398,17 +306,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
|
||
|
char *client_key = NULL;
|
||
|
char *client_cert = NULL;
|
||
|
|
||
|
- bdrv_vxhs_load_libs(&local_err);
|
||
|
- if (local_err) {
|
||
|
- error_propagate(errp, local_err);
|
||
|
- /* on error, cannot cleanup because the iio_fini() function
|
||
|
- * is not loaded */
|
||
|
- return -EINVAL;
|
||
|
- }
|
||
|
-
|
||
|
ret = vxhs_init_and_ref();
|
||
|
if (ret < 0) {
|
||
|
- error_setg(&local_err, "libvxhs iio_init() failed");
|
||
|
ret = -EINVAL;
|
||
|
goto out;
|
||
|
}
|
||
|
@@ -493,8 +392,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
|
||
|
/*
|
||
|
* Open qnio channel to storage agent if not opened before
|
||
|
*/
|
||
|
- dev_handlep = (*libvxhs.iio_open)(of_vsa_addr, s->vdisk_guid, 0,
|
||
|
- cacert, client_key, client_cert);
|
||
|
+ dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
|
||
|
+ cacert, client_key, client_cert);
|
||
|
if (dev_handlep == NULL) {
|
||
|
trace_vxhs_open_iio_open(of_vsa_addr);
|
||
|
ret = -ENODEV;
|
||
|
@@ -554,11 +453,11 @@ static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, uint64_t offset,
|
||
|
|
||
|
switch (iodir) {
|
||
|
case VDISK_AIO_WRITE:
|
||
|
- ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
|
||
|
+ ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
|
||
|
offset, size, iio_flags);
|
||
|
break;
|
||
|
case VDISK_AIO_READ:
|
||
|
- ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
|
||
|
+ ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
|
||
|
offset, size, iio_flags);
|
||
|
break;
|
||
|
default:
|
||
|
@@ -607,7 +506,7 @@ static void vxhs_close(BlockDriverState *bs)
|
||
|
* Close vDisk device
|
||
|
*/
|
||
|
if (s->vdisk_hostinfo.dev_handle) {
|
||
|
- (*libvxhs.iio_close)(s->vdisk_hostinfo.dev_handle);
|
||
|
+ iio_close(s->vdisk_hostinfo.dev_handle);
|
||
|
s->vdisk_hostinfo.dev_handle = NULL;
|
||
|
}
|
||
|
|
||
|
@@ -629,7 +528,7 @@ static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
|
||
|
int ret = 0;
|
||
|
void *dev_handle = s->vdisk_hostinfo.dev_handle;
|
||
|
|
||
|
- ret = (*libvxhs.iio_ioctl)(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
|
||
|
+ ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
|
||
|
if (ret < 0) {
|
||
|
trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno);
|
||
|
return -EIO;
|
||
|
diff --git a/configure b/configure
|
||
|
index d6d5912..8cb6740 100755
|
||
|
--- a/configure
|
||
|
+++ b/configure
|
||
|
@@ -3616,7 +3616,7 @@ fi
|
||
|
|
||
|
glib_req_ver=2.40
|
||
|
glib_modules=gthread-2.0
|
||
|
-if test "$modules" = yes -o "$vxhs" = yes; then
|
||
|
+if test "$modules" = yes; then
|
||
|
glib_modules="$glib_modules gmodule-export-2.0"
|
||
|
fi
|
||
|
|
||
|
@@ -5760,6 +5760,33 @@ if compile_prog "" "" ; then
|
||
|
fi
|
||
|
|
||
|
##########################################
|
||
|
+# Veritas HyperScale block driver VxHS
|
||
|
+# Check if libvxhs is installed
|
||
|
+
|
||
|
+if test "$vxhs" != "no" ; then
|
||
|
+ cat > $TMPC <<EOF
|
||
|
+#include <stdint.h>
|
||
|
+#include <qnio/qnio_api.h>
|
||
|
+
|
||
|
+void *vxhs_callback;
|
||
|
+
|
||
|
+int main(void) {
|
||
|
+ iio_init(QNIO_VERSION, vxhs_callback);
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+EOF
|
||
|
+ vxhs_libs="-lvxhs -lssl"
|
||
|
+ if compile_prog "" "$vxhs_libs" ; then
|
||
|
+ vxhs=yes
|
||
|
+ else
|
||
|
+ if test "$vxhs" = "yes" ; then
|
||
|
+ feature_not_found "vxhs block device" "Install libvxhs See github"
|
||
|
+ fi
|
||
|
+ vxhs=no
|
||
|
+ fi
|
||
|
+fi
|
||
|
+
|
||
|
+##########################################
|
||
|
# check for _Static_assert()
|
||
|
|
||
|
have_static_assert=no
|
||
|
@@ -7195,8 +7222,8 @@ elif test "$pthread_setname_np_wo_tid" = "yes" ; then
|
||
|
fi
|
||
|
|
||
|
if test "$vxhs" = "yes" ; then
|
||
|
- echo "CONFIG_VXHS=m" >> $config_host_mak
|
||
|
- echo "VXHS_LIBS= -lssl" >> $config_host_mak
|
||
|
+ echo "CONFIG_VXHS=y" >> $config_host_mak
|
||
|
+ echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
|
||
|
fi
|
||
|
|
||
|
if test "$libpmem" = "yes" ; then
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|