[libvirt] [PATCH 0/1] Variable length structure allocator
by David Allan
I've had this patch hanging around for a while, and I think it's worth committing even though the original reason for it went away. The kind of structure it allocates is reasonably common, and the oversize calculation is tricky to get right. Since we've already done the work (thanks Jim for the oversize calculation) I think it's worth keeping.
Dave
David Allan (1):
Implement variable length structure allocator
src/util/memory.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/util/memory.h | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
15 years
[libvirt] [PATCH] build: fix recent 'make syntax-check' failure
by Eric Blake
* src/esx/esx_vi_methods.h: Placate cppi.
---
Pushing under the rule for obvious build fixes.
src/esx/esx_vi_methods.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_vi_methods.h b/src/esx/esx_vi_methods.h
index 7b6be4e..c78c649 100644
--- a/src/esx/esx_vi_methods.h
+++ b/src/esx/esx_vi_methods.h
@@ -2,7 +2,7 @@
/*
* esx_vi_methods.h: client for the VMware VI API 2.5 to manage ESX hosts
*
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte(a)googlemail.com>
+ * Copyright (C) 2009, 2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -45,6 +45,6 @@ int esxVI_ValidateMigration
esxVI_ManagedObjectReference *host, /* optional */
esxVI_Event **output); /* optional, list */
-#include "esx_vi_methods.generated.h"
+# include "esx_vi_methods.generated.h"
#endif /* __ESX_VI_METHODS_H__ */
--
1.6.6.1
15 years
[libvirt] [PATCH] schematestutils.sh: improve shell portability: avoid "echo -e"
by Jim Meyering
echo -e is not portable.
This is the sole remaining use in all of libvirt.
>From a58cf340b5ebbca2157f43c6f23d4d6f56b848c7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 14 Apr 2010 13:25:46 +0200
Subject: [PATCH] schematestutils.sh: improve shell portability: avoid "echo -e"
* tests/schematestutils.sh: Use printf rather than echo -e.
---
tests/schematestutils.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/schematestutils.sh b/tests/schematestutils.sh
index f172857..f2b3b50 100644
--- a/tests/schematestutils.sh
+++ b/tests/schematestutils.sh
@@ -22,7 +22,7 @@ do
test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
if test "$verbose" = "1" && test $ret != 0 ; then
- echo -e "$cmd\n$result"
+ printf '%s\n' "$cmd" "$result"
fi
if test "$ret" != 0 ; then
f=`expr $f + 1`
--
1.7.1.rc1.248.gcefbb
15 years
[libvirt] [RFC] maint: forbid most files without extension
by Eric Blake
* .gitignore: Add rule that requires . in name, then add exemptions.
---
Given Chris' recent accident in committing a binary file, then
blasting the list with it, here's a (hack) approach to prevent a
relapse in the future. It assumes that non-binary files either
have an extension, or are easy enough to enumerate.
Personally, I do NOT want to apply this patch. It has the nasty
side-effect of rendering .git/info/exclude useless (git unfortunately
stops processing ignore rules once it finds an explicit accept rule,
so any reject rules in .git/info/exclude for files containing '.' are
overruled as accepts by this patch). Hence, this is only an RFC,
documenting my thought process.
.gitignore | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index a7466fd..7d2bce3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,41 @@
+# To reduce likelihood of committing binaries, require that a '.' be
+# in all non-directories, then add exceptions as needed.
+*
+!*.*
+!/AUTHORS
+!/ChangeLog-old
+!/HACKING
+!README
+!TODO
+!/bootstrap
+!/examples/apparmor/TEMPLATE
+!/examples/apparmor/libvirt-qemu
+!/tests/capabilityschematest
+!/tests/cpuset
+!/tests/daemon-conf
+!/tests/define-dev-segfault
+!/tests/domainschematest
+!/tests/int-overflow
+!/tests/interfaceschematest
+!/tests/libvirtd-fail
+!/tests/libvirtd-pool
+!/tests/networkschematest
+!/tests/nodedevschematest
+!/tests/nwfilterschematest
+!/tests/qemuhelpdata/kvm-74
+!/tests/qemuhelpdata/kvm-86
+!/tests/read-bufsiz
+!/tests/read-non-seekable
+!/tests/start
+!/tests/storagepoolschematest
+!/tests/storagevolschematest
+!/tests/undefine
+!/tests/vcpupin
+!/tests/virsh-all
+!/tests/virsh-synopsis
+!/tests/virt-aa-helper-test
+
+# Other files to exclude
*#*#
*.#*#
*.a
--
1.6.6.1
15 years
[libvirt] clang vs. libvirt
by Jim Meyering
I've been running the clang static analyzer against libvirt
regularly, but it's usually been that of F12 or F13. Yesterday
I used rawhide's version of clang:
scan-build -o clang ./autogen.sh --enable-compile-warnings=error &&
scan-build -o clang make -j6
and it spotted a few new problems.
Most are false positives, but a few were not.
Here are the latest additions.
I have an additional handful of patches that address the
remaining false positives, and will post those later today.
15 years
[libvirt] [PATCH] Implement forgotten backend of virInterfaceIsActive()
by Laine Stump
Somehow the backend of this function was never implemented in
libvirt's netcf driver, and nobody noticed until now. (The required
netcf function was already in place, so nothing needs to change
there.)
---
src/interface/netcf_driver.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
index 708f1f8..7163066 100644
--- a/src/interface/netcf_driver.c
+++ b/src/interface/netcf_driver.c
@@ -511,6 +511,35 @@ cleanup:
return ret;
}
+static int interfaceIsActive(virInterfacePtr ifinfo)
+{
+ struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
+ struct netcf_if *iface = NULL;
+ unsigned int flags = 0;
+
+ interfaceDriverLock(driver);
+
+ iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
+ if (!iface) {
+ /* helper already reported error */
+ goto cleanup;
+ }
+
+ if (ncf_if_status(iface, &flags) < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driver->netcf, &errmsg, &details);
+ interfaceReportError(netcf_to_vir_err(errcode),
+ "failed to get status of interface %s (netcf: %s - %s)",
+ ifinfo->name, errmsg, details ? details : "");
+ goto cleanup;
+ }
+
+cleanup:
+ ncf_if_free(iface);
+ interfaceDriverUnlock(driver);
+ return flags & NETCF_IFACE_ACTIVE ? 1 : 0;
+}
+
static virInterfaceDriver interfaceDriver = {
"Interface",
interfaceOpenInterface, /* open */
@@ -526,7 +555,7 @@ static virInterfaceDriver interfaceDriver = {
interfaceUndefine, /* interfaceUndefine */
interfaceCreate, /* interfaceCreate */
interfaceDestroy, /* interfaceDestroy */
- NULL, /* interfaceIsActive */
+ interfaceIsActive, /* interfaceIsActive */
};
int interfaceRegister(void) {
--
1.6.6.1
15 years
[libvirt] hellolibvirt: no hypervisor driver available for xen:///
by Ganesh Pagade
Hi,
I downloaded and built the latest libvirt source code 0.8. I installed the
library in a custom directory libvirt-0.8.0-install/ keeping all other
configurations default.
After this I tried to execute the example hellolibvirt:
[hellolibvirt]# ./hellolibvirt xen
Attempting to connect to hypervisor
libvir: Remote error : unable to connect to
'/root/ganeshp/libvirt-0.8.0-install/var/run/libvirt/libvirt-sock', libvirtd
may need to be started: Connection refused
No connection to hypervisor
Parameter error when attempting to get last error
My libvirtd was running from /etc/init.d/libvirtd. Still why is it trying to
connect to the newly built libvirtd?
I stopped the /etc/init.d/libvirtd and started my newly built daemon:
[hellolibvirt]# /root/ganeshp/libvirt-0.8.0-install/sbin/libvirtd start &
04:47:07.534: warning : qemudStartup:1574 : Unable to create cgroup for
driver: No such device or address
04:47:07.540: error : parse_socket:126 : cannot open
/sys/devices/system/cpu/cpu1/topology/physical_package_id: No such file or
directory
04:47:07.540: warning : qemudCapsInit:1068 : Failed to get host CPU
04:47:07.544: warning : lxcStartup:1835 : Unable to create cgroup for
driver: No such device or address
After this I tried running hellolibvirt example again:
[hellolibvirt]# ./hellolibvirt xen
Attempting to connect to hypervisor
04:48:43.166: error : virLibConnError:450 : no hypervisor driver available
for xen:///
libvir: error : no hypervisor driver available for xen:///
libvir: error : no hypervisor driver available for xen:///
No connection to hypervisor
Parameter error when attempting to get last error
I do not understand why the program is not able to find the xen driver. I am
able to launch VMM GUI and create VMs using xen connection. The system
already has xen hypervisor (3.1.0).
Even the newly built virsh gives similar errors. Whereas /usr/bin/virsh
works perfectly fine.
Am I missing some configuration or dependency? Any pointers/suggestion would
greatly help. Thanks.
Regards,
-Ganesh
15 years
[libvirt] [PATCH] Run test suite as part of RPM build process
by Daniel P. Berrange
To ensure that patches in the RPM don't break any functionality
it is neccessary to run the test suites during build. It currently
has 3 tests disabled
- daemon-conf: this is totally broken, since it relies on
being able to resolve the 'libvirt' group & being able to
resolve hostnames at daemon startup. This isn't possible
in a mock build root
- seclabeltest: fails to initialize selinux in the mock
build root. Possibly fixable
- nodeinfotest: broken on s390 + ppc - this is a real bug
* libvirt.spec.in: Add a %check section, with 3 tests
temporarily disabled
---
libvirt.spec.in | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 748a1e7..a8b078a 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -618,6 +618,17 @@ chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirtd
%clean
rm -fr %{buildroot}
+%check
+cd tests
+# These 3 tests don't current work in a mock build root
+for i in nodeinfotest daemon-conf seclabeltest
+do
+ rm -f $i
+ echo -e "#!/bin/sh\nexit 0" > $i
+ chmod +x $i
+done
+make check
+
%pre
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
# Normally 'setup' adds this in /etc/passwd, but this is
--
1.6.6.1
15 years, 1 month
[libvirt] [PATCH] Fix off-by-one check in QEMU memory stats
by Daniel P. Berrange
The QEMU memory stats JSON monitor command was too cautious in
checking array bounds, dropping the last requested stat
* src/qemu/qemu_monitor_json.c: Fix off-by-1 check in memory
stats
---
src/qemu/qemu_monitor_json.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 7c0d372..3c97e9d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -965,7 +965,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
goto cleanup;
}
- if (virJSONValueObjectHasKey(data, "mem_swapped_in") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "mem_swapped_in") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "mem_swapped_in", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon mem_swapped_in"));
@@ -976,7 +976,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
stats[got].val = (mem/1024);
got++;
}
- if (virJSONValueObjectHasKey(data, "mem_swapped_out") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "mem_swapped_out") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "mem_swapped_out", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon mem_swapped_out"));
@@ -987,7 +987,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
stats[got].val = (mem/1024);
got++;
}
- if (virJSONValueObjectHasKey(data, "major_page_faults") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "major_page_faults") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "major_page_faults", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon major_page_faults"));
@@ -998,7 +998,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
stats[got].val = mem;
got++;
}
- if (virJSONValueObjectHasKey(data, "minor_page_faults") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "minor_page_faults") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "minor_page_faults", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon minor_page_faults"));
@@ -1009,7 +1009,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
stats[got].val = mem;
got++;
}
- if (virJSONValueObjectHasKey(data, "free_mem") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "free_mem") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "free_mem", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon free_mem"));
@@ -1020,7 +1020,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
stats[got].val = (mem/1024);
got++;
}
- if (virJSONValueObjectHasKey(data, "total_mem") && (got < (nr_stats-1))) {
+ if (virJSONValueObjectHasKey(data, "total_mem") && (got < nr_stats)) {
if (virJSONValueObjectGetNumberUlong(data, "total_mem", &mem) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("info balloon reply was missing balloon total_mem"));
--
1.6.6.1
15 years, 1 month
[libvirt] php bindings
by David W King
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I know this topic has come up multiple times in the past and every time
it does people keep commenting on how it would be a good thing to do but
they just don't have the time. So my question is, has anyone found the
time to work on php bindings for libvirt?
- --
David King
Goshen College ITS
davidwk(a)goshen.edu
574-535-7726
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAku7NWoACgkQH+/Vg7DylXYcEACgmvs0p0YIF3pzu8Cp9xkNk+zZ
2YgAni7YdROnRIrvmpyh1kbb5MH8kT2Y
=DSLD
-----END PGP SIGNATURE-----
15 years, 1 month