[libvirt] [libvirt-java] [PATCH 00/10] assorted fixes
by Claudio Bley
This fixes a few memleaks and other errors.
Note, that the memleak patches depend on the error refactoring
patches I posted to this list[1]
[1] https://www.redhat.com/archives/libvir-list/2014-January/msg00415.html
Claudio Bley (10):
Implement equals and hashCode methods for Connect and Domain
Fix warnings using raw types
Fix warnings about accessing static methods
Remove unused fields of Error class
Fix Domain.getSchedulerParameters / getSchedulerType
Fix memleak in Domain.snapshotListNames
Fix memleak in StoragePool.listVolumes
Fix memleak in DomainSnapshot.getXMLDesc
Fix memleak in StorageVol.getPath
Fix memleak in StorageVol.getXMLDesc
src/main/java/org/libvirt/Connect.java | 35 +++++++
src/main/java/org/libvirt/Domain.java | 103 +++++++++++++++------
src/main/java/org/libvirt/DomainSnapshot.java | 10 +-
src/main/java/org/libvirt/Error.java | 12 +--
src/main/java/org/libvirt/StoragePool.java | 13 ++-
src/main/java/org/libvirt/StorageVol.java | 18 +++-
src/main/java/org/libvirt/jna/Libvirt.java | 10 +-
src/main/java/org/libvirt/jna/virConnectAuth.java | 4 +-
.../java/org/libvirt/jna/virConnectCredential.java | 4 +-
.../java/org/libvirt/jna/virDomainBlockInfo.java | 4 +-
.../java/org/libvirt/jna/virDomainBlockStats.java | 4 +-
src/main/java/org/libvirt/jna/virDomainInfo.java | 4 +-
.../org/libvirt/jna/virDomainInterfaceStats.java | 4 +-
.../java/org/libvirt/jna/virDomainJobInfo.java | 4 +-
.../java/org/libvirt/jna/virDomainMemoryStats.java | 4 +-
src/main/java/org/libvirt/jna/virError.java | 4 +-
src/main/java/org/libvirt/jna/virNodeInfo.java | 4 +-
.../java/org/libvirt/jna/virSchedParameter.java | 4 +-
.../java/org/libvirt/jna/virStoragePoolInfo.java | 4 +-
.../java/org/libvirt/jna/virStorageVolInfo.java | 4 +-
src/main/java/org/libvirt/jna/virVcpuInfo.java | 4 +-
src/test/java/org/libvirt/TestJavaBindings.java | 4 +
22 files changed, 187 insertions(+), 74 deletions(-)
--
1.8.5.2.msysgit.0
10 years, 11 months
[libvirt] Libvirt testing
by Pavel Hrdina
Hi all,
We've created a new wiki page [1] where we would like to create a list
of areas that we should focus on testing.
If there is something critical or important what you think that should
be really tested please feel free to update the wiki page. You should
write down what part or functionality of libvirt should be tested and
how do you think it should be tested.
Regards,
Pavel
[1] <http://wiki.libvirt.org/page/AreasToFocusOnTesting>
10 years, 11 months
[libvirt] [PATCH 0/6] Fix some memory leaks and other issues find by coverity tool
by Pavel Hrdina
This patch series fixes few memory leaks found by coverity tool
to make that tool happy.
The last patch is adding only one comment to hide "double_close" error as
coverity tool is wrong about this and we don't have to see it in every report.
Check the patch for more information.
Pavel Hrdina (6):
Fix memory leak in openvz_conf.c
Fix possible memory leak in phyp_driver.c
Fix possible memory leak in util/virxml.c
Fix possible memory leak in virsh-domain-monitor.c
Fix memory leak in securityselinuxlabeltest.c
Fix coverity complain in commandtest.c
src/openvz/openvz_conf.c | 5 +++--
src/phyp/phyp_driver.c | 4 +++-
src/util/virxml.c | 2 ++
tests/commandtest.c | 1 +
tests/securityselinuxlabeltest.c | 5 ++++-
tools/virsh-domain-monitor.c | 4 ++++
6 files changed, 17 insertions(+), 4 deletions(-)
--
1.8.3.1
10 years, 11 months
[libvirt] [PATCH] virsh nodecpustats returns incorrect stats of cpu on Linux when the number of online cpu exceed 9.
by mars@linux.vnet.ibm.com
From: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
To retrieve node cpu statistics on Linux system, the
linuxNodeGetCPUstats function use STRPREFIX() to match the
cpuid with the cpuid read from /proc/cpustat, it will cause
obvious error.
For example:
'virsh nodecpustats 12' will display stats of cpu1 if the latter is online.
This patch fixes this bug.
Signed-off-by: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
Signed-off-by: Pradipta Kr. Banerjee <bpradip(a)in.ibm.com>
---
src/nodeinfo.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 05bc038..6d7926c 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -715,8 +715,9 @@ linuxNodeGetCPUStats(FILE *procstat,
while (fgets(line, sizeof(line), procstat) != NULL) {
char *buf = line;
+ char **buf_header = virStringSplit(buf, " ", 2);
- if (STRPREFIX(buf, cpu_header)) { /* aka logical CPU time */
+ if (STREQ(buf_header[0], cpu_header)) { /* aka logical CPU time */
size_t i;
if (sscanf(buf,
@@ -775,6 +776,7 @@ linuxNodeGetCPUStats(FILE *procstat,
ret = 0;
goto cleanup;
}
+ virStringFreeList(buf_header);
}
virReportInvalidArg(cpuNum,
@@ -782,6 +784,7 @@ linuxNodeGetCPUStats(FILE *procstat,
__FUNCTION__);
cleanup:
+ virStringFreeList(buf_header);
return ret;
}
--
1.7.7.6
10 years, 11 months
[libvirt] [PATCH] virsh nodecpustats returns incorrect stats of cpu on Linux when the number of online cpu exceed 9.
by mars@linux.vnet.ibm.com
From: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
To retrieve node cpu statistics on Linux system, the
linuxNodeGetCPUstats function simply uses STRPREFIX() to match the
cpuid with the cpuid read from /proc/stat, it will cause
obvious error.
For example:
'virsh nodecpustats 1' will display stats of cpu1* if the latter is online and cpu1 is offline.
This patch fixes this bug.
Signed-off-by: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
---
src/nodeinfo.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 05bc038..cba2fc1 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -708,9 +708,9 @@ linuxNodeGetCPUStats(FILE *procstat,
}
if (cpuNum == VIR_NODE_CPU_STATS_ALL_CPUS) {
- strcpy(cpu_header, "cpu");
+ strcpy(cpu_header, "cpu ");
} else {
- snprintf(cpu_header, sizeof(cpu_header), "cpu%d", cpuNum);
+ snprintf(cpu_header, sizeof(cpu_header), "cpu%d ", cpuNum);
}
while (fgets(line, sizeof(line), procstat) != NULL) {
--
1.7.7.6
10 years, 11 months
[libvirt] [PATCH v2] lxcDomainShutdownFlags and lxcDomainReboot: Cleanup @flags usage
by Michal Privoznik
Currently, the @flags usage is a bit unclear at first sight to say the
least. There's no need for such unclear code especially when we can
borrow the working code from qemuDomainShutdownFlags().
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
-lxcDomainReboot adjusted too
-drop @useInitctl
-shorten the commit message a bit
src/lxc/lxc_driver.c | 46 ++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 7e56a59..06263b9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2701,7 +2701,8 @@ lxcDomainShutdownFlags(virDomainPtr dom,
virDomainObjPtr vm;
char *vroot = NULL;
int ret = -1;
- int rc;
+ int rc = 0;
+ bool initctlRequested, signalRequested;
virCheckFlags(VIR_DOMAIN_SHUTDOWN_INITCTL |
VIR_DOMAIN_SHUTDOWN_SIGNAL, -1);
@@ -2730,25 +2731,21 @@ lxcDomainShutdownFlags(virDomainPtr dom,
(unsigned long long)priv->initpid) < 0)
goto cleanup;
- if (flags == 0 ||
- (flags & VIR_DOMAIN_SHUTDOWN_INITCTL)) {
- if ((rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF,
- vroot)) < 0) {
+ initctlRequested = !flags || flags & VIR_DOMAIN_SHUTDOWN_INITCTL;
+ signalRequested = !flags || flags & VIR_DOMAIN_SHUTDOWN_SIGNAL;
+
+ if (initctlRequested) {
+ rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, vroot);
+ if (rc < 0 && !signalRequested)
goto cleanup;
- }
- if (rc == 0 && flags != 0 &&
- ((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
+ if (rc == 0 && !signalRequested) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Container does not provide an initctl pipe"));
goto cleanup;
}
- } else {
- rc = 0;
}
- if (rc == 0 &&
- (flags == 0 ||
- (flags & VIR_DOMAIN_SHUTDOWN_SIGNAL))) {
+ if (signalRequested || rc == 0) {
if (kill(priv->initpid, SIGTERM) < 0 &&
errno != ESRCH) {
virReportSystemError(errno,
@@ -2781,7 +2778,8 @@ lxcDomainReboot(virDomainPtr dom,
virDomainObjPtr vm;
char *vroot = NULL;
int ret = -1;
- int rc;
+ int rc = 0;
+ bool initctlRequested, signalRequested;
virCheckFlags(VIR_DOMAIN_REBOOT_INITCTL |
VIR_DOMAIN_REBOOT_SIGNAL, -1);
@@ -2810,25 +2808,21 @@ lxcDomainReboot(virDomainPtr dom,
(unsigned long long)priv->initpid) < 0)
goto cleanup;
- if (flags == 0 ||
- (flags & VIR_DOMAIN_REBOOT_INITCTL)) {
- if ((rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_REBOOT,
- vroot)) < 0) {
+ initctlRequested = !flags || flags & VIR_DOMAIN_REBOOT_INITCTL;
+ signalRequested = !flags || flags & VIR_DOMAIN_REBOOT_SIGNAL;
+
+ if (initctlRequested) {
+ rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_REBOOT, vroot);
+ if (rc < 0)
goto cleanup;
- }
- if (rc == 0 && flags != 0 &&
- ((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
+ if (rc == 0 && !signalRequested) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Container does not provide an initctl pipe"));
goto cleanup;
}
- } else {
- rc = 0;
}
- if (rc == 0 &&
- (flags == 0 ||
- (flags & VIR_DOMAIN_REBOOT_SIGNAL))) {
+ if (signalRequested || rc == 0) {
if (kill(priv->initpid, SIGHUP) < 0 &&
errno != ESRCH) {
virReportSystemError(errno,
--
1.8.5.1
10 years, 11 months
[libvirt] [PATCH 00/10] Snapshots on gluster volumes
by Peter Krempa
This series has to be applied on top of
http://www.redhat.com/archives/libvir-list/2014-January/msg00192.html
Peter Krempa (10):
storage: Introduce internal pool support
storage: Add new argument for createVol backend API
storage: gluster: Introduce dummy functions for creating a volume
storage: Add internal API to create temporary storage pools and vols
snapshot: Add support for specifying snapshot disk backing type
snapshot: Test snapshot disk type specification
storage: Implement ephemeral storage APIs for local disk volumes
storage: gluster: Support conversion of gluster volumes to temp
volumes
qemu: snapshot: Switch snapshot file deletion to the new storage API
qemu: snapshot: Add support for external active snapshots on gluster
docs/formatsnapshot.html.in | 15 +
docs/hvsupport.pl | 3 +
docs/schemas/domainsnapshot.rng | 76 ++++-
src/Makefile.am | 3 +-
src/check-aclrules.pl | 3 +
src/check-drivername.pl | 1 +
src/conf/snapshot_conf.c | 25 +-
src/conf/snapshot_conf.h | 15 +-
src/conf/storage_conf.c | 3 +
src/conf/storage_conf.h | 1 +
src/driver.h | 13 +
src/libvirt_internal.c | 71 ++++
src/libvirt_internal.h | 22 ++
src/libvirt_private.syms | 3 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_command.h | 9 +
src/qemu/qemu_driver.c | 228 ++++++++++---
src/storage/storage_backend.h | 2 +-
src/storage/storage_backend_disk.c | 3 +-
src/storage/storage_backend_fs.c | 30 +-
src/storage/storage_backend_gluster.c | 68 ++++
src/storage/storage_backend_logical.c | 6 +-
src/storage/storage_backend_rbd.c | 3 +-
src/storage/storage_backend_sheepdog.c | 3 +-
src/storage/storage_driver.c | 416 ++++++++++++++++++++++-
tests/domainsnapshotxml2xmlin/disk_snapshot.xml | 18 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 18 +
27 files changed, 979 insertions(+), 81 deletions(-)
create mode 100644 src/libvirt_internal.c
--
1.8.5.2
10 years, 11 months
[libvirt] About libvirt.py stdout redirection
by me,apporc
Dear developers,
As we know libvirt.py using libvirtmod.so, eg:
def defineXML(self, xml):
"""Define a domain, but does not start it.
This definition is persistent, until explicitly undefined with
virDomainUndefine(). A previous definition for this domain would be
overriden if it already exists. """
ret = libvirtmod.virDomainDefineXML(self._o, xml)
if ret is None:raise libvirtError('virDomainDefineXML() failed',
conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
In my python program
#test.py
import libvirt
conn=libvirt.open("qemu:///system")
xml=...
conn.defineXML(xml) # Because i need this xml to be wrong for feature
testing here
# Error will happen here, and error message is printed to stderr.
The error message is annoying.
I need to know how to hide the error message printing to stderr by
libvirtmod.
After i add sys.stderr = open('xxx', 'w') before invoking
conn.defineXML(xml), the error message is still printed to the terminal.
Which means, i can redirect stderr to anywhere else in my python program,
but it changes back to terminal when control flow go to libvirtmod.
Any ideas?
--
Regards,
apporc
10 years, 11 months
[libvirt] [PATCH] Bump version to 1.2.2 for new dev cycle
by Christophe Fergeau
---
Hey, I've raised libvirt version to 1.2.2 right after release
following https://www.redhat.com/archives/libvir-list/2013-December/msg00657.html
I've pushed it directly as imo it qualifies as trivial.
Christophe
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index f5dccf1..146418f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ 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/>.
-AC_INIT([libvirt], [1.2.1], [libvir-list(a)redhat.com], [], [http://libvirt.org])
+AC_INIT([libvirt], [1.2.2], [libvir-list(a)redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
--
1.8.4.2
10 years, 11 months
[libvirt] Release of libvirt-python-1.2.1
by Daniel Veillard
I also pushed a new release of libvirt python, it is available at:
ftp://libvirt.org/libvirt/python/
contains a few fixes and a number of improvement especially toward
portability and compatibility with python3:
Features:
- Add python3 to the automated build and RPM (Daniel P. Berrange)
- Added python binding for the new network events API (Cédric Bosdonnat)
Portability:
- Rewrite libvirt_charPtrUnwrap to work with Python 3.0->3.2 (Daniel P. Berrange)
- sanitytest: Fix libvirtError class handling for Python 2.4 (Daniel P. Berrange)
- override: Fix native module registration to work with Python3 (Daniel P. Berrange)
- generator: Don't use 'list' as a variable name (Daniel P. Berrange)
Bug fixes:
- virStream.sendAll() fix raising an undeclared var (Doug Goldstein)
- Fix return type in override method for virStreamRecv (Daniel P. Berrange)
- Don't free passed in args in libvirt_charPtrWrap / libvirt_charPtrSizeWrap (Daniel P. Berrange)
- Fix use of virDomainEventRegister in python bindings (Daniel P. Berrange)
Improvements:
- Add space after comma for consistency with code style (Doug Goldstein)
- define __GNUC_PREREQ macro before using it (Doug Goldstein)
- Skip network event callbacks in sanity test (Daniel P. Berrange)
- sanitytest: remove use of string.lower() (Daniel P. Berrange)
- sanitytest: Fix broken comparison between int and string (Daniel P. Berrange)
- override: Switch virStreamSend wrapper to use libvirt_charPtrSizeUnwrap (Daniel P. Berrange)
- override: Conditionalize use of PyString_Check and PyInt_Check (Daniel P. Berrange)
- typewrappers: PyInt/PyLong merge for Python3 (Daniel P. Berrange)
- typewrappers: Replace use of PyString class (Daniel P. Berrange)
- override: Replace PyInt_AsLong with helper (Daniel P. Berrange)
- override: Replace Py{Int,Long}_FromLong with helpers (Daniel P. Berrange)
- override: Replace PyString_AsString with libvirt_charPtrUnwrap (Daniel P. Berrange)
- override: Replace PyString_FromString with libvirt_constcharPtrWrap (Daniel P. Berrange)
- examples: Ensure we write bytes to the self-pipe (Daniel P. Berrange)
- examples: Invoke print("...") instead of print "..." (Daniel P. Berrange)
- Added python binding for the new network events API (Cédric Bosdonnat)
- test: Invoke print("...") instead of print "..." (Doug Goldstein)
- override: Fix exception handling syntax (Doug Goldstein)
- generator: Sort enums and functions when generating code (Daniel P. Berrange)
- generator: Remove use of string.replace and string.find functions (Daniel P. Berrange)
- generator: Update to use sort() 'key' param (Daniel P. Berrange)
- generator: Remove use of 'has_key' function (Daniel P. Berrange)
- Update exception catching in generated code (Doug Goldstein)
- generator: Support exceptions in Python 2 and 3 (Doug Goldstein)
- setup: Drop unused exception variable (Doug Goldstein)
- generator: Cast iterators to a list() explicitly (Daniel P. Berrange)
- Revert "Optimize callback lookup in event handlers" (Daniel P. Berrange)
- generator: Invoke print("...") instead of print "..." (Daniel P. Berrange)
- generator: Remove string.lower(XXX) with XXX.lower() (Daniel P. Berrange)
- Optimize callback lookup in event handlers (Daniel P. Berrange)
- setup: Use user requested python binary (Doug Goldstein)
Cleanup:
- Revert accidental change to exception handling syntax (Daniel P. Berrange)
Thanks to everybody who contributed to this release !
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
10 years, 11 months