[libvirt] Release of libvirt-java-0.5.0
by Daniel Veillard
With a bit of delay, the release needed by Wido is finally available,
it is tagged in git and I have pushed tarball, jar and rpms to the FTP:
ftp://libvirt.org/libvirt/java/
Wido maybe you can push to Maven, I'm unsure how to do this and last
time I tried I made a mess :-)
I bumped the intermediate release number as this release includes
more improvements and fixes than the previous ones and deprecates a
couple of things:
Portability:
- Fix the rpm build (Daniel Veillard)
- Explicitly set includeAntRuntime to false for javac tasks. (Claudio Bley)
- Fix build with jna >= 3.5.0 (Jiri Denemark)
Bug Fixes:
- Fixed broken dates in Changelog (Daniel Veillard)
- Fix memory leaks for libvirt functions returning newly allocated memory. (Claudio Bley)
- Fix memory leak for virDomainGetSchedulerType. (Claudio Bley)
Improvements:
- Implement and use virDomainMigrateToURI2 by overloading migrateToUri (Wido den Hollander)
- Implement virDomainMigrate2 and use it for a new migrate method. (Wido den Hollander)
- Overload Domain.snapshotCreateXML with a method that has an argument for flags (Wido den Hollander)
- Overload Domain.snapshotListNames with a method that has an additional flags argument. (Wido den Hollander)
- Implement virDomainUndefineFlags by overloading the existing undefine method (Wido den Hollander)
- Implement virStorageVolResize by adding resize to StorageVol (Wido den Hollander)
- Implement virDomainBlockResize (Wido den Hollander)
- Avoid creating new Arrays and Lists on every struct instantiation (Claudio Bley)
- Make the build fail if any of the JUnit tests have errors or failures (Claudio Bley)
- Avoid unnecessary copying and calling virResetLastError. (Claudio Bley)
- Split "build" target and automatically rebuild out of date files. (Claudio Bley)
- Split JUnit tests and use a fixture for Connect. (Claudio Bley)
- Call processError only if a libvirt function indicates an error. (Claudio Bley)
- Change visibility of class members to private to enforce encapsulation. (Claudio Bley)
- Make finalize() methods protected. (Claudio Bley)
- Add findbugs build file for ant. (Claudio Bley)
- Introduce a javac.debug property. (Claudio Bley)
- maint: correct name for license file (Eric Blake)
- Add Javadoc and Source JARs to Maven repo (Wido den Hollander)
- Fix the Maven build system with Ant (Wido den Hollander)
Cleanups:
- trivial remove unused imports (Stefan Majer)
- Remove unused imports (Stefan Majer)
- Remove functions not intended to be used by libvirt bindings. (Claudio Bley)
- Remove the libvirt instance attribute from all classes. (Claudio Bley)
- Mark virConnCopyLastError and virConnGetLastError as deprecated. (Claudio Bley)
- Remove redundant public modifier from Libvirt interface methods. (Claudio Bley)
Thanks Claudio, Wido and everybody else who contributed !
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/
11 years, 7 months
[libvirt] [PATCH] tools: Fix a wrong check in cmdEcho()
by Hongwei Bi
What should be checked here is xmlbuf rather then buf.
---
tools/virsh.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index bf2fbf8..ac354ac 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -921,7 +921,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
if (xml) {
virBufferEscapeString(&xmlbuf, "%s", arg);
- if (virBufferError(&buf)) {
+ if (virBufferError(&xmlbuf)) {
vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
return false;
}
--
1.7.1
11 years, 7 months
[libvirt] [bug] State of "in shutdown".
by Dongsheng Yang
Hi experts:
I got the following description by <man virsh>:
```
STATES
shutdown
The domain is in the process of shutting down, i.e.
the guest
operating system has been notified and should be in the process of
stopping its operations gracefully.
```
But I found the state of VM is "running" even when it is in process of
shutting down.
e.g:
# virsh list
Id Name State
----------------------------------------------------
41 virt-tests-vm1 running
# virsh shutdown virt-tests-vm1;echo $?;virsh domstate virt-tests-vm1
--reason
Domain virt-tests-vm1 is being shutdown
0
running (booted)
# virsh domstate virt-tests-vm1 --reason
running (booted)
... ...
# virsh domstate virt-tests-vm1 --reason
shut off (shutdown)
As shown above, I can not get a "shutdown" (or "in shutdown") for the VM
state.
Do you think it is a bug, or something not good enough?
Wish your help!!
11 years, 7 months
[libvirt] [PATCHv4 0/4] VMX: CD-ROM handling improvements
by Doug Goldstein
A user came into #virt the other day and was trying to get libvirtd
to work with VMware Fusion 5, which is basically the Mac OS X version of
VMware Workstation. In helping him out I noticed a few limitations of our
VMX parser so I've added support through this patchset. I don't personally
have access or own VMware's product.
v4:
* Half the patchset has been merged at this point
* Add back 'auto detect' support via <source startupPolicy='optional'/>
* Made device='lun' match device='cdrom'
* Patch 1 & 2 are new to the series
v3:
* Dropped 'auto detect' support from series as it needs more work based on
feedback
* Added patch to combine virVMXFormatHardDisk and virVMXFormatCDROM into
one function.
* Converted to <disk type='block' device='lun'> instead of adding a
<driver> element to better match the behavior available via QEMU.
v2:
* Added additional test cases and fixed issues that arose from those
*** BLURB HERE ***
Doug Goldstein (4):
Allow LUN type disks to have no source
Allow <source> for type=block to have no dev
VMX: Add support for 'auto detect' fileNames
VMX: Add a VMWare Fusion 5 configuration for tests
docs/schemas/domaincommon.rng | 8 +-
src/conf/domain_conf.c | 9 ++-
src/vmx/vmx.c | 28 +++++--
.../vmx2xml-cdrom-ide-raw-auto-detect.vmx | 5 ++
.../vmx2xml-cdrom-ide-raw-auto-detect.xml | 24 ++++++
.../vmx2xml-cdrom-scsi-raw-auto-detect.vmx | 6 ++
.../vmx2xml-cdrom-scsi-raw-auto-detect.xml | 24 ++++++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 ++++++++++++++++++++++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 39 ++++++++++
tests/vmx2xmltest.c | 4 +
.../xml2vmx-cdrom-ide-raw-auto-detect.vmx | 14 ++++
.../xml2vmx-cdrom-ide-raw-auto-detect.xml | 14 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.vmx | 15 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 ++++++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 41 ++++++++++
tests/xml2vmxtest.c | 4 +
17 files changed, 356 insertions(+), 11 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCHv3 0/4] Introduce APIs to extract DHCP leases info
by Nehal J Wani
This API returns the leases information stored in the DHCP leases
file of dnsmasq for a given virtual network. It contacts the
bridge network driver, which parses the leases file.
It supports two methods:
1. Return info for all network interfaces connected to a given
virtual network
2. Return information for a particular network interface in a
given virtual network by providing its MAC Address
v3
* Mostly small nits, change in MACRO names, use of virSocketAddrGetIpPrefix to
retrieve IP prefix from @dom XML.
v2
* Since DHCPv6 is supposed to be suported in future, virNetworkGetDHCPLeasesForMAC
changed, prefix and virIPAddrType added in virNetworkDHCPLeases struct.
Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00732.html
v1
* Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00620.html
* The need for these APIs were result of a RFC was proposed on the list.
Refer: http://www.redhat.com/archives/libvir-list/2013-July/msg01603.html
Nehal J Wani (4):
net-dhcp-leases: Implement the public APIs
net-dhcp-leases: Implement the remote protocol
net-dhcp-leases: Private implementation inside network driver
net-dhcp-leases: Add virsh support
daemon/remote.c | 133 ++++++++++++++++++++++++++++++++
include/libvirt/libvirt.h.in | 33 ++++++++
python/generator.py | 3 +
src/driver.h | 13 ++++
src/libvirt.c | 173 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 7 ++
src/network/bridge_driver.c | 177 +++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 150 ++++++++++++++++++++++++++++++++++++
src/remote/remote_protocol.x | 50 +++++++++++-
src/remote_protocol-structs | 32 ++++++++
src/rpc/gendispatch.pl | 1 +
tools/virsh-network.c | 100 ++++++++++++++++++++++++
tools/virsh.pod | 6 ++
13 files changed, 877 insertions(+), 1 deletion(-)
--
1.7.11.7
11 years, 7 months
[libvirt] [PATCH] Free slicename in virSystemdCreateMachine
by Ján Tomko
1,003 bytes in 1 blocks are definitely lost in loss record 599 of 635
==404== by 0x50728A7: virBufferAddChar (virbuffer.c:185)
==404== by 0x50BC466: virSystemdEscapeName (virsystemd.c:67)
==404== by 0x50BC6B2: virSystemdMakeSliceName (virsystemd.c:108)
==404== by 0x50BC870: virSystemdCreateMachine (virsystemd.c:169)
==404== by 0x5078267: virCgroupNewMachine (vircgroup.c:1498)
---
src/util/virsystemd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 7674cc6..e72b7f0 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -239,5 +239,6 @@ cleanup:
VIR_FREE(username);
VIR_FREE(creatorname);
VIR_FREE(machinename);
+ VIR_FREE(slicename);
return ret;
}
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] Always free network and graphics cookies
by Ján Tomko
qemuMigrationEatCookie has flags to control if these should
be parsed, but it does not fill mig->flags. These cookies might
get leaked if these flags are not set by qemuMigrationBakeCookie.
42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in
loss record 361 of 662
==123== by 0x1BA33FCA: qemuMigrationEatCookie (qemu_migration.c:678)
==123== by 0x1BA34A1E: qemuMigrationRun (qemu_migration.c:3108)
==123== by 0x1BA3622B: doNativeMigrate (qemu_migration.c:3343)
==123== by 0x1BA3B408: qemuMigrationPerform (qemu_migration.c:4138)
---
src/qemu/qemu_migration.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 69a9013..d7b89fc 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -202,11 +202,8 @@ static void qemuMigrationCookieFree(qemuMigrationCookiePtr mig)
if (!mig)
return;
- if (mig->flags & QEMU_MIGRATION_COOKIE_GRAPHICS)
- qemuMigrationCookieGraphicsFree(mig->graphics);
-
- if (mig->flags & QEMU_MIGRATION_COOKIE_NETWORK)
- qemuMigrationCookieNetworkFree(mig->network);
+ qemuMigrationCookieGraphicsFree(mig->graphics);
+ qemuMigrationCookieNetworkFree(mig->network);
VIR_FREE(mig->localHostname);
VIR_FREE(mig->remoteHostname);
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCHv2] build: make autobuild require rpm build deps
by Eric Blake
I spent far too long on a new machine trying to figure out why
./autobuild.sh failed due to an rpm build failure (complaining
that libvirt_parthelper was supposed to be packaged but was not
built), and finally traced it to a missing parted-devel
installation. I learned that --nodeps is in place for
autobuilder setups, but for developers, removing it would make
rpmbuild error out much sooner for a less cryptic failure.
* autobuild.sh: Conditionally drop --nodeps from rpmbuild lines.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v2: make --nodeps conditional based on $AUTOBUILD_COUNTER; suggested
by Dan Berrange.
autobuild.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index e5aa35c..3109b49 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -8,6 +8,13 @@ set -v
test -n "$1" && RESULTS=$1 || RESULTS=results.log
: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
+# If run under the autobuilder, we must use --nodeps with rpmbuild;
+# but this can lead to odd error diagnosis for normal development.
+nodeps=
+if test "${AUTOBUILD_COUNTER+set}"; then
+ nodeps=--nodeps
+fi
+
test -f Makefile && make -k distclean || :
rm -rf coverage
@@ -60,7 +67,7 @@ else
fi
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild $nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean libvirt.spec
@@ -111,7 +118,7 @@ fi
if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild $nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean mingw-libvirt.spec
--
1.8.3.1
11 years, 7 months
[libvirt] [PATCHv2] cgroup: Move [qemu|lxc]GetCpuBWStatus to vicgroup.c and refactor it
by Peter Krempa
The function existed in two identical instances in lxc and qemu. Move it
to vircgroup.c and simplify it. Refactor the callers too.
---
Notes:
Version 2:
- added a fallback implementation that doesn't spam logs with errors
src/libvirt_private.syms | 1 +
src/lxc/lxc_driver.c | 52 +++++-------------------------------------------
src/qemu/qemu_driver.c | 51 +++++------------------------------------------
src/util/vircgroup.c | 38 +++++++++++++++++++++++++++++++++++
src/util/vircgroup.h | 2 ++
5 files changed, 51 insertions(+), 93 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 35f0f1b..82e3d6f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1217,6 +1217,7 @@ virCgroupSetMemory;
virCgroupSetMemoryHardLimit;
virCgroupSetMemorySoftLimit;
virCgroupSetMemSwapHardLimit;
+virCgroupSupportsCpuBW;
# util/virclosecallbacks.h
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b587c22..87ced95 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1574,45 +1574,10 @@ static char *lxcConnectGetHostname(virConnectPtr conn)
}
-
-/*
- * check whether the host supports CFS bandwidth
- *
- * Return 1 when CFS bandwidth is supported, 0 when CFS bandwidth is not
- * supported, -1 on error.
- */
-static int lxcGetCpuBWStatus(virCgroupPtr cgroup)
-{
- char *cfs_period_path = NULL;
- int ret = -1;
-
- if (!cgroup)
- return 0;
-
- if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
- "cpu.cfs_period_us", &cfs_period_path) < 0) {
- VIR_INFO("cannot get the path of cgroup CPU controller");
- ret = 0;
- goto cleanup;
- }
-
- if (access(cfs_period_path, F_OK) < 0) {
- ret = 0;
- } else {
- ret = 1;
- }
-
-cleanup:
- VIR_FREE(cfs_period_path);
- return ret;
-}
-
-
static char *lxcDomainGetSchedulerType(virDomainPtr dom,
int *nparams)
{
char *ret = NULL;
- int rc;
virDomainObjPtr vm;
virLXCDomainObjPrivatePtr priv;
@@ -1639,13 +1604,10 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
}
if (nparams) {
- rc = lxcGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- else if (rc == 0)
- *nparams = 1;
- else
+ if (virCgroupSupportsCpuBW(priv->cgroup))
*nparams = 3;
+ else
+ *nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
@@ -1872,12 +1834,8 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (*nparams > 1) {
- rc = lxcGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- cpu_bw_status = !!rc;
- }
+ if (*nparams > 1)
+ cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ae1948f..0caeb08 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7325,44 +7325,10 @@ cleanup:
}
-/*
- * check whether the host supports CFS bandwidth
- *
- * Return 1 when CFS bandwidth is supported, 0 when CFS bandwidth is not
- * supported, -1 on error.
- */
-static int qemuGetCpuBWStatus(virCgroupPtr cgroup)
-{
- char *cfs_period_path = NULL;
- int ret = -1;
-
- if (!cgroup)
- return 0;
-
- if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
- "cpu.cfs_period_us", &cfs_period_path) < 0) {
- VIR_INFO("cannot get the path of cgroup CPU controller");
- ret = 0;
- goto cleanup;
- }
-
- if (access(cfs_period_path, F_OK) < 0) {
- ret = 0;
- } else {
- ret = 1;
- }
-
-cleanup:
- VIR_FREE(cfs_period_path);
- return ret;
-}
-
-
static char *qemuDomainGetSchedulerType(virDomainPtr dom,
int *nparams)
{
char *ret = NULL;
- int rc;
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
@@ -7389,13 +7355,10 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
}
if (nparams) {
- rc = qemuGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- else if (rc == 0)
- *nparams = 1;
- else
+ if (virCgroupSupportsCpuBW(priv->cgroup))
*nparams = 5;
+ else
+ *nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
@@ -8728,12 +8691,8 @@ qemuDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (*nparams > 1) {
- rc = qemuGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- cpu_bw_status = !!rc;
- }
+ if (*nparams > 1)
+ cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a615f28..e99caf5 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -3061,6 +3061,36 @@ cleanup:
}
+/**
+ * virCgroupSupportsCpuBW():
+ * Check whether the host supports CFS bandwidth.
+ *
+ * Return true when CFS bandwidth is supported,
+ * false when CFS bandwidth is not supported.
+ */
+bool
+virCgroupSupportsCpuBW(virCgroupPtr cgroup)
+{
+ char *path = NULL;
+ int ret = false;
+
+ if (!cgroup)
+ return false;
+
+ if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
+ "cpu.cfs_period_us", &path) < 0) {
+ virResetLastError();
+ goto cleanup;
+ }
+
+ ret = virFileExists(path);
+
+cleanup:
+ VIR_FREE(path);
+ return ret;
+}
+
+
#else /* !VIR_CGROUP_SUPPORTED */
bool
@@ -3646,4 +3676,12 @@ virCgroupIsolateMount(virCgroupPtr group ATTRIBUTE_UNUSED,
return -1;
}
+
+bool
+virCgroupSupportsCpuBW(virCgroupPtr cgroup ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("Control groups not supported on this platform");
+ return false;
+}
+
#endif /* !VIR_CGROUP_SUPPORTED */
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 7bb4b2a..835eb30 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -207,4 +207,6 @@ int virCgroupIsolateMount(virCgroupPtr group,
const char *oldroot,
const char *mountopts);
+bool virCgroupSupportsCpuBW(virCgroupPtr cgroup);
+
#endif /* __VIR_CGROUP_H__ */
--
1.8.3.2
11 years, 7 months