qemu-kvm/0001-Initial-redhat-build.patch

456 lines
17 KiB
Diff
Raw Normal View History

2018-10-14 17:48:54 +00:00
From f03d3b79bc1908b0b6e257ee7aaa6567ecb91e38 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Mon, 11 Sep 2017 07:11:00 +0200
Subject: Initial redhat build
This patch introduces redhat build structure in redhat subdirectory.
In addition, several issues are fixed in QEMU tree:
- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm
- As we use qemu-kvm as name in all places, this is updated to be consistent
- Man page renamed from qemu to qemu-kvm
- man page is installed using make install so we have to fix it in qemu tree
- Use "/share/qemu-kvm" as SHARE_SUFFIX
- We reconfigured our share to qemu-kvm to be consistent with used name
- Added .gitpublish configuration file
- Support for git publish has to be stored in repository root
Rebase changes (3.0.0):
- python detection changed
- added --disable-debug-mutex
Merged patches (3.0.0):
- 9997a46 Fix annocheck issues
- 35230f9 redhat: remove extra % in rhel_rhev_conflicts macro(
- c747d3f redhat: syncronizing specfile
- e6abfc4 rpm: Add nvme VFIO driver to rw whitelist
- 7043465 rpm: Whitelist copy-on-read block driver
- f9a897c rpm: add throttle driver to rw whitelist
- b9ea80f redhat: replacing %pkname by %name
- eeeea85 redhat: Remove unused ApplyPatch macro
- b42c578 redhat:removing disable code for libcacard
- cee6bd5 redhat: improve packaging layout with modularization of the block layer
- 0cb4c60 redhat: Introducing qemu-kvm-core package
- 1ff4106 Add qemu-keymap to qemu-kvm-common
- 47838a5 redhat: Make gitpublish profile the default one
- a82f87b redhat: s390x: add hpage=1 to kvm.conf
- 3d52169 Enabling vhost_user
- 57aa228 spec: Enable Native Ceph support on all architectures
- 5f9ea03 Thu Jun 21 2018 Danilo C. L. de Paula <ddepaula@redhat.com> - 2.12.0-13.el8
- ed4d62a spec: Fix ambiguous 'python' interpreter name
- 74b3e6c qemu-ga: blacklisting guest-exec and guest-exec-status RPCs
- 2fd2cf7 redhat: rewrap "build_configure.sh" cmdline for the "rh-env-prep" target
- f48dc7f redhat: remove the VTD, LIVE_BLOCK_OPS, and RHV options in local builds too
- ccdf46b redhat: fix the "rh-env-prep" target's dependency on the SRPM_NAME macro
- f258fbf redhat: remove dead code related to s390 (not s390x)
- d186100 redhat: sync compiler flags from the spec file to "rh-env-prep"
- 727aa86 redhat: sync guest agent enablement and tcmalloc usage from spec to local
- b5d47e2 redhat: fix up Python 3 dependency for building QEMU
- 70c64dd redhat: fix up Python dependency for SRPM generation
- 96aca9f redhat: disable glusterfs dependency/support temporarily
- e9aff9d block/vxhs: modularize VXHS via g_module
- ecf40bf Defining a shebang for python scripts
- 55e3177 redhat: changing the prefix and blurb scheme to support rhel8-like handling
- 571e4ac Removing "rh-srpm-rhel" make target
- 9db09ef redhat: enforce python3 usage
- 56cda0b spec: Re-add dependency to seavgabios and ipxe for ppc64 architectures
- c780848 Drop build_configure.sh and Makefile.local files
- cca9118 Fix subject line in .gitpublish
- 9745e27 redhat: Update build configuration
- 193830c redhat: Disable vhost crypto
- 9dc30cb redhat: Make rh-local actually work in a RHEL-8 environment
- 99011c9 redhat: enable opengl, add build and runtime deps
- 7290e3f redhat: Improve python check
---
.gitpublish | 61 +-
Makefile | 3 +-
block/Makefile.objs | 2 +-
block/vxhs.c | 119 ++-
configure | 33 +-
os-posix.c | 2 +-
redhat/.gitignore | 5 +
redhat/85-kvm.preset | 5 +
redhat/95-kvm-memlock.conf | 10 +
redhat/99-qemu-guest-agent.rules | 2 +
redhat/Makefile | 82 ++
redhat/Makefile.common | 47 ++
redhat/bridge.conf | 1 +
redhat/ksm.service | 13 +
redhat/ksm.sysconfig | 4 +
redhat/ksmctl.c | 77 ++
redhat/ksmtuned | 139 ++++
redhat/ksmtuned.conf | 21 +
redhat/ksmtuned.service | 12 +
redhat/kvm-s390x.conf | 19 +
redhat/kvm-setup | 40 +
redhat/kvm-setup.service | 14 +
redhat/kvm-x86.conf | 12 +
redhat/kvm.conf | 3 +
redhat/kvm.modules | 18 +
redhat/qemu-ga.sysconfig | 19 +
redhat/qemu-guest-agent.service | 20 +
redhat/qemu-kvm.spec.template | 1531 ++++++++++++++++++++++++++++++++++++
redhat/qemu-pr-helper.service | 15 +
redhat/qemu-pr-helper.socket | 9 +
redhat/rpmbuild/BUILD/.gitignore | 2 +
redhat/rpmbuild/RPMS/.gitignore | 2 +
redhat/rpmbuild/SOURCES/.gitignore | 2 +
redhat/rpmbuild/SPECS/.gitignore | 2 +
redhat/rpmbuild/SRPMS/.gitignore | 2 +
redhat/scripts/frh.py | 24 +
redhat/scripts/git-backport-diff | 327 ++++++++
redhat/scripts/git-compile-check | 215 +++++
redhat/scripts/process-patches.sh | 92 +++
redhat/scripts/tarball_checksum.sh | 3 +
redhat/vhost.conf | 3 +
ui/vnc.c | 2 +-
42 files changed, 2921 insertions(+), 93 deletions(-)
create mode 100644 redhat/.gitignore
create mode 100644 redhat/85-kvm.preset
create mode 100644 redhat/95-kvm-memlock.conf
create mode 100644 redhat/99-qemu-guest-agent.rules
create mode 100644 redhat/Makefile
create mode 100644 redhat/Makefile.common
create mode 100644 redhat/bridge.conf
create mode 100644 redhat/ksm.service
create mode 100644 redhat/ksm.sysconfig
create mode 100644 redhat/ksmctl.c
create mode 100644 redhat/ksmtuned
create mode 100644 redhat/ksmtuned.conf
create mode 100644 redhat/ksmtuned.service
create mode 100644 redhat/kvm-s390x.conf
create mode 100644 redhat/kvm-setup
create mode 100644 redhat/kvm-setup.service
create mode 100644 redhat/kvm-x86.conf
create mode 100644 redhat/kvm.conf
create mode 100644 redhat/kvm.modules
create mode 100644 redhat/qemu-ga.sysconfig
create mode 100644 redhat/qemu-guest-agent.service
create mode 100644 redhat/qemu-kvm.spec.template
create mode 100644 redhat/qemu-pr-helper.service
create mode 100644 redhat/qemu-pr-helper.socket
create mode 100644 redhat/rpmbuild/BUILD/.gitignore
create mode 100644 redhat/rpmbuild/RPMS/.gitignore
create mode 100644 redhat/rpmbuild/SOURCES/.gitignore
create mode 100644 redhat/rpmbuild/SPECS/.gitignore
create mode 100644 redhat/rpmbuild/SRPMS/.gitignore
create mode 100755 redhat/scripts/frh.py
create mode 100755 redhat/scripts/git-backport-diff
create mode 100755 redhat/scripts/git-compile-check
create mode 100755 redhat/scripts/process-patches.sh
create mode 100755 redhat/scripts/tarball_checksum.sh
create mode 100644 redhat/vhost.conf
diff --git a/Makefile b/Makefile
index 2da686b..eb4c57a 100644
--- a/Makefile
+++ b/Makefile
@@ -501,6 +501,7 @@ CAP_CFLAGS += -DCAPSTONE_HAS_ARM
CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
CAP_CFLAGS += -DCAPSTONE_HAS_X86
+CAP_CFLAGS += -Wp,-D_GLIBCXX_ASSERTIONS
subdir-capstone: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
@@ -819,7 +820,7 @@ install-doc: $(DOCS)
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
ifdef CONFIG_POSIX
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
- $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
+ $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1/qemu-kvm.1"
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
diff --git a/block/Makefile.objs b/block/Makefile.objs
index c8337bf..cd1e309 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -21,7 +21,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 0cb0a00..9164b3e 100644
--- a/block/vxhs.c
+++ b/block/vxhs.c
@@ -9,7 +9,8 @@
*/
#include "qemu/osdep.h"
-#include <qnio/qnio_api.h>
+#include "block/vxhs_shim.h"
+#include <gmodule.h>
#include <sys/param.h>
#include "block/block_int.h"
#include "block/qdict.h"
@@ -59,6 +60,97 @@ 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;
@@ -226,7 +318,7 @@ static void vxhs_refresh_limits(BlockDriverState *bs, Error **errp)
static int vxhs_init_and_ref(void)
{
if (vxhs_ref++ == 0) {
- if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
+ if ((*libvxhs.iio_init)(QNIO_VERSION, vxhs_iio_callback)) {
return -ENODEV;
}
}
@@ -236,7 +328,7 @@ static int vxhs_init_and_ref(void)
static void vxhs_unref(void)
{
if (--vxhs_ref == 0) {
- iio_fini();
+ (*libvxhs.iio_fini)();
}
}
@@ -306,8 +398,17 @@ 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;
}
@@ -392,8 +493,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
/*
* Open qnio channel to storage agent if not opened before
*/
- dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
- cacert, client_key, client_cert);
+ dev_handlep = (*libvxhs.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;
@@ -453,11 +554,11 @@ static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, uint64_t offset,
switch (iodir) {
case VDISK_AIO_WRITE:
- ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
+ ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
offset, size, iio_flags);
break;
case VDISK_AIO_READ:
- ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
+ ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
offset, size, iio_flags);
break;
default:
@@ -506,7 +607,7 @@ static void vxhs_close(BlockDriverState *bs)
* Close vDisk device
*/
if (s->vdisk_hostinfo.dev_handle) {
- iio_close(s->vdisk_hostinfo.dev_handle);
+ (*libvxhs.iio_close)(s->vdisk_hostinfo.dev_handle);
s->vdisk_hostinfo.dev_handle = NULL;
}
@@ -528,7 +629,7 @@ static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
int ret = 0;
void *dev_handle = s->vdisk_hostinfo.dev_handle;
- ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
+ ret = (*libvxhs.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 2a7796e..0314d53 100755
--- a/configure
+++ b/configure
@@ -3460,7 +3460,7 @@ fi
glib_req_ver=2.40
glib_modules=gthread-2.0
-if test "$modules" = yes; then
+if test "$modules" = yes -o "$vxhs" = yes; then
glib_modules="$glib_modules gmodule-export-2.0"
fi
@@ -5435,33 +5435,6 @@ 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
@@ -6759,8 +6732,8 @@ if test "$pthread_setname_np" = "yes" ; then
fi
if test "$vxhs" = "yes" ; then
- echo "CONFIG_VXHS=y" >> $config_host_mak
- echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
+ echo "CONFIG_VXHS=m" >> $config_host_mak
+ echo "VXHS_LIBS= -lssl" >> $config_host_mak
fi
if test "$tcg_interpreter" = "yes"; then
diff --git a/os-posix.c b/os-posix.c
index 9ce6f74..c4cfd0d 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -82,7 +82,7 @@ void os_setup_signal_handling(void)
/* Find a likely location for support files using the location of the binary.
For installed binaries this will be "$bindir/../share/qemu". When
running from the build tree this will be "$bindir/../pc-bios". */
-#define SHARE_SUFFIX "/share/qemu"
+#define SHARE_SUFFIX "/share/qemu-kvm"
#define BUILD_SUFFIX "/pc-bios"
char *os_find_datadir(void)
{
diff --git a/ui/vnc.c b/ui/vnc.c
index 3596932..050c421 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4054,7 +4054,7 @@ void vnc_display_open(const char *id, Error **errp)
trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth);
#ifdef CONFIG_VNC_SASL
- if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
+ if ((saslErr = sasl_server_init(NULL, "qemu-kvm")) != SASL_OK) {
error_setg(errp, "Failed to initialize SASL auth: %s",
sasl_errstring(saslErr, NULL, NULL));
goto fail;
--
1.8.3.1