[libvirt] [PATCH] wireshark: fix VPATH build
by Pavel Hrdina
Add $(top_builddir) paths to INCLUDES to fix VPATH build.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed under build-breaker rule.
tools/wireshark/src/Makefile.am | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/wireshark/src/Makefile.am b/tools/wireshark/src/Makefile.am
index d4edc65..a7d775f 100644
--- a/tools/wireshark/src/Makefile.am
+++ b/tools/wireshark/src/Makefile.am
@@ -20,9 +20,9 @@
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/gnulib/lib
+ -I$(top_srcdir)/src -I$(top_builddir)/src \
+ -I$(top_srcdir)/include -I$(top_builddir)/include \
+ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
ws_plugin_LTLIBRARIES = libvirt.la
libvirt_la_SOURCES = packet-libvirt.h packet-libvirt.c plugin.c
--
2.0.5
9 years, 8 months
[libvirt] [PATCH v2] rpm-build: use pkg-config to detect wireshark presence
by Pavel Hrdina
Wireshark supports pkg-config since 1.11.3. Right now we build
wireshark-dissectior tool as default trough rpm build only on
fedora >= 21 and there is new wireshark that supports pkg-config.
If someone wants to build libvirt with wireshark-dissector against old
wireshark, they should specify the location by hand.
This patch is mainly to fix wrong dependency on wireshark binary as it
doesn't make sense to require that binary file to just get version info
of that package in makefile.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
configure.ac | 66 ++---------------------------------------
m4/virt-wireshark.m4 | 44 +++++++++++++++++++++++++++
tools/wireshark/src/Makefile.am | 2 +-
3 files changed, 47 insertions(+), 65 deletions(-)
create mode 100644 m4/virt-wireshark.m4
diff --git a/configure.ac b/configure.ac
index 2fedd1a..b5a05bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,6 +247,7 @@ LIBVIRT_CHECK_SELINUX
LIBVIRT_CHECK_SSH2
LIBVIRT_CHECK_SYSTEMD_DAEMON
LIBVIRT_CHECK_UDEV
+LIBVIRT_CHECK_WIRESHARK
LIBVIRT_CHECK_YAJL
AC_MSG_CHECKING([for CPUID instruction])
@@ -2642,70 +2643,6 @@ AM_CONDITIONAL([HAVE_LIBNL], [test "$have_libnl" = "yes"])
AC_SUBST([LIBNL_CFLAGS])
AC_SUBST([LIBNL_LIBS])
-dnl wireshark dissector
-
-AC_ARG_WITH([wireshark-dissector],
- [AS_HELP_STRING([--with-wireshark-dissector],
- [enable wireshark dissector plugin support @<:@default=check@:>@])],
- [ with_wireshark_dissector=$withval ],
- [ with_wireshark_dissector=check ])
-
-AC_DEFUN([LIBVIRT_WS_HANDLE_ERROR], [
- if test "$with_wireshark_dissector" = "yes"; then
- AC_MSG_ERROR([$1])
- else
- with_wireshark_dissector=no
- fi
-])
-if test "$with_wireshark_dissector" != "no"; then
- dnl Check for XDR headers existence
- AC_CHECK_HEADERS([rpc/types.h])
-
- dnl Check for glib-2.0 existence
- PKG_CHECK_MODULES([GLIB], [glib-2.0], [
- WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS `$PKG_CONFIG --cflags glib-2.0`"
- ], [
- LIBVIRT_WS_HANDLE_ERROR([pkg-config 'glib-2.0' is required for wireshark-dissector support])
- ])
-
- dnl Search for wireshark(or tshark) command
- AC_PATH_PROG([WIRESHARK], [wireshark])
- AC_PATH_PROG([WIRESHARK], [tshark])
- if test -z "$WIRESHARK"; then
- LIBVIRT_WS_HANDLE_ERROR([command not found wireshark or tshark])
- else
- dnl Check for wireshark headers
- save_CPPFLAGS="$CPPFLAGS"
- WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS -I`dirname $WIRESHARK`/../include/wireshark"
- CPPFLAGS="$CPPFLAGS $WS_DISSECTOR_CPPFLAGS"
- AC_CHECK_HEADERS([wireshark/config.h],, [
- LIBVIRT_WS_HANDLE_ERROR([wireshark/config.h is required for wireshark-dissector support])
- ])
- AC_CHECK_HEADERS([wireshark/epan/packet.h wireshark/epan/dissectors/packet-tcp.h],, [
- LIBVIRT_WS_HANDLE_ERROR([wireshark/epan/{packet,packet-tcp}.h are required for wireshark-dissector support])
- ], [
- #include <wireshark/config.h>
- ])
- CPPFLAGS="$save_CPPFLAGS"
- fi
- if test "$with_wireshark_dissector" != "no"; then
- with_wireshark_dissector=yes
- fi
-fi
-AC_SUBST([WS_DISSECTOR_CPPFLAGS])
-AM_CONDITIONAL([WITH_WIRESHARK_DISSECTOR], [test "$with_wireshark_dissector" = "yes"])
-
-AC_ARG_WITH([ws-plugindir],
- [AS_HELP_STRING([--with-ws-plugindir],
- [wireshark plugins directory for use when installing wireshark plugin])],
- [ws_plugindir=$withval])
-
-if test "$with_wireshark_dissector" != "no" && test -z "$ws_plugindir"; then
- ws_version=`$WIRESHARK -v | head -1 | cut -f 2 -d' '`
- ws_plugindir="$libdir/wireshark/plugins/$ws_version"
-fi
-AC_SUBST([ws_plugindir])
-
# Check for Linux vs. BSD ifreq members
AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
struct ifreq.ifr_ifindex,
@@ -2937,6 +2874,7 @@ LIBVIRT_RESULT_SELINUX
LIBVIRT_RESULT_SSH2
LIBVIRT_RESULT_SYSTEMD_DAEMON
LIBVIRT_RESULT_UDEV
+LIBVIRT_RESULT_WIRESHARK
LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4
new file mode 100644
index 0000000..47204ed
--- /dev/null
+++ b/m4/virt-wireshark.m4
@@ -0,0 +1,44 @@
+dnl The libvirt.so wireshark plugin
+dnl
+dnl Copyright (C) 2015 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library. If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
+ LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [1.11.3])
+
+ AC_ARG_WITH([ws-plugindir],
+ [AS_HELP_STRING([--with-ws-plugindir],
+ [wireshark plugins directory for use when installing wireshark plugin])],
+ [], [with_ws_plugindir=check])
+
+ dnl Check for system location of wireshark plugins
+ if test "x$with_wireshark_dissector" != "xno" ; then
+ if test "x$with_ws_plugindir" = "xcheck" ; then
+ ws_plugindir="$libdir/wireshark/plugins/$($PKG_CONFIG --modversion wireshark)"
+ elif test "x$with_ws_plugindir" = "xno" || test "x$with_ws_plugindir" = "xyes"; then
+ AC_MSG_ERROR([ws-plugindir must be used only with valid path])
+ else
+ ws_plugindir=$with_ws_plugindir
+ fi
+ fi
+
+ AC_SUBST([ws_plugindir])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_WIRESHARK],[
+ LIBVIRT_RESULT_LIB([WIRESHARK_DISSECTOR])
+])
diff --git a/tools/wireshark/src/Makefile.am b/tools/wireshark/src/Makefile.am
index 61ddb38..d4edc65 100644
--- a/tools/wireshark/src/Makefile.am
+++ b/tools/wireshark/src/Makefile.am
@@ -26,7 +26,7 @@ INCLUDES = \
ws_plugin_LTLIBRARIES = libvirt.la
libvirt_la_SOURCES = packet-libvirt.h packet-libvirt.c plugin.c
-libvirt_la_CPPFLAGS = $(WS_DISSECTOR_CPPFLAGS)
+libvirt_la_CPPFLAGS = $(WIRESHARK_DISSECTOR_CFLAGS)
libvirt_la_LDFLAGS = -avoid-version -module
packet-libvirt.c: packet-libvirt.h libvirt/protocol.h
--
2.0.5
9 years, 8 months
[libvirt] [PATCH] network: Resolve Coverity FORWARD_NULL
by John Ferlan
The following is a long winded way to say this patch is avoiding a
false positive.
Coverity complains that calling networkPlugBandwidth() could eventually
end up with a NULL dereference on iface->bandwidth because in the
networkAllocateActualDevice there's a check of 'iface->bandwidth'
before deciding to try to use the 'portgroup' if it exists or to not
perferm the virNetDevBandwidthCopy if 'bandwidth' is not NULL.
Later in networkPlugBandwidth the 'iface->bandwidth' is sourced from
virDomainNetGetActualBandwidth - which would be either iface->bandwidth
or (preferably) iface->data.network.actual->bandwidth which would have
been filled in from either 'iface->bandwidth' or 'portgroup->bandwidth'
back in networkAllocateActualDevice
There *is* a check in networkCheckBandwidth for the result of the
virDomainNetGetActualBandwidth being NULL and a return 1 based on
that which would cause networkPlugBandwidth to exit properly and thus
never hit the condition that Coverity complains about.
However, since Coverity checks all paths - it somehow believes that
a return of 0 by networkCheckBandwidth in this condition would end
up causing the possible NULL dereference. The "fix" to silence Coverity
is to not have networkCheckBandwidth also call virDomainNetGetActualBandwidth
in order to get the ifaceBand, but rather have it accept it as an argument
which causes Coverity to "see" that it's the exit condition of 1 that won't
have the possible NULL dereference. Since we're passing that, I added the
passing of iface->mac rather than passing iface as well. This just hopefully
makes sure someone doesn't undo this in the future...
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/network/bridge_driver.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index a007388..d885aa9 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3820,7 +3820,7 @@ networkAllocateActualDevice(virDomainDefPtr dom,
(netdef->forward.type == VIR_NETWORK_FORWARD_NAT) ||
(netdef->forward.type == VIR_NETWORK_FORWARD_ROUTE)) {
/* for these forward types, the actual net type really *is*
- *NETWORK; we just keep the info from the portgroup in
+ * NETWORK; we just keep the info from the portgroup in
* iface->data.network.actual
*/
iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
@@ -4593,17 +4593,17 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
*/
static int
networkCheckBandwidth(virNetworkObjPtr net,
- virDomainNetDefPtr iface,
+ virNetDevBandwidthPtr ifaceBand,
+ virMacAddr ifaceMac,
unsigned long long *new_rate)
{
int ret = -1;
virNetDevBandwidthPtr netBand = net->def->bandwidth;
- virNetDevBandwidthPtr ifaceBand = virDomainNetGetActualBandwidth(iface);
unsigned long long tmp_floor_sum = net->floor_sum;
unsigned long long tmp_new_rate = 0;
char ifmac[VIR_MAC_STRING_BUFLEN];
- virMacAddrFormat(&iface->mac, ifmac);
+ virMacAddrFormat(&ifaceMac, ifmac);
if (ifaceBand && ifaceBand->in && ifaceBand->in->floor &&
!(netBand && netBand->in)) {
@@ -4689,7 +4689,8 @@ networkPlugBandwidth(virNetworkObjPtr net,
char ifmac[VIR_MAC_STRING_BUFLEN];
virNetDevBandwidthPtr ifaceBand = virDomainNetGetActualBandwidth(iface);
- if ((plug_ret = networkCheckBandwidth(net, iface, &new_rate)) < 0) {
+ if ((plug_ret = networkCheckBandwidth(net, ifaceBand,
+ iface->mac, &new_rate)) < 0) {
/* helper reported error */
goto cleanup;
}
--
2.1.0
9 years, 8 months
[libvirt] [PATCH] qemu: fix some wrong indentation or types
by Luyao Huang
---
src/qemu/qemu_command.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index aa7a928..02105c3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1683,8 +1683,8 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
*
*/
if (nbuses > 0)
- virDomainPCIAddressBusSetModel(&addrs->buses[0],
- VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT);
+ virDomainPCIAddressBusSetModel(&addrs->buses[0],
+ VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT);
for (i = 1; i < nbuses; i++) {
virDomainPCIAddressBusSetModel(&addrs->buses[i],
VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE);
@@ -4761,7 +4761,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this qemu doesn't support the "
"memory-backend-ram object"));
- goto cleanup;
+ goto cleanup;
}
/* report back that using the new backend is not necessary to achieve
@@ -4967,7 +4967,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
if (qemuBuildDeviceAddressStr(&buf, def, &net->info, qemuCaps) < 0)
goto error;
if (qemuBuildRomStr(&buf, &net->info, qemuCaps) < 0)
- goto error;
+ goto error;
if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
virBufferAsprintf(&buf, ",bootindex=%d", bootindex);
@@ -5512,7 +5512,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
goto error;
if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0)
- goto error;
+ goto error;
if (virBufferCheckError(&buf) < 0)
goto error;
@@ -5577,8 +5577,7 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def,
}
virBufferAsprintf(&buf, "usb-redir,chardev=char%s,id=%s",
- dev->info.alias,
- dev->info.alias);
+ dev->info.alias, dev->info.alias);
if (redirfilter && redirfilter->nusbdevs) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR_FILTER)) {
@@ -9610,7 +9609,7 @@ qemuBuildCommandLine(virConnectPtr conn,
} else {
virCommandAddArg(cmd, "-parallel");
if (!(devstr = qemuBuildChrArgStr(¶llel->source, NULL)))
- goto error;
+ goto error;
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
}
@@ -10558,7 +10557,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("no addresses are suported for isa-serial"));
+ _("no addresses are supported for isa-serial"));
goto error;
}
break;
@@ -10611,7 +10610,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(chr, qemuCaps)))
- goto cleanup;
+ goto cleanup;
break;
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
@@ -11467,7 +11466,7 @@ qemuParseCommandLinePCI(const char *val)
virDomainHostdevDefPtr def = virDomainHostdevDefAlloc();
if (!def)
- goto error;
+ goto error;
if (!STRPREFIX(val, "host=")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -11521,7 +11520,7 @@ qemuParseCommandLineUSB(const char *val)
char *end;
if (!def)
- goto error;
+ goto error;
usbsrc = &def->source.subsys.u.usb;
if (!STRPREFIX(val, "host:")) {
--
1.8.3.1
9 years, 8 months
[libvirt] [PATCH] libxl: fix regression introduced by commit 4ab8cd77
by Jim Fehlig
Commit 4ab8cd77 added a check requiring input devices to have
a bus type of VIR_DOMAIN_INPUT_BUS_USB, failing to start the
domain otherwise. But virDomainDefParseXML adds implicit mouse
and keyboard if a graphics device is configured. See calls to
virDomainDefMaybeAddInput.
The regression is fixed by removing the check requiring USB input
devices, and skipping non-USB input devices when populating USB
'usbdevice' in libxl_domain_build_info struct.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 50ef9d8..2b57d0b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -750,13 +750,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
libxl_defbool_set(&b_info->u.hvm.sdl.enable, 0);
if (def->ninputs) {
- for (i = 0; i < def->ninputs; i++) {
- if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("libxenlight supports only USB input"));
- return -1;
- }
- }
#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
if (VIR_ALLOC_N(b_info->u.hvm.usbdevice_list, def->ninputs+1) < 0)
return -1;
@@ -769,6 +762,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
#endif
for (i = 0; i < def->ninputs; i++) {
char **usbdevice;
+
+ if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB)
+ continue;
+
#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
usbdevice = &b_info->u.hvm.usbdevice_list[i];
#else
--
1.8.4.5
9 years, 8 months
[libvirt] [PATCH] qemu: block-commit: Mark disk in block jobs only on successful command
by Peter Krempa
Patch 51f9f03a4ca50b070c0fbfb29748d49f583e15e1 introduces a regression
where if a blockCommit operation fails the disk is still marked as being
part of a block job but can't be unmarked later.
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7ca993d..4b8e104 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17086,7 +17086,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
goto endjob;
}
- disk->blockjob = true;
+ if (ret == 0)
+ disk->blockjob = true;
if (mirror) {
if (ret == 0) {
--
2.2.2
9 years, 8 months
[libvirt] [PATCH] daemon: avoid memleak when ListAll returns nothing
by Eric Blake
Commit 4f25146 (v1.2.8) managed to silence Coverity, but at the
cost of a memory leak detected by valgrind:
==24129== 40 bytes in 5 blocks are definitely lost in loss record 355 of 637
==24129== at 0x4A08B1C: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24129== by 0x5084B8E: virReallocN (viralloc.c:245)
==24129== by 0x514D5AA: virDomainObjListExport (domain_conf.c:22200)
==24129== by 0x201227DB: qemuConnectListAllDomains (qemu_driver.c:18042)
==24129== by 0x51CC1B6: virConnectListAllDomains (libvirt-domain.c:6797)
==24129== by 0x14173D: remoteDispatchConnectListAllDomains (remote.c:1580)
==24129== by 0x121BE1: remoteDispatchConnectListAllDomainsHelper (remote_dispatch.h:1072)
In short, every time a client calls a ListAll variant and asks
for the resulting list, but there are 0 elements to return, we
end up leaking the 1-entry array that holds the NULL terminator.
What's worse, a read-only client can access these functions in a
tight loop to cause libvirtd to eventually run out of memory; and
this can be considered a denial of service attack against more
privileged clients. Thankfully, the leak is so small (8 bytes per
call) that you would already have some other denial of service with
any guest calling the API that frequently, so an out-of-memory
crash is unlikely enough that this did not warrant a CVE.
* daemon/remote.c (remoteDispatchConnectListAllDomains)
(remoteDispatchDomainListAllSnapshots)
(remoteDispatchDomainSnapshotListAllChildren)
(remoteDispatchConnectListAllStoragePools)
(remoteDispatchStoragePoolListAllVolumes)
(remoteDispatchConnectListAllNetworks)
(remoteDispatchConnectListAllInterfaces)
(remoteDispatchConnectListAllNodeDevices)
(remoteDispatchConnectListAllNWFilters)
(remoteDispatchConnectListAllSecrets)
(remoteDispatchNetworkGetDHCPLeases): Plug leak.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I'm pushing this now, and backporting to stable maintenance
branches, based on review on the libvirt-security list (where
we decided it was not severe enough to need a CVE). I'll be
sending a Libvirt Security Notice about the issue later.
daemon/remote.c | 55 ++++++++++++++++++++++---------------------------------
1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index ff64eeb..fc2237d 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1609,11 +1609,10 @@ remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (doms && ndomains > 0) {
+ if (doms && ndomains > 0)
for (i = 0; i < ndomains; i++)
virObjectUnref(doms[i]);
- VIR_FREE(doms);
- }
+ VIR_FREE(doms);
return rv;
}
@@ -4605,11 +4604,10 @@ remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED,
if (rv < 0)
virNetMessageSaveError(rerr);
virObjectUnref(dom);
- if (snaps && nsnaps > 0) {
+ if (snaps && nsnaps > 0)
for (i = 0; i < nsnaps; i++)
virObjectUnref(snaps[i]);
- VIR_FREE(snaps);
- }
+ VIR_FREE(snaps);
return rv;
}
@@ -4674,11 +4672,10 @@ remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNU
virNetMessageSaveError(rerr);
virObjectUnref(snapshot);
virObjectUnref(dom);
- if (snaps && nsnaps > 0) {
+ if (snaps && nsnaps > 0)
for (i = 0; i < nsnaps; i++)
virObjectUnref(snaps[i]);
- VIR_FREE(snaps);
- }
+ VIR_FREE(snaps);
return rv;
}
@@ -4733,11 +4730,10 @@ remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (pools && npools > 0) {
+ if (pools && npools > 0)
for (i = 0; i < npools; i++)
virObjectUnref(pools[i]);
- VIR_FREE(pools);
- }
+ VIR_FREE(pools);
return rv;
}
@@ -4796,11 +4792,10 @@ remoteDispatchStoragePoolListAllVolumes(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (vols && nvols > 0) {
+ if (vols && nvols > 0)
for (i = 0; i < nvols; i++)
virObjectUnref(vols[i]);
- VIR_FREE(vols);
- }
+ VIR_FREE(vols);
virObjectUnref(pool);
return rv;
}
@@ -4856,11 +4851,10 @@ remoteDispatchConnectListAllNetworks(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (nets && nnets > 0) {
+ if (nets && nnets > 0)
for (i = 0; i < nnets; i++)
virObjectUnref(nets[i]);
- VIR_FREE(nets);
- }
+ VIR_FREE(nets);
return rv;
}
@@ -4915,11 +4909,10 @@ remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (ifaces && nifaces > 0) {
+ if (ifaces && nifaces > 0)
for (i = 0; i < nifaces; i++)
virObjectUnref(ifaces[i]);
- VIR_FREE(ifaces);
- }
+ VIR_FREE(ifaces);
return rv;
}
@@ -4974,11 +4967,10 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (devices && ndevices > 0) {
+ if (devices && ndevices > 0)
for (i = 0; i < ndevices; i++)
virObjectUnref(devices[i]);
- VIR_FREE(devices);
- }
+ VIR_FREE(devices);
return rv;
}
@@ -5033,11 +5025,10 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (filters && nfilters > 0) {
+ if (filters && nfilters > 0)
for (i = 0; i < nfilters; i++)
virObjectUnref(filters[i]);
- VIR_FREE(filters);
- }
+ VIR_FREE(filters);
return rv;
}
@@ -5092,11 +5083,10 @@ remoteDispatchConnectListAllSecrets(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (secrets && nsecrets > 0) {
+ if (secrets && nsecrets > 0)
for (i = 0; i < nsecrets; i++)
virObjectUnref(secrets[i]);
- VIR_FREE(secrets);
- }
+ VIR_FREE(secrets);
return rv;
}
@@ -6264,11 +6254,10 @@ remoteDispatchNetworkGetDHCPLeases(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- if (leases && nleases > 0) {
+ if (leases && nleases > 0)
for (i = 0; i < nleases; i++)
virNetworkDHCPLeaseFree(leases[i]);
- VIR_FREE(leases);
- }
+ VIR_FREE(leases);
virObjectUnref(net);
return rv;
}
--
2.1.0
9 years, 8 months
[libvirt] [PATCH 00/12] More cleanup from IOThreads changes
by John Ferlan
During the review process a few things were pointed at as perhaps
needing some adjustments based on what was done for IOThreads.
Specifically a memory leak in PinVcpuFlags since PinIOThreads was
just a copy of the Vcpu code and secondarily since the IOThreads
code "reused" the virDomainVcpuPin* data structures and API's, those
should change names to be more generic.
John Ferlan (12):
qemu: Fix possible memory leak in qemuDomainPinVcpuFlags
Convert virDomainVcpuPinDefPtr to virDomainPinDefPtr
Convert virDomainPinDefPtr->vcpuid to virDomainPinDefPtr->id
Convert virDomainVcpuPinDefFree to virDomainPinDefFree
Convert virDomainVcpuPinDefArrayFree to virDomainPinDefArrayFree
Convert virDomainVcpuPinDefCopy into virDomainPinDefCopy
Convert virDomainVcpuPinIsDuplicate into virDomainPinIsDuplicate
Convert virDomainVcpuPinFindByVcpu into virDomainPinFindByVcpu
Replace virDomainVcpuPinAdd with virDomainPinAdd
Replace virDomainIOThreadsPinAdd with virDomainPinAdd
Replace virDomainVcpuPinDel with virDomainPinDel
Remove virDomainIOThreadsPinDel
src/conf/domain_conf.c | 234 +++++++++++++++++------------------------------
src/conf/domain_conf.h | 58 +++++-------
src/libvirt_private.syms | 16 ++--
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 18 ++--
src/qemu/qemu_cgroup.c | 12 +--
src/qemu/qemu_cgroup.h | 4 +-
src/qemu/qemu_driver.c | 104 +++++++++++----------
src/qemu/qemu_process.c | 16 ++--
src/xen/xend_internal.c | 10 +-
10 files changed, 204 insertions(+), 270 deletions(-)
--
2.1.0
9 years, 8 months
[libvirt] [PATCHv3.5 0/4] Automaticaly fill <memory> element for NUMA enabled guests
by Peter Krempa
Pavel's series changed few same places thus the previous version no longer applies.
Peter Krempa (4):
conf: Replace access to def->mem.max_balloon with accessor functions
qemu: command: Add helper to align memory sizes
conf: Automatically use NUMA memory size in case NUMA is enabled
conf: Make specifying <memory> optional
docs/schemas/domaincommon.rng | 18 ++---
src/conf/domain_conf.c | 81 +++++++++++++++++++---
src/conf/domain_conf.h | 4 ++
src/hyperv/hyperv_driver.c | 2 +-
src/libvirt_private.syms | 3 +
src/libxl/libxl_conf.c | 2 +-
src/libxl/libxl_driver.c | 8 +--
src/lxc/lxc_cgroup.c | 2 +-
src/lxc/lxc_driver.c | 12 ++--
src/lxc/lxc_fuse.c | 4 +-
src/lxc/lxc_native.c | 4 +-
src/openvz/openvz_driver.c | 2 +-
src/parallels/parallels_driver.c | 2 +-
src/parallels/parallels_sdk.c | 12 ++--
src/phyp/phyp_driver.c | 11 +--
src/qemu/qemu_command.c | 23 +++---
src/qemu/qemu_domain.c | 21 ++++++
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 21 +++---
src/qemu/qemu_hotplug.c | 8 ++-
src/qemu/qemu_process.c | 2 +-
src/test/test_driver.c | 8 +--
src/uml/uml_driver.c | 8 +--
src/vbox/vbox_common.c | 4 +-
src/vmware/vmware_driver.c | 2 +-
src/vmx/vmx.c | 12 ++--
src/xen/xm_internal.c | 14 ++--
src/xenapi/xenapi_driver.c | 2 +-
src/xenapi/xenapi_utils.c | 4 +-
src/xenconfig/xen_common.c | 8 ++-
src/xenconfig/xen_sxpr.c | 9 +--
.../qemuxml2argv-cpu-numa-no-memory-element.args | 7 ++
.../qemuxml2argv-cpu-numa-no-memory-element.xml | 24 +++++++
.../qemuxml2argv-minimal-no-memory.xml | 25 +++++++
.../qemuxml2argv-numatune-memnode.args | 2 +-
tests/qemuxml2argvtest.c | 2 +
.../qemuxml2xmlout-cpu-numa-no-memory-element.xml | 28 ++++++++
tests/qemuxml2xmltest.c | 1 +
38 files changed, 299 insertions(+), 105 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-no-memory-element.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-no-memory-element.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-no-memory.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa-no-memory-element.xml
--
2.2.2
9 years, 8 months
[libvirt] [PATCH] rpm-build: use pkg-config to detect wireshark presence
by Pavel Hrdina
Wireshark supports pkg-config since 1.11.3. Right now we build
wireshark-dissectior tool as default trough rpm build only on
fedora >= 21 and there is newer wireshark that supports pkg-config.
If someone wants to build libvirt with wireshark-dissector against older
wireshark, they should specify the location by hand.
This patch is mainly to fix wrong dependency on wireshark binary as it
doesn't make sense to require that binary file to just get version info
of that package in makefile.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
configure.ac | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2fedd1a..75a0688 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2669,25 +2669,12 @@ if test "$with_wireshark_dissector" != "no"; then
])
dnl Search for wireshark(or tshark) command
- AC_PATH_PROG([WIRESHARK], [wireshark])
- AC_PATH_PROG([WIRESHARK], [tshark])
- if test -z "$WIRESHARK"; then
- LIBVIRT_WS_HANDLE_ERROR([command not found wireshark or tshark])
- else
- dnl Check for wireshark headers
- save_CPPFLAGS="$CPPFLAGS"
- WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS -I`dirname $WIRESHARK`/../include/wireshark"
- CPPFLAGS="$CPPFLAGS $WS_DISSECTOR_CPPFLAGS"
- AC_CHECK_HEADERS([wireshark/config.h],, [
- LIBVIRT_WS_HANDLE_ERROR([wireshark/config.h is required for wireshark-dissector support])
- ])
- AC_CHECK_HEADERS([wireshark/epan/packet.h wireshark/epan/dissectors/packet-tcp.h],, [
- LIBVIRT_WS_HANDLE_ERROR([wireshark/epan/{packet,packet-tcp}.h are required for wireshark-dissector support])
- ], [
- #include <wireshark/config.h>
- ])
- CPPFLAGS="$save_CPPFLAGS"
- fi
+ PKG_CHECK_MODULES([WIRESHARK], [wireshark], [
+ WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS `$PKG_CONFIG --cflags wireshark`"
+ ws_version=`$PKG_CONFIG --modversion wireshark`
+ ], [
+ LIBVIRT_WS_HANDLE_ERROR([pkg-config 'wireshark' is required for wireshark-dissector support])
+ ])
if test "$with_wireshark_dissector" != "no"; then
with_wireshark_dissector=yes
fi
@@ -2701,7 +2688,6 @@ AC_ARG_WITH([ws-plugindir],
[ws_plugindir=$withval])
if test "$with_wireshark_dissector" != "no" && test -z "$ws_plugindir"; then
- ws_version=`$WIRESHARK -v | head -1 | cut -f 2 -d' '`
ws_plugindir="$libdir/wireshark/plugins/$ws_version"
fi
AC_SUBST([ws_plugindir])
--
2.0.5
9 years, 8 months