[libvirt] [libvirt-java] [PATCH 0/2] Ensure JNA callbacks cannot be GCed
by Chris Ellis
Hi.
This is a small patch set to fix a few issues I've discovered while testing Claudio's patch set.
The first patch is trivial, it adds the ConnectionCloseListener interface and corresponding
enum, which were missing.
The second patch ensures that the JNA callbacks cannot be garbage collected whilst still
registered with the libvirt C library. Durring testing, I was finding that events would
stop working. Wireshark showed the remote daemon sending the event and some time spent
tracing through the libvirt calls led me to discover that the JNA callback objects were
being GCed. The JNA documentation states that a reference to the Callback object must be
held whilst it is in use by the C layer. This patch updates the map of event listeners
to also hold a reference to the callback object.
Regards,
Chris
Chris Ellis (2):
Add close listener types
Ensure JNA callbacks cannot get GCed
src/main/java/org/libvirt/Connect.java | 37 ++++++++++++++--------
.../org/libvirt/event/ConnectionCloseListener.java | 9 ++++++
.../org/libvirt/event/ConnectionCloseReason.java | 8 +++++
3 files changed, 41 insertions(+), 13 deletions(-)
create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseListener.java
create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseReason.java
--
1.8.4.5
11 years, 1 month
[libvirt] question for <interface> in ethernet type and multiple queues in KVM (start VM failed)
by Wangrui (K)
Hi,
I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such
<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>
tap_mq is a tap device with multi_queue property which was created on host by ip command, such as follows
#ip tuntap add tap_mq mode tap multi_queue
I want to use multiple queue feature for this vif so I set queues='2' in xml.
When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not supported for: ethernet".
This error is reported from function qemuBuildInterfaceCommandLine
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
return -1;
}
The comment specifies that only TAP device supports multiqueue. But VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.
IMHO, libvirt can build qemu commandline as
"-device virtio-net,netdev=net1,mq=on,vectors=5,mac=52:54:00:19:9e:4e"
"-netdev type=tap,ifname=tap0,id=net1,vhost=on,vhostforce=on,queues=2".
Qemu can open tapfds and vhostfds by itself other than libvirt opens and transfers them to qemu in this case.
Or there's other way to use multiqueue feature in ethernet tpye ?
Regards,
Rui
11 years, 1 month
[libvirt] [PATCH] maint: use $(SED) instead of sed for syntax-check
by Roman Bogorodskiy
Some syntax-check rules use GNU sed specific regexps, so allow
to override which sed would be used to fix 'syntax-check' for
non GNU-userland systems.
---
cfg.mk | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 207dfeb..bd984bd 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -614,7 +614,7 @@ sc_libvirt_unmarked_diagnostics:
$(_sc_search_regexp)
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
- | sed 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
+ | $(SED) 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
| grep '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
@@ -639,7 +639,7 @@ sc_prohibit_newline_at_end_of_diagnostic:
sc_prohibit_diagnostic_without_format:
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
- | sed -rn -e ':l; /[,"]$$/ {N;b l;}' \
+ | $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \
-e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
-e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
| grep -vE 'VIR_ERROR' && \
@@ -661,7 +661,7 @@ sc_prohibit_useless_translation:
# or \n on one side of the split.
sc_require_whitespace_in_translation:
@grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \
- | sed -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
+ | $(SED) -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
-e '/_(.*[^\ ]""[^\ ]/p' | grep . && \
{ echo '$(ME): missing whitespace at line split' 1>&2; \
exit 1; } || :
@@ -681,11 +681,11 @@ sc_preprocessor_indentation:
sc_spec_indentation:
@if cppi --version >/dev/null 2>&1; then \
for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \
- sed -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
+ $(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
-e 's/%\(else\|endif\|define\)/#\1/' \
-e 's/^\( *\)\1\1\1#/#\1/' \
-e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
- | cppi -a -c 2>&1 | sed "s|standard input|$$f|"; \
+ | cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \
done | { if grep . >&2; then false; else :; fi; } \
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
exit 1; }; \
@@ -777,7 +777,7 @@ sc_prohibit_cross_inclusion:
# elements added to the enum by using a _LAST marker.
sc_require_enum_last_marker:
@grep -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT)) \
- | sed -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \
+ | $(SED) -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \
-e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
-e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
| grep . && \
@@ -878,7 +878,7 @@ ifeq (0,$(MAKELEVEL))
# b653eda3ac4864de205419d9f41eec267cb89eeb
#
# Keep this logic in sync with autogen.sh.
- _submodule_hash = sed 's/^[ +-]//;s/ .*//'
+ _submodule_hash = $(SED) 's/^[ +-]//;s/ .*//'
_update_required := $(shell \
cd '$(srcdir)'; \
test -d .git || { echo 0; exit; }; \
--
1.8.4.3
11 years, 1 month
[libvirt] [PATCH] qemu: remove redundant virQEMUDriverGetConfig
by Tomoki Sekiyama
qemuDomainSetSchedulerParametersFlags() calls virQEMUDriverGetConfig() twice
and makes the reference counter leak. This removes redundant call.
---
src/qemu/qemu_driver.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 76f789e..ca971f3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9050,7 +9050,6 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
- cfg = virQEMUDriverGetConfig(driver);
if (!cfg->privileged) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("CPU tuning is not available in session mode"));
11 years, 1 month
[libvirt] [PATCH 0/3] Resolve recent/new Coverity warnings
by John Ferlan
For virlog.c and commandtest.c - it seems recent changes within the
modules have allowed Coverity to dig deeper and find different issues.
Not sure why Coverity has that "ability"... Since I was making changes,
figured I'd clean up the lxc_controller fd leak as well - these should
clean the Jenkins build environment.
John Ferlan (3):
Coverity: Resolve a CHECKED_RETURN message
Coverity: Resolve a FORWARD_NULL
Coverity: Resolve a RESOURCE_LEAK
src/lxc/lxc_controller.c | 14 ++++++++++----
src/util/virlog.c | 2 +-
tests/commandtest.c | 1 +
3 files changed, 12 insertions(+), 5 deletions(-)
--
1.8.5.3
11 years, 1 month
[libvirt] [libvirt-java] [PATCH] Set Java source level in pom
by Chris Ellis
Hi
Simple patch to set the Java source level within the pom, this makes it
easier to import the project into Eclipse. I've also added an ignore for
a local pom file.
I've added plugins to publish the sources and javadocs into Maven. This
allows Maven (and IDE integration) to automatically use the javadocs and
source. This should make life easier for users of libvirt-java.
Regards,
Chris
Chris Ellis (1):
Update pom to include Java source level
.gitignore | 1 +
pom.xml.in | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
--
1.8.4.5
11 years, 1 month
[libvirt] [PATCHv2 0/2] Fix zero cpu shares handling
by Ján Tomko
Treat 0 as a valid value for cputune shares.
v1: https://www.redhat.com/archives/libvir-list/2014-March/msg00215.html
v2:
squashed the fixup that was sent as a separate patch to the first commit
and fixed two more occurences (one of them pointed out by Martin)
Ján Tomko (2):
Treat zero cpu shares as a valid value
Show the real cpu shares value in live xml
src/conf/domain_conf.c | 12 ++++----
src/conf/domain_conf.h | 1 +
src/lxc/lxc_cgroup.c | 13 ++++++--
src/lxc/lxc_driver.c | 8 ++++-
src/lxc/lxc_native.c | 8 +++--
src/parallels/parallels_driver.c | 1 +
src/qemu/qemu_cgroup.c | 14 ++++++---
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 13 ++++++--
src/vmx/vmx.c | 3 +-
.../qemuxml2argv-cputune-zero-shares.args | 5 ++++
.../qemuxml2argv-cputune-zero-shares.xml | 35 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmltest.c | 1 +
14 files changed, 97 insertions(+), 20 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml
--
1.8.3.2
11 years, 1 month
[libvirt] [libivrt][RFC]Send "netdev_del" command after receive the DEVICE_DELETED event
by x00221466
Hi all:
There maybe a bug about detaching virtual net device(such as virtio nic、
RTL8138、E1000)。
When live detaching the net device, there are some problems:
(1)If the Guest OS don't support the hot plugging pci device, detach
the virtual network device by Libvirt, the "net device" in Qemu will
still exist, but "hostnet"(tap) in Qemu will be removed. so the net device
in Guest OS will be of no effect.
(2)If reject the nic in Guest OS, Qemu will remove the "net device",
then Qemu send DEVICE_DELETED to Libvirt, Libvirt receive the event
in event-loop thread and release info of the net device in
qemuDomainRemoveNetDevice func. but "hostnet" in Qemu still exist.
So next live attaching virtual net device will be failed because of
"Duplicate ID".
#virsh attach-device win2008_st_r2_64 net.xml --live
error: Failed to attach device from net.xml
error: internal error: unable to execute QEMU command 'netdev_add':
Duplicate ID 'hostnet0' for netdev
(3)In addition, in qemuDomainDetachNetDevice, detach net device func,
"netdev_del" command will be sent after sending "device_del" command
at once. So it is violent to remove the tap device before the net device
is completely removed.
So I think it's more logical that doing the work of sending Qemu command
"netdev_del" after receive the DEVICE_DELETED event. It can avoid the conflict
of device info between Libvirt side and Qemu side. I create a thread in
qemuDomainRemoveDevice,the handle of DEVICE_DELETED event, to execute QEMU
command "netdev_del". But I find there is another problem when sending monitor
msg in multiply threads. in "qemuMonitorSend", monitor lock maybe unlocked
and locked, so another thread has the opportunity to get the monitor lock,
and use the same monitor. It will occur error.
I wonder if it is workable that sending "netdev_del" command after receive the
DEVICE_DELETED event.
Thanks.
-xie
11 years, 1 month
[libvirt] [PATCH python 0/4] setup.py: Don't unconditionally run pkg-config
by Cole Robinson
This series reorganizes setup.py to not unconditionally call
pkg-config. This will allow 'setup.py clean' and 'setup.py --help'
to work correctly even if pkg-config or libvirt-devel aren't installed.
https://bugzilla.redhat.com/show_bug.cgi?id=1074170
Cole Robinson (4):
setup.py: Remove unused import
setup.py: Move module list building to its own function
setup.py: Make have_libvirt_lxc a function
setup.py: Allow running --help or clean without pkg-config
setup.py | 144 +++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 85 insertions(+), 59 deletions(-)
--
1.8.5.3
11 years, 1 month
[libvirt] [PATCH] bhyve: don't fail on busy tap devices
by Roman Bogorodskiy
We use virBhyveTapGetRealDeviceName() to map network interface name
to a real device path, trying to open possible devices and getting
names by ioctl.
Make it skip devices that fail to open with EBUSY because they're
most likely already used by other VMs.
---
src/bhyve/bhyve_command.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 6d64c27..e569aab 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -69,6 +69,8 @@ virBhyveTapGetRealDeviceName(char *name)
goto cleanup;
}
if ((fd = open(devpath, O_RDWR)) < 0) {
+ if (errno == EBUSY)
+ continue;
virReportSystemError(errno, _("Unable to open '%s'"), devpath);
goto cleanup;
}
--
1.8.4.2
11 years, 1 month