[libvirt] [PATCH] qemu: configurable VNC port boundaries for domains
by Martin Kletzander
The defines QEMU_VNC_PORT_MIN and QEMU_VNC_PORT_MAX were used to find
free port when starting domains. As this was hardcoded to the same
ports as default VNC servers, there were races with these other
programs. This patch includes the possibility to change the default
starting port as well as the maximum port in qemu config file.
Support for two new config options in qemu.conf is added:
* vnc_port_min (defaults to QEMU_VNC_PORT_MIN and must be >= than this
value)
* vnc_port_max (defaults to QEMU_VNC_PORT_MAX and must be <= than this
value)
---
src/qemu/qemu.conf | 7 +++++++
src/qemu/qemu_command.h | 3 +++
src/qemu/qemu_conf.c | 37 ++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 14 ++++++++------
src/qemu/qemu_process.c | 20 ++++++++++----------
6 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index cb87728..e2f9011 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -11,6 +11,13 @@
#
# vnc_listen = "0.0.0.0"
+# Override the port for creating VNC sessions (min)
+# This defaults to 5900 and increases for consecutive sessions
+# or when ports are occupied, until it hits the maximum.
+#
+#vnc_port_min = 5900
+#vnc_port_max = 65535
+
# Enable this option to have VNC served over an automatically created
# unix socket. This prevents unprivileged access from users on the
# host machine, though most VNC clients do not support it.
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 1eafeb3..f7d2884 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -37,6 +37,9 @@
# define QEMU_VIRTIO_SERIAL_PREFIX "virtio-serial"
# define QEMU_FSDEV_HOST_PREFIX "fsdev-"
+/* These are only defaults, they can be changed now in qemu.conf and
+ * explicitely specified port is checked against these two (makes
+ * sense to limit the values) */
# define QEMU_VNC_PORT_MIN 5900
# define QEMU_VNC_PORT_MAX 65535
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 88a04bc..354d75d 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1,7 +1,7 @@
/*
* qemu_conf.c: QEMU configuration management
*
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -38,6 +38,7 @@
#include "virterror_internal.h"
#include "qemu_conf.h"
+#include "qemu_command.h"
#include "qemu_capabilities.h"
#include "qemu_bridge_filter.h"
#include "uuid.h"
@@ -89,6 +90,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
virReportOOMError();
return -1;
}
+
+ driver->vncPortMin = QEMU_VNC_PORT_MIN;
+ driver->vncPortMax = QEMU_VNC_PORT_MAX;
+
if (!(driver->vncTLSx509certdir = strdup(SYSCONFDIR "/pki/libvirt-vnc"))) {
virReportOOMError();
return -1;
@@ -181,6 +186,36 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
}
}
+ p = virConfGetValue (conf, "vnc_port_min");
+ CHECK_TYPE ("vnc_port_min", VIR_CONF_LONG);
+ if (p) {
+ if (p->l < QEMU_VNC_PORT_MIN) {
+ /* if the port is too low, we can't get the display name
+ * tell to vnc (usually subtract 5900, e.g. localhost:1
+ * for port 5901) */
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: vnc_port_min: port must be greater than or equal to %d"),
+ filename, QEMU_VNC_PORT_MIN);
+ virConfFree(conf);
+ return -1;
+ }
+ driver->vncPortMin = p->l;
+ }
+
+ p = virConfGetValue (conf, "vnc_port_max");
+ CHECK_TYPE ("vnc_port_max", VIR_CONF_LONG);
+ if (p) {
+ if (p->l > QEMU_VNC_PORT_MAX ||
+ p->l <= driver->vncPortMin) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: vnc_port_max: port must be between the minimal port and %d"),
+ filename, QEMU_VNC_PORT_MAX);
+ virConfFree(conf);
+ return -1;
+ }
+ driver->vncPortMax = p->l;
+ }
+
p = virConfGetValue (conf, "vnc_password");
CHECK_TYPE ("vnc_password", VIR_CONF_STRING);
if (p && p->str) {
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 482e6d3..4081887 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -89,6 +89,8 @@ struct qemud_driver {
unsigned int vncSASL : 1;
char *vncTLSx509certdir;
char *vncListen;
+ long vncPortMin;
+ long vncPortMax;
char *vncPassword;
char *vncSASLdir;
unsigned int spiceTLS : 1;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 39b27b1..97ec9b9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -485,11 +485,6 @@ qemudStartup(int privileged) {
if (!qemu_driver->domainEventState)
goto error;
- /* Allocate bitmap for vnc port reservation */
- if ((qemu_driver->reservedVNCPorts =
- virBitmapAlloc(QEMU_VNC_PORT_MAX - QEMU_VNC_PORT_MIN)) == NULL)
- goto out_of_memory;
-
/* read the host sysinfo */
if (privileged)
qemu_driver->hostsysinfo = virSysinfoRead();
@@ -616,6 +611,13 @@ qemudStartup(int privileged) {
}
VIR_FREE(driverConf);
+ /* Allocate bitmap for vnc port reservation. We cannot do this
+ * before the config is loaded properly, since the port numbers
+ * are configurable now */
+ if ((qemu_driver->reservedVNCPorts =
+ virBitmapAlloc(qemu_driver->vncPortMax - qemu_driver->vncPortMin)) == NULL)
+ goto out_of_memory;
+
/* We should always at least have the 'nop' manager, so
* NULLs here are a fatal error
*/
@@ -4692,7 +4694,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
for (i = 0 ; i < def->ngraphics ; i++) {
if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
def->graphics[i]->data.vnc.autoport)
- def->graphics[i]->data.vnc.port = QEMU_VNC_PORT_MIN;
+ def->graphics[i]->data.vnc.port = driver->vncPortMin;
}
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 58ba5bf..712ade1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2417,15 +2417,15 @@ static int qemuProcessNextFreePort(struct qemud_driver *driver,
{
int i;
- for (i = startPort ; i < QEMU_VNC_PORT_MAX; i++) {
+ for (i = startPort ; i < driver->vncPortMax; i++) {
int fd;
int reuse = 1;
struct sockaddr_in addr;
bool used = false;
if (virBitmapGetBit(driver->reservedVNCPorts,
- i - QEMU_VNC_PORT_MIN, &used) < 0)
- VIR_DEBUG("virBitmapGetBit failed on bit %d", i - QEMU_VNC_PORT_MIN);
+ i - driver->vncPortMin, &used) < 0)
+ VIR_DEBUG("virBitmapGetBit failed on bit %ld", i - driver->vncPortMin);
if (used)
continue;
@@ -2447,9 +2447,9 @@ static int qemuProcessNextFreePort(struct qemud_driver *driver,
VIR_FORCE_CLOSE(fd);
/* Add port to bitmap of reserved ports */
if (virBitmapSetBit(driver->reservedVNCPorts,
- i - QEMU_VNC_PORT_MIN) < 0) {
- VIR_DEBUG("virBitmapSetBit failed on bit %d",
- i - QEMU_VNC_PORT_MIN);
+ i - driver->vncPortMin) < 0) {
+ VIR_DEBUG("virBitmapSetBit failed on bit %ld",
+ i - driver->vncPortMin);
}
return i;
}
@@ -2470,11 +2470,11 @@ static void
qemuProcessReturnPort(struct qemud_driver *driver,
int port)
{
- if (port < QEMU_VNC_PORT_MIN)
+ if (port < driver->vncPortMin)
return;
if (virBitmapClearBit(driver->reservedVNCPorts,
- port - QEMU_VNC_PORT_MIN) < 0)
+ port - driver->vncPortMin) < 0)
VIR_DEBUG("Could not mark port %d as unused", port);
}
@@ -3349,7 +3349,7 @@ int qemuProcessStart(virConnectPtr conn,
if (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
!vm->def->graphics[0]->data.vnc.socket &&
vm->def->graphics[0]->data.vnc.autoport) {
- int port = qemuProcessNextFreePort(driver, QEMU_VNC_PORT_MIN);
+ int port = qemuProcessNextFreePort(driver, driver->vncPortMin);
if (port < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Unable to find an unused VNC port"));
@@ -3360,7 +3360,7 @@ int qemuProcessStart(virConnectPtr conn,
int port = -1;
if (vm->def->graphics[0]->data.spice.autoport ||
vm->def->graphics[0]->data.spice.port == -1) {
- port = qemuProcessNextFreePort(driver, QEMU_VNC_PORT_MIN);
+ port = qemuProcessNextFreePort(driver, driver->vncPortMin);
if (port < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
--
1.7.8.6
12 years, 6 months
[libvirt] [PATCH] Fix Win32 build by linking to ole32
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Pushing as a build fix
The CoTaskMemFree function requires the ole32 DLL to be
linked against. Currently this is only done for the
VirtualBox driver. Also add it to libvirt_util.la
* configure.ac: Unconditionally add ole32 DLL to Win32
* src/Makefile.am: Link old32 to libvirt_util.la
---
configure.ac | 14 ++++++++------
src/Makefile.am | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 54f51ee..ac7a137 100644
--- a/configure.ac
+++ b/configure.ac
@@ -554,12 +554,6 @@ AC_DEFINE_UNQUOTED([VBOX_XPCOMC_DIR], ["$vbox_xpcomc_dir"],
[Location of directory containing VirtualBox XPCOMC library])
if test "x$with_vbox" = "xyes"; then
- case "$host" in
- *-*-mingw* | *-*-msvc*) MSCOM_LIBS="-lole32 -loleaut32" ;;
- *) MSCOM_LIBS= ;;
- esac
- AC_SUBST([MSCOM_LIBS])
-
AC_DEFINE_UNQUOTED([WITH_VBOX], 1, [whether VirtualBox driver is enabled])
fi
AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
@@ -2364,16 +2358,23 @@ MINGW_EXTRA_LDFLAGS=
WIN32_EXTRA_CFLAGS=
LIBVIRT_SYMBOL_FILE=libvirt.syms
LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
+MSCOM_LIBS=
case "$host" in
*-*-cygwin*)
CYGWIN_EXTRA_LDFLAGS="-no-undefined"
CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
+ MSCOM_LIBS="-lole32 -loleaut32"
+
if test "x$PYTHON_VERSION" != "x"; then
CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
fi
;;
*-*-mingw*)
MINGW_EXTRA_LDFLAGS="-no-undefined"
+ MSCOM_LIBS="-lole32 -loleaut32"
+ ;;
+ *-*-msvc*)
+ MSCOM_LIBS="-lole32 -loleaut32"
;;
esac
case "$host" in
@@ -2406,6 +2407,7 @@ AC_SUBST([WIN32_EXTRA_CFLAGS])
AC_SUBST([LIBVIRT_SYMBOL_FILE])
AC_SUBST([LIBVIRT_QEMU_SYMBOL_FILE])
AC_SUBST([VERSION_SCRIPT_FLAGS])
+AC_SUBST([MSCOM_LIBS])
dnl Look for windres to build a Windows icon resource.
diff --git a/src/Makefile.am b/src/Makefile.am
index 0574d20..1894262 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -583,7 +583,7 @@ libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
$(DBUS_CFLAGS)
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
- $(RT_LIBS) $(DBUS_LIBS)
+ $(RT_LIBS) $(DBUS_LIBS) $(MSCOM_LIBS)
noinst_LTLIBRARIES += libvirt_conf.la
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH] Fix linking to DTrace probes file
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Pushing as a build-fix
There was no rule forcing libvirt_qemu_probes.o to be built
before libvirt_qemu_probes.lo was used. Also libvirtd was
still referencing the .o file, rather than the .lo file.
Both the .lo and .o file must be listed as DEPENDENCIES,
otherwise libtool will unhelpfully delete the .o file
once the .lo file is created.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
daemon/Makefile.am | 4 ++--
src/Makefile.am | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 5d4c1a7..e049942 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -112,7 +112,7 @@ libvirtd_LDADD = \
$(POLKIT_LIBS)
if WITH_DTRACE_PROBES
-libvirtd_LDADD += ../src/libvirt_probes.o
+libvirtd_LDADD += ../src/libvirt_probes.lo
endif
libvirtd_LDADD += \
@@ -122,7 +122,7 @@ if ! WITH_DRIVER_MODULES
if WITH_QEMU
libvirtd_LDADD += ../src/libvirt_driver_qemu.la
if WITH_DTRACE_PROBES
- libvirtd_LDADD += ../src/libvirt_qemu_probes.o
+ libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
endif
endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 1f98bac..fe86820 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1247,7 +1247,7 @@ libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
if WITH_DTRACE_PROBES
libvirt_la_BUILT_LIBADD += libvirt_probes.lo
-libvirt_la_DEPENDENCIES += libvirt_probes.o
+libvirt_la_DEPENDENCIES += libvirt_probes.lo libvirt_probes.o
nodist_libvirt_la_SOURCES = libvirt_probes.h
if WITH_REMOTE
$(REMOTE_DRIVER_GENERATED): libvirt_probes.h
@@ -1258,7 +1258,7 @@ BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
if WITH_QEMU
libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.lo
nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h
-libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.o
+libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.lo libvirt_qemu_probes.o
$(libvirt_driver_qemu_la_SOURCES): libvirt_qemu_probes.h
endif
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH] docs: typo in acceleration element
by Martin Kletzander
"accel3d" was specified twice, the second one is obviously "accel2d"
---
Pushed under "trivial" rule.
docs/formatdomain.html.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 3875167..5d4cc36 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3098,7 +3098,7 @@ qemu-kvm -net nic,model=? /dev/null
<devices>
<video>
<model type='vga' vram='8192' heads='1'>
- <acceleration accel3d='yes' accel3d='yes'/>
+ <acceleration accel3d='yes' accel2d='yes'/>
</model>
</video>
</devices>
--
1.7.8.6
12 years, 6 months
[libvirt] New Bugzilla components for upstream bug reporting
by Daniel P. Berrange
Historically we have told people to report all upstream bugs against
Product: Virtualization Tools
Component: libvirt
We now provide much more than just the core libvirt package though. Thus
we have created a large number of new components for reporting upstream
bugs against, one for each package we distribute:
Component: libvirt-appdev-guide - Libvirt application development guide
Component: libvirt-glib - Libvirt GLib, GConfig & GObject libraries
Component: libvirt-cim - Libvirt CIM provider
Component: libvirt-csharp - Libvirt C# language bindings
Component: libvirt-java - Libvirt Java language bindings
Component: libvirt-ocaml - Libvirt OCaml language bindings
Component: libvirt-perl - Libvirt Perl language bindings
Component: libvirt-php - Libvirt PHP language bindings
Component: libvirt-publican - Libvirt Publican documentation templates
Component: libvirt-sandbox - Libvirt application sandbox toolkit
Component: libvirt-snmp - Libvirt SNMP agent
Component: libvirt-tck - Libvirt TCK (Technology Compatibility Kit)
Component: libvirt-test-API - Libvirt test API
Component: libvirt-virshcmdref - Libvirt virsh command reference
Component: ruby-libvirt - Libvirt Ruby language bindings
The bug reporting form is here:
https://bugzilla.redhat.com/enter_bug.cgi?product=Virtualization%20Tools
NB, if you are using a binary package provided by your OS vendor, then you
should use their bug tracker for reporting bugs first. Feel free to also
report it to the libvirt upstream bug tracker at the same time though.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
12 years, 6 months
[libvirt] [PATCH] maint: avoid new automake warning about AM_PROG_CC_STDC
by Jim Meyering
When I built libvirt recently, I saw a warning go by:
(with cutting edge automake-1.12a)
configure.ac:83: warning: macro 'AM_PROG_CC_STDC' not found in library
This fixes it:
>From 8f66a7e7f12efa2a60754f06627e94d96030ac78 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Sat, 26 May 2012 11:21:47 +0200
Subject: [PATCH] maint: avoid new automake warning about AM_PROG_CC_STDC
* configure.ac (AM_PROG_CC_STDC): Stop using this macro.
It provokes warnings from newer automake and is superseded by
autoconf's AC_PROG_CC, which we're already using.
---
configure.ac | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 5d06b47..54f51ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,6 @@ dnl Checks for C compiler.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP
-AM_PROG_CC_STDC
gl_EARLY
gl_INIT
--
1.7.10.2.565.gbd578b5
12 years, 6 months
[libvirt] [PATCH] qemu: allow snapshotting of sheepdog and rbd disks
by Josh Durgin
Signed-off-by: Josh Durgin <josh.durgin(a)dreamhost.com>
---
.gnulib | 2 +-
src/qemu/qemu_driver.c | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/.gnulib b/.gnulib
index d5612c7..6b93d00 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit d5612c714c87555f1059d71d347e20271dced322
+Subproject commit 6b93d00f5410ec183e3a70ebf8e418e3b1bb0191
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7e6d59c..fc537df 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9571,12 +9571,18 @@ qemuDomainSnapshotIsAllowed(virDomainObjPtr vm)
* that succeed as well
*/
for (i = 0; i < vm->def->ndisks; i++) {
- if ((vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_LUN) ||
- (vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
- STRNEQ_NULLABLE(vm->def->disks[i]->driverType, "qcow2"))) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK &&
+ (disk->protocol == VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG ||
+ disk->protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD))
+ continue;
+
+ if ((disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) ||
+ (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
+ STRNEQ_NULLABLE(disk->driverType, "qcow2"))) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
_("Disk '%s' does not support snapshotting"),
- vm->def->disks[i]->src);
+ disk->src);
return false;
}
}
--
1.7.5.4
12 years, 6 months
[libvirt] [PATCH 00/10 v2] Enable loadable modules for libvirtd
by Daniel P. Berrange
A simple rebase of
https://www.redhat.com/archives/libvir-list/2012-April/msg00045.html
For a long timer we've had the ability to build each libvirt
driver as a loadable module. We have never used this by default
and as a result it constantly bit-rots.
This series fixes various bugs, and then enables it by default
in configure. It also makes the PRMs use the loadable modules,
adding new new sub-RPMs for each module. We can now finally
install minimal libvirt binaries for each hypervisor.
ie yum install libvirt-daemon-kvm
will not pull in Xen libraries!
Changes in v2:
- Fix build with dtrace
- Rebase to latest GIT master
configure.ac | 20 ++
daemon/Makefile.am | 5
daemon/libvirtd.c | 35 ++++
libvirt.spec.in | 298 +++++++++++++++++++++++++++++++++++++++-
src/Makefile.am | 156 ++++++--------------
src/driver.c | 20 ++
src/driver.h | 1
src/internal.h | 2
src/libvirt.c | 129 +++++------------
src/libvirt_driver_modules.syms | 1
src/libvirt_esx.syms | 7
src/libvirt_openvz.syms | 7
src/libvirt_private.syms | 41 +++++
src/libvirt_probes.d | 21 --
src/libvirt_qemu_probes.d | 21 ++
src/qemu/qemu_monitor.c | 4
src/qemu/qemu_monitor_json.c | 4
src/qemu/qemu_monitor_text.c | 4
tests/Makefile.am | 91 ++++++------
tests/virdrivermoduletest.c | 104 +++++++++++++
20 files changed, 705 insertions(+), 266 deletions(-)
12 years, 6 months
[libvirt] [PATCH] build: silence libtool warning
by Eric Blake
Libtool supports linking directly against .o files on some platforms
(such as Linux), which happens to be the only place where we are
actually doing that (for the dtrace-generated probes.o files). However,
it raises a big stink about the non-portability, even though we don't
attempt it on platforms where it would actually fail:
CCLD libvirt_driver_qemu.la
*** Warning: Linking the shared library libvirt_driver_qemu.la against
the non-libtool
*** objects libvirt_qemu_probes.o is not portable!
This shuts libtool up by creating a proper .lo file that matches
what libtool normally expects.
* src/Makefile.am (%_probes.lo): New rule.
(libvirt_probes.stp, libvirt_qemu_probes.stp): Simplify into...
(%_probes.stp): ...shorter rule.
(CLEANFILES): Clean new .lo files.
(libvirt_la_BUILT_LIBADD, libvirt_driver_qemu_la_LIBADD)
(libvirt_lxc_LDADD, virt_aa_helper_LDADD): Link against .lo file.
* tests/Makefile.am (PROBES_O, qemu_LDADDS): Likewise.
---
I got tired enough of the warning to figure out how to shut it up;
libtool was rather particular about parsing the first two lines of
comments embedded in the .lo file before declaring it to have correct
syntax.
However, I got stumped by the next round of warnings:
CCLD qemuxml2xmltest
*** Warning: Linking the executable qemuxml2xmltest against the loadable module
*** libvirt_driver_qemu.so is not portable!
Anyone have a clue on that one? Would a convenience library be the key?
src/Makefile.am | 28 ++++++++++++++++++----------
tests/Makefile.am | 4 ++--
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index bdb0ef4..0b20f1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1246,7 +1246,7 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
if WITH_DTRACE_PROBES
-libvirt_la_BUILT_LIBADD += libvirt_probes.o
+libvirt_la_BUILT_LIBADD += libvirt_probes.lo
libvirt_la_DEPENDENCIES += libvirt_probes.o
nodist_libvirt_la_SOURCES = libvirt_probes.h
if WITH_REMOTE
@@ -1256,7 +1256,7 @@ endif WITH_REMOTE
BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
if WITH_QEMU
-libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.o
+libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.lo
nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h
libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.o
@@ -1272,6 +1272,15 @@ tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp libvirt_functions.stp
%_probes.o: %_probes.d
$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
+%_probes.lo: %_probes.o
+ $(AM_V_GEN)printf %s\\n \
+ '# $@ - a libtool object file' \
+ '# Generated by libtool (GNU libtool) 2.4' \
+ '# Actually generated by Makefile.am, in order to shut up libtool' \
+ "pic_object='$<'" \
+ "non_pic_object='$<'" \
+ > $@
+
RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
$(srcdir)/rpc/virkeepaliveprotocol.x \
$(srcdir)/remote/remote_protocol.x \
@@ -1280,14 +1289,13 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
$(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
-libvirt_probes.stp: libvirt_probes.d $(srcdir)/dtrace2systemtap.pl
- $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@
-
-libvirt_qemu_probes.stp: libvirt_qemu_probes.d $(srcdir)/dtrace2systemtap.pl
- $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@
+%_probes.stp: %_probes.d $(srcdir)/dtrace2systemtap.pl
+ $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl \
+ $(bindir) $(sbindir) $(libdir) $< > $@
-CLEANFILES += libvirt_probes.h libvirt_probes.o \
+CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
libvirt_qemu_probes.h libvirt_qemu_probes.o \
+ libvirt_qemu_probes.lo\
libvirt_functions.stp libvirt_probes.stp \
libvirt_qemu_probes.stp
endif
@@ -1479,7 +1487,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(RT_LIBS) $(DBUS_LIBS) \
../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES
-libvirt_lxc_LDADD += libvirt_probes.o
+libvirt_lxc_LDADD += libvirt_probes.lo
endif
if WITH_SECDRIVER_SELINUX
libvirt_lxc_LDADD += $(SELINUX_LIBS)
@@ -1524,7 +1532,7 @@ virt_aa_helper_LDADD = \
libvirt_util.la \
../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES
-virt_aa_helper_LDADD += libvirt_probes.o
+virt_aa_helper_LDADD += libvirt_probes.lo
endif
virt_aa_helper_CFLAGS = \
-I$(top_srcdir)/src/conf \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 24818b1..d1106cf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,7 +31,7 @@ endif
PROBES_O =
if WITH_DTRACE_PROBES
-PROBES_O += ../src/libvirt_probes.o
+PROBES_O += ../src/libvirt_probes.lo
endif
LDADDS = \
@@ -295,7 +295,7 @@ if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la
endif
if WITH_DTRACE_PROBES
-qemu_LDADDS += ../src/libvirt_qemu_probes.o
+qemu_LDADDS += ../src/libvirt_qemu_probes.lo
endif
qemu_LDADDS += $(LDADDS)
--
1.7.7.6
12 years, 6 months