[libvirt] [PATCH v2 0/2] Introduce max_anonymous_clients
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=981729
So far we can limit how many clients are connected,
how many are waiting in accept() line but we could
not control the count of accepted but not
authenticated yet.
Michal Privoznik (2):
virNetServer: Introduce unauth clients counter
daemon: Introduce max_anonymous_clients
daemon/libvirtd-config.c | 1 +
daemon/libvirtd-config.h | 1 +
daemon/libvirtd.aug | 1 +
daemon/libvirtd.c | 1 +
daemon/libvirtd.conf | 4 +++
daemon/remote.c | 21 ++++++-----
daemon/test_libvirtd.aug.in | 1 +
src/locking/lock_daemon.c | 3 +-
src/lxc/lxc_controller.c | 2 +-
src/rpc/virnetserver.c | 88 ++++++++++++++++++++++++++++++++++++++++++---
src/rpc/virnetserver.h | 3 ++
11 files changed, 110 insertions(+), 16 deletions(-)
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] Fix memory leak in virDomainSnapshotDiskDefClear()
by Nehal J Wani
While running domainsnapshotxml2xmltest, it was found that valgrind pointed out
the following memory leaks:
==32176== 42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 42 of 66
==32176== at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==32176== by 0x4A06B62: realloc (vg_replace_malloc.c:662)
==32176== by 0x4C65A07: virReallocN (viralloc.c:243)
==32176== by 0x4C65B2E: virExpandN (viralloc.c:292)
==32176== by 0x4C65E30: virInsertElementsN (viralloc.c:434)
==32176== by 0x4CD71F3: virDomainDiskSourceDefParse (domain_conf.c:5078)
==32176== by 0x4CF6EF4: virDomainSnapshotDefParseNode (snapshot_conf.c:151)
==32176== by 0x4CF7314: virDomainSnapshotDefParseString (snapshot_conf.c:410)
==32176== by 0x41FB8D: testCompareXMLToXMLHelper (domainsnapshotxml2xmltest.c:100)
==32176== by 0x420FD1: virtTestRun (testutils.c:199)
==32176== by 0x41F859: mymain (domainsnapshotxml2xmltest.c:222)
==32176== by 0x42174D: virtTestMain (testutils.c:782)
==32176==
==32176== 128 (96 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 51 of 66
==32176== at 0x4A06BE0: realloc (vg_replace_malloc.c:662)
==32176== by 0x4C65A07: virReallocN (viralloc.c:243)
==32176== by 0x4C65B2E: virExpandN (viralloc.c:292)
==32176== by 0x4C65E30: virInsertElementsN (viralloc.c:434)
==32176== by 0x4CD71F3: virDomainDiskSourceDefParse (domain_conf.c:5078)
==32176== by 0x4CF6EF4: virDomainSnapshotDefParseNode (snapshot_conf.c:151)
==32176== by 0x4CF7314: virDomainSnapshotDefParseString (snapshot_conf.c:410)
==32176== by 0x41FB8D: testCompareXMLToXMLHelper (domainsnapshotxml2xmltest.c:100)
==32176== by 0x420FD1: virtTestRun (testutils.c:199)
==32176== by 0x41F859: mymain (domainsnapshotxml2xmltest.c:222)
==32176== by 0x42174D: virtTestMain (testutils.c:782)
==32176== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==32176==
---
src/conf/snapshot_conf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 12b0930..475525f 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -82,6 +82,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
{
VIR_FREE(disk->name);
VIR_FREE(disk->file);
+ virDomainDiskHostDefFree(disk->nhosts, disk->hosts);
}
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
--
1.7.1
10 years, 8 months
[libvirt] [PATCH v2 0/5] AppArmor support for lxc containers
by Cédric Bosdonnat
This is a repost of the previous patch series, with the following changes:
* Dropped the patch setting "none" security driver as default in lxc.conf
* Add a patch to implement support for "none" type with apparmor security model.
Cédric Bosdonnat (5):
LXC driver: generate apparmor profiles for guests
Make sure apparmor is started before libvirtd
apparmor: add debug traces when changing profile.
add support for apparmor in lxc-enter-namespace
apparmor: handle "none" type
daemon/libvirtd.service.in | 1 +
examples/apparmor/Makefile.am | 2 ++
examples/apparmor/TEMPLATE | 2 +-
examples/apparmor/libvirt-lxc | 17 ++++++++++
src/libvirt-lxc.c | 13 ++++++++
src/security/security_apparmor.c | 24 +++++++++++---
src/security/virt-aa-helper.c | 69 +++++++++++++++++++++++++++++-----------
7 files changed, 103 insertions(+), 25 deletions(-)
create mode 100644 examples/apparmor/libvirt-lxc
--
1.8.5.2
10 years, 8 months
[libvirt] [PATCH] qemu: monitor: Fix error message and comment when getting cpu info
by Peter Krempa
In qemuMonitorJSONExtractCPUInfo an error message hinted on missing
character device data which is wrong.
Also a comment states that only qemu-kvm tree includes the thread_id
field. This is no longer true.
---
src/qemu/qemu_monitor_json.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5e825ac..9a5b812 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1220,13 +1220,13 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
int thread;
if (!entry) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("character device information was missing array element"));
+ _("cpu information was missing an array element"));
goto cleanup;
}
if (virJSONValueObjectGetNumberInt(entry, "thread_id", &thread) < 0) {
- /* Only qemu-kvm tree includs thread_id, so treat this as
- non-fatal, simply returning no data */
+ /* Some older qemu versions don't report the thread_id,
+ * so treat this as non-fatal, simply returning no data */
ret = 0;
goto cleanup;
}
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] qemu: snapshot: Use better check when reverting external snapshots
by Peter Krempa
https://bugzilla.redhat.com/show_bug.cgi?id=1071264
Reverting of external snapshots is not supported currently. The check
that is present doesn't properly check for all aspects that make a
snapshot external. Use virDomainSnapshotIsExternal() to do the check.
---
src/qemu/qemu_driver.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e04a328..4fbcb27 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13921,12 +13921,13 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
"to revert to inactive snapshot"));
goto cleanup;
}
- if (snap->def->state == VIR_DOMAIN_DISK_SNAPSHOT) {
+
+ if (virDomainSnapshotIsExternal(snap)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("revert to external disk snapshot not supported "
- "yet"));
+ _("revert to external snapshot not supported yet"));
goto cleanup;
}
+
if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
if (!snap->def->dom) {
virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY,
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] qemuBuildNicDevStr: Adapt to new advisory on multiqueue
by Michal Privoznik
As I did previously in 4f588a1b46, libvirt needs to set virtio vectors.
Previously, we were advised to use vectors=N, where
N = 2 * (number of queues) + 1
However, just recently this advisory has changed on the Multiquue wiki
page [1] to:
N = 2 * (number of queues) + 2
1: http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Notes:
I've had some discussion with qemu developers that qemu is the
best place to compute sane default [1]. And they agreed with me.
However, until they will do so, libvirt should pass the correct
value to make the whole feature work correctly.
1: https://bugzilla.redhat.com/show_bug.cgi?id=1005626
src/qemu/qemu_command.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ff0b2d5..18d0a64 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5036,8 +5036,8 @@ qemuBuildNicDevStr(virDomainDefPtr def,
}
if (usingVirtio && vhostfdSize > 1) {
/* As advised at http://www.linux-kvm.org/page/Multiqueue
- * we should add vectors=2*N+1 where N is the vhostfdSize */
- virBufferAsprintf(&buf, ",mq=on,vectors=%d", 2 * vhostfdSize + 1);
+ * we should add vectors=2*N+2 where N is the vhostfdSize */
+ virBufferAsprintf(&buf, ",mq=on,vectors=%d", 2 * vhostfdSize + 2);
}
if (vlan == -1)
virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
--
1.9.0
10 years, 8 months
[libvirt] [PATCHv2 0/2] Check if systemd is the init before creating machines
by Ján Tomko
v1: https://www.redhat.com/archives/libvir-list/2014-February/msg01662.html
v2: check if systemd1 is registered in ListNames
instead of reading /proc/1/comm
actually pass 'make check' in all three cases:
* no systemd
* systemd installed
* systemd running
Ján Tomko (2):
Split out most of virDBusIsServiceEnabled
Check if systemd is running before creating machines
src/util/virdbus.c | 47 +++++++++++++++++++++++++++++++++++++----------
src/util/virdbus.h | 1 +
src/util/virsystemd.c | 6 ++++++
tests/virsystemdmock.c | 24 +++++++++++++++++++++++-
tests/virsystemdtest.c | 37 +++++++++++++++++++++++++++++++++++++
5 files changed, 104 insertions(+), 11 deletions(-)
--
1.8.3.2
10 years, 8 months
[libvirt] [PATCH] Don't always skip virportallocatortest
by Ján Tomko
Include dlfcn.h before checking if RTLD_NEXT is defined
---
tests/virportallocatortest.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c
index 5a93dad..fd48c11 100644
--- a/tests/virportallocatortest.c
+++ b/tests/virportallocatortest.c
@@ -23,8 +23,11 @@
#include "virfile.h"
#include "testutils.h"
-#if HAVE_DLFCN_H && defined(RTLD_NEXT)
+#if HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
+#if defined(RTLD_NEXT)
# ifdef MOCK_HELPER
# include "internal.h"
# include <sys/socket.h>
@@ -32,7 +35,6 @@
# include <arpa/inet.h>
# include <netinet/in.h>
# include <stdio.h>
-# include <dlfcn.h>
static bool host_has_ipv6 = false;
static int (*realsocket)(int domain, int type, int protocol);
@@ -265,7 +267,7 @@ mymain(void)
VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/libvirportallocatormock.so")
# endif
-#else /* ! HAVE_DLFCN_H */
+#else /* ! defined(RTLD_NEXT) */
int
main(void)
{
--
1.8.3.2
10 years, 8 months
[libvirt] [PCTCH v2 0/2] fix query-command-line-options
by Amos Kong
This patchset fixed some issues of query-command-line-options:
* some new options haven't arguments can't be queried. (eg: -enable-fips)
* some legcy options have arguments can't be queried. (eg: -vnc display)
More discussion:
http://marc.info/?l=qemu-devel&m=139081830416684&w=2
V2: remove duplicate option tables, update schema
Amos Kong (2):
qmp: rename query_option_descs() to get_param_infolist()
query-command-line-options: query all the options in qemu-options.hx
qapi-schema.json | 8 ++++++--
util/qemu-config.c | 58 +++++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 55 insertions(+), 11 deletions(-)
--
1.8.5.3
10 years, 8 months
[libvirt] Libvirt Java Bindings - adding domain event support - pull request
by Chris Ellis
Hi all
I'm new to this list, I've been making use of the Libvirt Java bindings
recently. I wanted to make use of domain events yesterday
so my application can be alerted when the state of a domain changes etc.
However I quickly discovered that domain events are completely broken in
the current Java bindings. Whilst some of the Libvirt
functions required to support domain events are exposed, the critical
underpinnings are not. Specifically there is no support
for setting up the event loop.
So I have implemented support for domain events in the Java bindings.
Currently I've only implemented the following domain
event IDs:
* VIR_DOMAIN_EVENT_ID_LIFECYCLE
* VIR_DOMAIN_EVENT_ID_REBOOT
* VIR_DOMAIN_EVENT_ID_RTC_CHANGE
Implementing these is enough to test that my implementation is sane, I'm
hoping to implement the majority of the other events
soon.
Events can be listened to by, registering via the Connect object, as
follows:
con.domainEventRegisterAny(DomainEventID.VIR_DOMAIN_EVENT_ID_LIFECYCLE,
new DomainLifecycleEventHandler() {
@Override
public void onStarted(Connect connection, Domain domain, DomainEventType
event, DomainEventStartedDetailType detail) throws LibvirtException {
System.out.println("Got start event: " + event + "::" + detail + " for
domain " + domain.getName());
}
});
I've put my clone of the libvirt-java git repository on Github, my
modifications to the Java binding are in a separate branch and
should be simple to merge. The changes can be viewed at:
https://github.com/intrbiz/libvirt-java/compare/master...ce-domain-events
I'm keen to get these enhancements / fixes merged into libvirt-java. I
would also like to submit further fixes to race conditions
in the free() handling.
Any advice / thoughts / comments welcome.
Regards,
Chris Ellis
10 years, 8 months