[libvirt] [Qemu-devel]virtio serial device problem
by Li Zhang
Hi all,
When we use the latest version of QEMU to build ovirt,
we get this error reported from libvirt.
qemu-system-ppc64: -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm:
Bus 'virtio-serial0.0' is full
qemu-system-ppc64: -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm:
Bus 'virtio-serial0.0' not found
Libvirt helps create QEMU command line and put virtserialport device to
bus virtio-serial0.0.
For latest version of QEMU, the bus type is changed.
(qemu) info qtree
bus: main-system-bus
type System
dev: spapr-pci-host-bridge, id ""
index = 0
buid = 0x800000020000000
liobn = 0x80000000
mem_win_addr = 0x100a0000000
mem_win_size = 0x20000000
io_win_addr = 0x10080000000
io_win_size = 0x10000
msi_win_addr = 0x10090000000
irq 0
bus: pci
type PCI
dev: virtio-serial-pci, id "virtio-serial0"
ioeventfd = on
vectors = 2
class = 0x780
indirect_desc = on
event_idx = on
max_ports = 31
addr = 03.0
romfile = <null>
rombar = 1
multifunction = off
command_serr_enable = on
class Class 0780, addr 00:03.0, pci id 1af4:1003 (sub 1af4:0003)
bar 0: i/o at 0xffffffffffffffff [0x1e]
bar 1: mem at 0xffffffffffffffff [0xffe]
bus: virtio-serial0.0
type virtio-pci-bus
dev: virtio-serial-device, id ""
max_ports = 31
bus: virtio-serial-bus.0
type virtio-serial-bus
dev: virtserialport, id "channel1"
chardev = charchannel1
nr = 2
name = "org.qemu.guest_agent.0"
port 2, guest off, host off, throttle off
dev: virtserialport, id "channel0"
chardev = charchannel0
nr = 1
name = "com.redhat.rhevm.vdsm"
port 1, guest off, host off, throttle off
But we tried to replace virtio-serial0.0 with virtio-serial-bus.0,
SLOF crashes. It still doesn't work at all.
Does anyone know how to use virtserialport in QEMU command line?
If configuration is changed in QEMU, libvirt also needs to change it
accordingly.
Thanks. :)
--Li
11 years, 8 months
[libvirt] LXC: user namespaces
by Richard RW. Weinberger
Hi!
We'd like to use libvirt for managing our lxc machines.
Currently libvirt lacks of user namespace support.
Is anyone working on that? Otherwise David and I will implement it
and send patches very soon.
Thanks,
//richard
11 years, 8 months
[libvirt] [PATCH] maint: update to latest gnulib
by Eric Blake
Among others, this fixes a cosmetic bug where bootstrap stated:
./bootstrap: Bootstrapping from checked-out http://libvirt.org sources...
instead of the intended:
./bootstrap: Bootstrapping from checked-out libvirt sources...
* .gnulib: Update to latest, for bootstrap improvement.
* bootstrap: Resync from gnulib.
---
Pushing under the "trivial" rule (or rather, under the general
agreement that gnulib updates are fair game outside of libvirt freeze).
* .gnulib 92f3a4c...0f8ddbf (17):
> bootstrap: AC_INIT may have more than four parameters
> ChangeLog: whitespace cleanup
> qacl: port to MS-Windows port of GNU Emacs
> acl: include quote.h
> fchownat, renameat, unlinkat: update statat dependencies
> Assume gnulib is checked out from Git, not CVS
> utimensat-tests, etc.: try to fix some races
> utimens, utimensat: work around Solaris UTIME_OMIT bug
> gettext: now it's your responsibility to add -I$(top_builddir)/intl
> acl: include errno.h to get errno
> tests: don't assume getdtablesize () <= 10000000
> extern-inline: work around bug in Sun c99
> autoupdate
> qacl: new module, broken out from the acl module
> alignof, intprops, malloca: port better to IBM's C compiler
> wctype-h: fix gettext link error on mingw
> autoupdate
.gnulib | 2 +-
bootstrap | 19 ++++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/.gnulib b/.gnulib
index 92f3a4c..0f8ddbf 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 92f3a4c8e52e64c233e260431d095dbf88554c14
+Subproject commit 0f8ddbf1a13a93a4584afdd82f0f87e498a0db6f
diff --git a/bootstrap b/bootstrap
index 96f1e76..0cbea66 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2013-03-08.16; # UTC
+scriptversion=2013-05-08.20; # UTC
# Bootstrap this package from checked-out sources.
@@ -140,20 +140,21 @@ po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \
http://translationproject.org/latest/%s/"
+# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
+# fall back to the package name (1st argument with munging)
extract_package_name='
- /^AC_INIT(/{
- /.*,.*,.*, */{
- s///
- s/[][]//g
- s/)$//
+ /^AC_INIT(\[*/{
+ s///
+ /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
+ s//\1/
+ s/[],)].*//
p
q
}
- s/AC_INIT(\[*//
- s/]*,.*//
+ s/[],)].*//
s/^GNU //
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- s/[^A-Za-z0-9_]/-/g
+ s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
p
}
'
--
1.8.1.4
11 years, 8 months
[libvirt] [PATCH v2] Delete udevFreeIfaceDef function in udev interface driver
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The udevFreeIfaceDef function in the udev interface driver
just duplicates code from virInterfaceDefFree. Delete it
and call the standard API instead.
Fix the udevGetIfaceDefVlan method so that it doesn't
store pointers to the middle of a malloc'd memory
area.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/interface/interface_backend_udev.c | 80 +++++++---------------------------
1 file changed, 16 insertions(+), 64 deletions(-)
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 7daad16..9b708fa 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -543,44 +543,6 @@ udevBridgeScanDirFilter(const struct dirent *entry)
return 1;
}
-/**
- * Frees any memory allocated by udevGetIfaceDef()
- *
- * @param ifacedef - interface to free and cleanup
- */
-static void
-udevFreeIfaceDef(virInterfaceDef *ifacedef)
-{
- int i;
-
- if (!ifacedef)
- return;
-
- if (ifacedef->type == VIR_INTERFACE_TYPE_BOND) {
- VIR_FREE(ifacedef->data.bond.target);
- for (i = 0; i < ifacedef->data.bond.nbItf; i++) {
- udevFreeIfaceDef(ifacedef->data.bond.itf[i]);
- }
- VIR_FREE(ifacedef->data.bond.itf);
- }
-
- if (ifacedef->type == VIR_INTERFACE_TYPE_BRIDGE) {
- VIR_FREE(ifacedef->data.bridge.delay);
- for (i = 0; i < ifacedef->data.bridge.nbItf; i++) {
- udevFreeIfaceDef(ifacedef->data.bridge.itf[i]);
- }
- VIR_FREE(ifacedef->data.bridge.itf);
- }
-
- if (ifacedef->type == VIR_INTERFACE_TYPE_VLAN) {
- VIR_FREE(ifacedef->data.vlan.devname);
- }
-
- VIR_FREE(ifacedef->mac);
- VIR_FREE(ifacedef->name);
-
- VIR_FREE(ifacedef);
-}
static int
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
@@ -935,36 +897,29 @@ udevGetIfaceDefVlan(struct udev *udev ATTRIBUTE_UNUSED,
const char *name,
virInterfaceDef *ifacedef)
{
- char *vid;
- char *vlan_parent_dev = NULL;
-
- vlan_parent_dev = strdup(name);
- if (!vlan_parent_dev) {
- virReportOOMError();
- goto cleanup;
- }
+ const char *vid;
/* Find the DEVICE.VID again */
- vid = strrchr(vlan_parent_dev, '.');
+ vid = strrchr(name, '.');
if (!vid) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("failed to find the VID for the VLAN device '%s'"),
- name);
- goto cleanup;
- }
-
- /* Replace the dot with a NULL so we can have the device and VID */
- vid[0] = '\0';
- vid++;
+ _("failed to find the VID for the VLAN device '%s'"),
+ name);
+ return -1;
+ }
/* Set the VLAN specifics */
- ifacedef->data.vlan.tag = vid;
- ifacedef->data.vlan.devname = vlan_parent_dev;
+ if (!(ifacedef->data.vlan.tag = strdup(vid + 1)))
+ goto no_memory;
+ if (!(ifacedef->data.vlan.devname = strndup(name,
+ (vid - name))))
+ goto no_memory;
return 0;
-cleanup:
- VIR_FREE(vlan_parent_dev);
+no_memory:
+ VIR_FREE(ifacedef->data.vlan.tag);
+ VIR_FREE(ifacedef->data.vlan.devname);
return -1;
}
@@ -1081,7 +1036,7 @@ udevGetIfaceDef(struct udev *udev, const char *name)
cleanup:
udev_device_unref(dev);
- udevFreeIfaceDef(ifacedef);
+ virInterfaceDefFree(ifacedef);
return NULL;
}
@@ -1102,15 +1057,12 @@ udevInterfaceGetXMLDesc(virInterfacePtr ifinfo,
*/
ifacedef = udevGetIfaceDef(udev, ifinfo->name);
- /* We've already printed by it happened */
if (!ifacedef)
goto err;
- /* Convert our interface to XML */
xmlstr = virInterfaceDefFormat(ifacedef);
- /* Recursively free our interface structures and free the children too */
- udevFreeIfaceDef(ifacedef);
+ virInterfaceDefFree(ifacedef);
err:
/* decrement our udev ptr */
--
1.8.1.4
11 years, 8 months
[libvirt] [libvirt-java] [PATCH] Fix wrapping of native size_t data type
by Claudio Bley
Libvirt function parameters having type (pointer to) size_t were
wrapped via JNA using int, long or even NativeLong. Alas, none of
these is actually correct as the size of size_t may be the same as the
size of either (unsigned) int, long or even long long on different
platforms.
JNA provides the size of a native size_t to us, so using this
information we define and use class SizeT and class SizeTByReference for
wrapping a native size_t and size_t*, respectively.
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
src/main/java/org/libvirt/Domain.java | 5 ++--
src/main/java/org/libvirt/Secret.java | 10 ++++----
src/main/java/org/libvirt/Stream.java | 7 +++--
src/main/java/org/libvirt/jna/Libvirt.java | 14 +++++-----
src/main/java/org/libvirt/jna/SizeT.java | 25 ++++++++++++++++++
.../java/org/libvirt/jna/SizeTByReference.java | 27 ++++++++++++++++++++
6 files changed, 70 insertions(+), 18 deletions(-)
create mode 100644 src/main/java/org/libvirt/jna/SizeT.java
create mode 100644 src/main/java/org/libvirt/jna/SizeTByReference.java
diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index a72e8c6..efac9b9 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -3,6 +3,7 @@ package org.libvirt;
import org.libvirt.jna.DomainPointer;
import org.libvirt.jna.DomainSnapshotPointer;
import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.SizeT;
import org.libvirt.jna.virDomainBlockInfo;
import org.libvirt.jna.virDomainBlockStats;
import org.libvirt.jna.virDomainInfo;
@@ -234,7 +235,7 @@ public class Domain {
*/
public DomainBlockStats blockStats(String path) throws LibvirtException {
virDomainBlockStats stats = new virDomainBlockStats();
- int success = libvirt.virDomainBlockStats(VDP, path, stats, stats.size());
+ int success = libvirt.virDomainBlockStats(VDP, path, stats, new SizeT(stats.size()));
processError();
return success == 0 ? new DomainBlockStats(stats) : null;
}
@@ -695,7 +696,7 @@ public class Domain {
*/
public DomainInterfaceStats interfaceStats(String path) throws LibvirtException {
virDomainInterfaceStats stats = new virDomainInterfaceStats();
- libvirt.virDomainInterfaceStats(VDP, path, stats, stats.size());
+ libvirt.virDomainInterfaceStats(VDP, path, stats, new SizeT(stats.size()));
processError();
return new DomainInterfaceStats(stats);
}
diff --git a/src/main/java/org/libvirt/Secret.java b/src/main/java/org/libvirt/Secret.java
index 5332e02..4edb515 100644
--- a/src/main/java/org/libvirt/Secret.java
+++ b/src/main/java/org/libvirt/Secret.java
@@ -2,11 +2,11 @@ package org.libvirt;
import org.libvirt.jna.Libvirt;
import org.libvirt.jna.SecretPointer;
+import org.libvirt.jna.SizeT;
+import org.libvirt.jna.SizeTByReference;
import static org.libvirt.Library.libvirt;
import com.sun.jna.Native;
-import com.sun.jna.NativeLong;
-import com.sun.jna.ptr.LongByReference;
import com.sun.jna.Pointer;
import java.nio.ByteBuffer;
@@ -120,7 +120,7 @@ public class Secret {
* @return the value of the secret, or null on failure.
*/
public byte[] getByteValue() throws LibvirtException {
- LongByReference value_size = new LongByReference();
+ SizeTByReference value_size = new SizeTByReference();
Pointer value = libvirt.virSecretGetValue(VSP, value_size, 0);
processError();
ByteBuffer bb = value.getByteBuffer(0, value_size.getValue());
@@ -154,7 +154,7 @@ public class Secret {
* @return 0 on success, -1 on failure.
*/
public int setValue(String value) throws LibvirtException {
- int returnValue = libvirt.virSecretSetValue(VSP, value, new NativeLong(value.length()), 0);
+ int returnValue = libvirt.virSecretSetValue(VSP, value, new SizeT(value.length()), 0);
processError();
return returnValue;
}
@@ -165,7 +165,7 @@ public class Secret {
* @return 0 on success, -1 on failure.
*/
public int setValue(byte[] value) throws LibvirtException {
- int returnValue = libvirt.virSecretSetValue(VSP, value, new NativeLong(value.length), 0);
+ int returnValue = libvirt.virSecretSetValue(VSP, value, new SizeT(value.length), 0);
processError();
return returnValue;
}
diff --git a/src/main/java/org/libvirt/Stream.java b/src/main/java/org/libvirt/Stream.java
index 84e300c..d852d0d 100644
--- a/src/main/java/org/libvirt/Stream.java
+++ b/src/main/java/org/libvirt/Stream.java
@@ -1,11 +1,10 @@
package org.libvirt;
import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.SizeT;
import org.libvirt.jna.StreamPointer;
import static org.libvirt.Library.libvirt;
-import com.sun.jna.NativeLong;
-
public class Stream {
public static int VIR_STREAM_NONBLOCK = (1 << 0);
@@ -108,7 +107,7 @@ public class Stream {
* @throws LibvirtException
*/
public int receive(byte[] data) throws LibvirtException {
- int returnValue = libvirt.virStreamRecv(VSP, data, new NativeLong(data.length));
+ int returnValue = libvirt.virStreamRecv(VSP, data, new SizeT(data.length));
processError();
return returnValue;
}
@@ -151,7 +150,7 @@ public class Stream {
* @throws LibvirtException
*/
public int send(String data) throws LibvirtException {
- int returnValue = libvirt.virStreamSend(VSP, data, new NativeLong(data.length()));
+ int returnValue = libvirt.virStreamSend(VSP, data, new SizeT(data.length()));
processError();
return returnValue;
}
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 8c7d6ef..34ef966 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -180,7 +180,7 @@ public interface Libvirt extends Library {
int virDomainAbortJob(DomainPointer virDomainPtr);
int virDomainAttachDevice(DomainPointer virDomainPtr, String deviceXML);
int virDomainAttachDeviceFlags(DomainPointer virDomainPtr, String deviceXML, int flags);
- int virDomainBlockStats(DomainPointer virDomainPtr, String path, virDomainBlockStats stats, int size);
+ int virDomainBlockStats(DomainPointer virDomainPtr, String path, virDomainBlockStats stats, SizeT size);
int virDomainBlockResize(DomainPointer virDomainPtr, String disk, long size, int flags);
int virDomainCoreDump(DomainPointer virDomainPtr, String to, int flags);
int virDomainCreate(DomainPointer virDomainPtr);
@@ -210,7 +210,7 @@ public interface Libvirt extends Library {
Pointer virDomainGetXMLDesc(DomainPointer virDomainPtr, int flags);
int virDomainHasCurrentSnapshot(DomainPointer virDomainPtr, int flags);
int virDomainHasManagedSaveImage(DomainPointer virDomainPtr, int flags);
- int virDomainInterfaceStats(DomainPointer virDomainPtr, String path, virDomainInterfaceStats stats, int size);
+ int virDomainInterfaceStats(DomainPointer virDomainPtr, String path, virDomainInterfaceStats stats, SizeT size);
int virDomainIsActive(DomainPointer virDomainPtr);
int virDomainIsPersistent(DomainPointer virDomainPtr);
DomainPointer virDomainLookupByID(ConnectionPointer virConnectPtr, int id);
@@ -351,13 +351,13 @@ public interface Libvirt extends Library {
int virSecretGetUUID(SecretPointer virSecretPtr, byte[] uuidString);
int virSecretGetUUIDString(SecretPointer virSecretPtr, byte[] uuidString);
String virSecretGetUsageID(SecretPointer virSecretPtr);
- Pointer virSecretGetValue(SecretPointer virSecretPtr, LongByReference value_size, int flags);
+ Pointer virSecretGetValue(SecretPointer virSecretPtr, SizeTByReference value_size, int flags);
String virSecretGetXMLDesc(SecretPointer virSecretPtr, int flags);
SecretPointer virSecretLookupByUsage(ConnectionPointer virConnectPtr, int usageType, String usageID);
SecretPointer virSecretLookupByUUID(ConnectionPointer virConnectPtr, byte[] uuidBytes);
SecretPointer virSecretLookupByUUIDString(ConnectionPointer virConnectPtr, String uuidstr);
- int virSecretSetValue(SecretPointer virSecretPtr, String value, NativeLong value_size, int flags);
- int virSecretSetValue(SecretPointer virSecretPtr, byte[] value, NativeLong value_size, int flags);
+ int virSecretSetValue(SecretPointer virSecretPtr, String value, SizeT value_size, int flags);
+ int virSecretSetValue(SecretPointer virSecretPtr, byte[] value, SizeT value_size, int flags);
int virSecretUndefine(SecretPointer virSecretPtr);
//Stream Methods
@@ -369,9 +369,9 @@ public interface Libvirt extends Library {
int virStreamFinish(StreamPointer virStreamPtr) ;
int virStreamFree(StreamPointer virStreamPtr) ;
StreamPointer virStreamNew(ConnectionPointer virConnectPtr, int flags) ;
- int virStreamSend(StreamPointer virStreamPtr, String data, NativeLong size);
+ int virStreamSend(StreamPointer virStreamPtr, String data, SizeT size);
int virStreamSendAll(StreamPointer virStreamPtr, Libvirt.VirStreamSourceFunc handler, Pointer opaque);
- int virStreamRecv(StreamPointer virStreamPtr, byte[] data, NativeLong length);
+ int virStreamRecv(StreamPointer virStreamPtr, byte[] data, SizeT length);
int virStreamRecvAll(StreamPointer virStreamPtr, Libvirt.VirStreamSinkFunc handler, Pointer opaque);
//DomainSnapshot Methods
diff --git a/src/main/java/org/libvirt/jna/SizeT.java b/src/main/java/org/libvirt/jna/SizeT.java
new file mode 100644
index 0000000..298fe73
--- /dev/null
+++ b/src/main/java/org/libvirt/jna/SizeT.java
@@ -0,0 +1,25 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Native;
+import com.sun.jna.IntegerType;
+
+/**
+ * Represents the native {@code size_t} data type.
+ */
+public final class SizeT extends IntegerType {
+ public SizeT() { this(0); }
+ public SizeT(long value) {
+ /* N.B. A three argument constructor is supported starting with
+ * JNA version 3.4.1.
+ *
+ * The third argument determines whether this class represents
+ * an unsigned integer type. When extracting a value into a
+ * larger-sized container (e.g. 4 byte native type into Java
+ * long), the value is properly converted as unsigned.
+ *
+ * TODO: Use this constructor once we require JNA >= 3.4.1
+ */
+ // super(Native.SIZE_T_SIZE, value, true);
+ super(Native.SIZE_T_SIZE, value);
+ }
+}
diff --git a/src/main/java/org/libvirt/jna/SizeTByReference.java b/src/main/java/org/libvirt/jna/SizeTByReference.java
new file mode 100644
index 0000000..63fe453
--- /dev/null
+++ b/src/main/java/org/libvirt/jna/SizeTByReference.java
@@ -0,0 +1,27 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Native;
+import com.sun.jna.ptr.ByReference;
+
+/**
+ * Represents a native (call-by-reference) pointer to {@code size_t} data type.
+ */
+public final class SizeTByReference extends ByReference {
+ public SizeTByReference() {
+ this(0);
+ }
+
+ public SizeTByReference(long value) {
+ super(Native.SIZE_T_SIZE);
+ setValue(value);
+ }
+
+ public void setValue(long value) {
+ getPointer().setLong(0, value);
+ }
+
+ public long getValue() {
+ return getPointer().getLong(0);
+ }
+
+}
--
1.7.9.5
11 years, 8 months
[libvirt] [PATCH 0/2] Resolve Coverity issues
by John Ferlan
The following patches resolve a couple of Coverity issues. The 'lxc' change
is merely a work-around by adding a Coverity tag to avoid what I consider to
be a false positive. Another option to resolving is to change the code in
lxcContainerPrepareRoot() to assign 'tmp = root->src' and then VIR_FREE(tmp)
instead. I have submitted a bug to Coverity for this. The issue first
showed up earlier this month and I've tried various ways to resolve without
much luck. The 'virsh' change is from a more recent change where the ':'
option processing was changed in such a way that Coverity's analysis found
a missing break. The loop in question should find a match with optopt, but
if it didn't it would have fallen into the '?' code.
John Ferlan (2):
lxc: Coverity false positive USE_AFTER_FREE
virsh: Resolve Coverity 'MISSING_BREAK'
src/lxc/lxc_container.c | 5 +++++
tools/virsh.c | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
--
1.8.1.4
11 years, 8 months
[libvirt] [libvirt-java] [RFC] simplify java build process
by Stefan Majer
Hi,
I have small patch series which tries to accomplish a easier developer
experience when building libvirt-java. The reason is simple based on
the fact that the following workflow does not work out of the box.
1. with ant:
# git clone git://libvirt.org/libvirt-java.git
# cd libvirt-java
# ant
gives:
[javac] Compiling 64 source files to
/home/stefan/dev/libvirt-java/target/classes
[javac] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:5:
error: package com.sun.jna does not exist
[javac] import com.sun.jna.Native;
...
because the ant build depends on a locally installed jna.jar which
might be not present.
2. with maven3
# cp pom.xml.in pom.xml
# mvn clean install
gives:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
(default-compile) on project libvirt: Compilation failure: Compilation
failure:
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/DomainSnapshot.java:[4,7]
error: static import declarations are not supported in -source 1.3
because maven still defaults to java source 1.3 on certain
distributions (ubuntu 13.04 here).
after adding a proper setting with the maven-compiler-plugin i get:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:[41,28]
cannot find symbol
symbol: method nativeValue(com.sun.jna.Pointer)
location: class com.sun.jna.Pointer
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:[42,16]
cannot find symbol
symbol: method nativeValue(com.sun.jna.Pointer,long)
location: class com.sun.jna.Pointer
This is because jna version 3.0.9 is specified but this version does
not have these signatures.
To make a long story short i would like to propose the following patches:
1. remove the ant components (build.xml, build.properties) altogether
and use maven exclusively.
2. rename pom.xml.in into pom.xml and specify java source and jna
3. remove libvirt-java.spec.in and create the libvirt-java.rpm with
the rpm-maven-plugin.
4. update the README and INSTALL accordingly
As result there will be only one file which is responsible for the
build left (pom.xml).
If there is a consensus i will post the patches as a followup.
Any objections, suggestions ?
Greetings
--
Stefan Majer
11 years, 8 months
[libvirt] [ocaml] event registration APis v3
by David Scott
Hi,
Here are my latest patches which add OCaml bindings for the libvirt event
API. I'm pretty happy with them now: my test programs have been running
for long periods of time without incident.
Changes from the previous submission (sent 2013-04-17)
* added a patch which removes the backwards compatability logic from
the bindings. The aim is to make the bindings simpler to read and
develop.
Changes from the initial submission (sent 2013-03-27)
* add support for 'deregister_any'
* fix the ordering of '{enter,leave}_blocking_section' and GC registration
* add timer callbacks
Cheers,
Dave
11 years, 8 months
[libvirt] [libvirt-tck PATCH] Add new file for domain APIs
by Zhe Peng
include APIs
dom->block_resize
dom->get_block_info
dom->block_peek
dom->get_interface_parameters
dom->migrate_get_max_speed
dom->set_interface_parameters
con->is_alive
---
scripts/domain/180-interface-parameters.t | 173 +++++++++++++++++++++++++++++
1 files changed, 173 insertions(+), 0 deletions(-)
create mode 100644 scripts/domain/180-interface-parameters.t
diff --git a/scripts/domain/180-interface-parameters.t b/scripts/domain/180-interface-parameters.t
new file mode 100644
index 0000000..6b30a30
--- /dev/null
+++ b/scripts/domain/180-interface-parameters.t
@@ -0,0 +1,173 @@
+# -*- perl -*-
+#
+# Copyright (C) 2012 Red Hat, Inc.
+# Copyright (C) 2012 Kyla Zhang <weizhan(a)redhat.com>
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+domain/180-interface-parameters.t - test interface set/get
+
+=head1 DESCRIPTION
+
+The test case validates that all following APIs work well include
+dom->block_resize
+dom->get_block_info
+dom->block_peek
+dom->get_interface_parameters
+dom->migrate_get_max_speed
+dom->set_interface_parameters
+con->is_alive
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 39;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+use File::stat;
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+ $tck->cleanup if $tck;
+}
+
+# test is_alive
+my $live = $conn->is_alive();
+ok($live > 0, "Connection is alive");
+
+my $xml = $tck->generic_pool("dir")->as_xml;
+
+diag "Defining transient storage pool";
+my $pool;
+ok_pool(sub { $pool = $conn->define_storage_pool($xml) }, "define transient storage pool");
+lives_ok(sub { $pool->build(0) }, "built storage pool");
+lives_ok(sub { $pool->create }, "started storage pool");
+
+my $volallocxml = $tck->generic_volume("tck", "raw", 1024*1024*50)->allocation(1024*1024*50)->as_xml;
+my ($vol, $path, $st);
+ok_volume { $vol = $pool->create_volume($volallocxml) } "create fully allocated raw volume";
+
+my $volallocxml2 = $tck->generic_volume("tck2", "raw", 1024*1024*50)->allocation(1024*1024)->as_xml;
+my ($vol2, $path2, $st2);
+ok_volume { $vol2 = $pool->create_volume($volallocxml2) } "create not fully allocated raw volume";
+
+my $volallocxml3 = $tck->generic_volume("tck3", "qcow2", 1024*1024*50)->allocation(1024*1024)->as_xml;
+my ($vol3, $path3, $st3);
+ok_volume { $vol3 = $pool->create_volume($volallocxml3) } "create qcow2 volume";
+
+$path = xpath($vol, "string(/volume/target/path)");
+$st = stat($path);
+ok($st, "path $path exists");
+is($st->size, 1024*1024*50, "size is 50M");
+
+$path2 = xpath($vol2, "string(/volume/target/path)");
+$st2 = stat($path2);
+ok($st2, "path $path2 exists");
+
+$path3 = xpath($vol3, "string(/volume/target/path)");
+$st3 = stat($path3);
+ok($st3, "path $path3 exists");
+
+diag "Generic guest with pervious created vol";
+my $disktype = "raw";
+my $dst = "vda";
+my $dst2 = "vdb";
+my $dst3 = "vdc";
+my $guest = $tck->generic_domain("tck");
+$guest->rmdisk();
+$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src => $path, dst => $dst);
+$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src=> $path2, dst => $dst2);
+$guest->disk(format => { name => "qemu", type => "qcow2" }, type => "file", src=> $path3, dst => $dst3);
+$guest->interface(type => "network", source => "default", model => "virtio", mac => "52:54:00:22:22:22");
+
+$xml = $guest->as_xml;
+my $dom;
+ok_domain(sub { $dom = $conn->create_domain($xml) }, "Create domain");
+$xml = $dom->get_xml_description();
+diag "$xml";
+
+is($dom->get_block_info($dst2,0)->{capacity}, 1024*1024*50, "Get disk capacity info");
+is($dom->get_block_info($dst2,0)->{allocation}, 1024*1024, "Get disk allocation info");
+is($dom->get_block_info($dst2,0)->{physical}, 1024*1024, "Get disk physical info");
+
+
+is($dom->get_block_info($dst,0)->{capacity}, 1024*1024*50, "Get disk capacity info");
+is($dom->get_block_info($dst,0)->{allocation}, 1024*1024*50, "Get disk allocation info");
+is($dom->get_block_info($dst,0)->{physical}, 1024*1024*50, "Get disk physical info");
+
+diag "Test block_resize";
+lives_ok(sub {$dom->block_resize($dst, 512*50)}, "resize to 512*50 KB");
+$st = stat($path);
+is($st->size, 512*1024*50, "size is 25M");
+
+is($dom->get_block_info($dst,0)->{capacity}, 1024*512*50, "Get disk capacity info");
+is($dom->get_block_info($dst,0)->{allocation}, 1024*512*50, "Get disk allocation info");
+is($dom->get_block_info($dst,0)->{physical}, 1024*512*50, "Get disk physical info");
+
+lives_ok(sub {$dom->block_resize($dst, 1024*50)}, "resize to 1024*50 KB");
+$st = stat($path);
+is($st->size, 1024*1024*50, "size is 50M");
+
+my $date = "test";
+system("echo $date > $path");
+is($dom->block_peek($path,0,4,0), $date, "Get date from raw image");
+
+#qcow2 file start with hexadecimal:0x51 0x46 0x49 (ASCII: "QFI")
+is($dom->block_peek($path3,0,3,0), "QFI", "Get date from qcow2 image");
+
+diag "Get migrate max speed";
+my $speed = $dom->migrate_get_max_speed();
+ok($speed, "Get migrate max speed $speed");
+
+diag "Set migrate max speed";
+$speed = 10000;
+lives_ok(sub {$dom->migrate_set_max_speed($speed)}, "Set max speed to $speed");
+my $get_speed = $dom->migrate_get_max_speed();
+is ($speed, $get_speed, "Get speed same as set");
+
+diag "Set/Get interface parameters";
+my %params = (Sys::Virt::Domain::BANDWIDTH_IN_AVERAGE=>1000, Sys::Virt::Domain::BANDWIDTH_IN_PEAK=>1001,
+ Sys::Virt::Domain::BANDWIDTH_IN_BURST=>1002, Sys::Virt::Domain::BANDWIDTH_OUT_AVERAGE=>1003,
+ Sys::Virt::Domain::BANDWIDTH_OUT_PEAK=>1004, Sys::Virt::Domain::BANDWIDTH_OUT_BURST=>1005);
+lives_ok(sub {$dom->set_interface_parameters("vnet0", \%params)}, "Set vnet0 parameters");
+for my $key (sort keys %params) {
+ diag "Set $key => $params{$key} ";
+}
+
+my $param = $dom->get_interface_parameters("vnet0", 0);
+my $in_average = $param->{Sys::Virt::Domain::BANDWIDTH_IN_AVERAGE};
+my $in_burst = $param->{Sys::Virt::Domain::BANDWIDTH_IN_BURST};
+my $in_peak = $param->{Sys::Virt::Domain::BANDWIDTH_IN_PEAK};
+my $out_average = $param->{Sys::Virt::Domain::BANDWIDTH_OUT_AVERAGE};
+my $out_burst = $param->{Sys::Virt::Domain::BANDWIDTH_OUT_BURST};
+my $out_peak = $param->{Sys::Virt::Domain::BANDWIDTH_OUT_PEAK};
+is($in_average, 1000, "Get inbound average 1000");
+is($in_burst, 1002, "Get inbound burst 1002");
+is($in_peak, 1001, "Get inbound peak 1001");
+is($out_average, 1003, "Get outbound average 1003");
+is($out_burst, 1005, "Get outbound burst 1005");
+is($out_peak, 1004, "Get outbound peak 1004");
+
+
+lives_ok(sub { $vol->delete(0) }, "deleted volume");
+
+diag "Destroy domain";
+$dom->destroy;
+
+ok_error(sub { $conn->get_domain_by_name("tck") }, "NO_DOMAIN error raised from missing domain", 42);
--
1.7.7.6
11 years, 8 months
[libvirt] [PATCH 00/11] Misc prep work for ACL support
by Daniel P. Berrange
The patch series for supporting ACLs has grown to about 80 patches,
which no one wants to see on the list in one posting :-) So here
are 11 patches which do misc cleanup/prep work for the ACL support
11 years, 8 months