Re: [libvirt] [PATCHv4 02/10] Implement domainMemoryStats API slot for LXC driver.

2014-02-21 Thread Michal Privoznik

On 20.02.2014 22:04, Thorsten Behrens wrote:

Hi Michal,

thx for further cleaning up, and pushing -

Michal Privoznik wrote:

+if (!virCgroupGetMemoryUsage(priv-cgroup, mem_usage))
+goto cleanup;
+
+ret = 0;
+if (!virDomainObjIsActive(vm))
+goto cleanup;


I think these two lines (well three), otherwise we don't fail on
inactive domain, in contrast with qemu driver for instance.


Yeah. Though there are cases (e.g. lxcDomainGetInfo()), where a
stopped domain is not a hard error. I might have been mislead, but was
working under the assumption that get methods (that could return
something sensible, like zero cpu time for a stopped domain) would be
fine to fail more gracefully?


I don't think so. I mean, we allow users to get status of any domain. So 
they can just check the status of domain prior to getting any runtime 
info. We shouldn't return an empty info as it might confuse callers: is 
the domain not running or libvirt isn't possible to get any data? And to 
distinguish these two states, they'd have to call getDomainState anyway.


Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Add a stub for virCgroupGetDomainTotalCpuStats

2014-02-21 Thread Ján Tomko
Commit 6515889 broke the build on FreeBSD:
In function `qemuDomainGetCPUStats':
/../../src/qemu/qemu_driver.c:16102:
undefined reference to `virCgroupGetDomainTotalCpuStats'
---

Pushed as a build-breaker.

 src/util/vircgroup.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 268a4ae..2dba10c 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -4261,6 +4261,17 @@ virCgroupGetCpuacctStat(virCgroupPtr group 
ATTRIBUTE_UNUSED,
 
 
 int
+virCgroupGetDomainTotalCpuStats(virCgroupPtr group ATTRIBUTE_UNUSED,
+virTypedParameterPtr params ATTRIBUTE_UNUSED,
+int nparams ATTRIBUTE_UNUSED)
+{
+virReportSystemError(ENOSYS, %s,
+ _(Control groups not supported on this platform));
+return -1;
+}
+
+
+int
 virCgroupSetFreezerState(virCgroupPtr group ATTRIBUTE_UNUSED,
  const char *state ATTRIBUTE_UNUSED)
 {
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Question about building libvirt.so

2014-02-21 Thread Cedric Bosdonnat
Hello Vik,

On Thu, 2014-02-20 at 15:14 -0800, vikhyath reddy wrote:
 Thanks for libvirt. It is a life saver. I am in the process of writing
 some custom wrappers for libvirt so that it can be easily accessed
 from nodejs using the nodejs-ffi interfacing (basically describes a
 way to convert nodejs to c calls). I did write the wrapper on the
 lines of the examples provided. But I am unable to see my new
 functions in the libvirt.so file (which nodejs interfacing needs).
 Which means that my wrappers under libvirt/wrappers/ are not getting
 into libvirt.so like the ones at libvirt/examples

I don't quite get what you are doing. Why would you need to modify
libvirt to wrap it in a nodejs-based script? What is that
libvirt/wrappers folder you are mentioning? there is no such thing in
the libvirt repository.

From what I understood from the nodejs-ffi page, you should mostly write
javascript code similar to this:

 % 

var ref = require('ref');
var ffi = require('ffi');

var virConnect = ref.types.void;
var virConnectPtr = ref.refType(virConnect);

var libvirt = ffi.Library('libvirt', {
  'virInitialize': [ 'int', [ ] ],
  'virConnectOpen': [virConnectPtr, [ string ]],
  ...
});

 % 

I'm pretty sure generating this could be automated by a small program or
script or even a clang plugin, using include/libvirt/libvirt.h.in as
input.

 Can you please guide me as to where I am going wrong? I was able to do
 a successful configure + make and I thought this will regenerate the
 new libvirt.so (which it does, but I cant see my new wrapper methods
 in it).

I case you really want to modify libvirt, then you should proceed as
mentioned on this page:

http://libvirt.org/compiling.html

Regards,
--
Cedric

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] XML: Escape double-hyphens in XML comment

2014-02-21 Thread Philipp Hahn
To quote http://www.w3.org/TR/REC-xml/#sec-comments:
 For compatibility, the string -- (double-hyphen) must not occur within 
 comments.

For example this breaks creating snapshots:
$ virsh snapshot-create-as $VM comment--bug
$ xmllint --noout /var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml
/var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml:4: parser error : Comment 
not terminated
!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES
  virsh snapshot-edit $VM comment--bug
$ /etc/init.d/libvirt-bin restart
error : qemuDomainSnapshotLoad:367 : Failed to parse snapshot XML from file 
'/var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml'
$ virsh snapshot-list ucs32-33787-performance
 Name Creation Time State


Also applies to QEMU domains, where the name contains double-hyphens.

As a work-around break any sequence of consecutive hyphens by inserting
(arbitrarily chosen) backslashes, as there is no escaping rule defined
as far as I know.

I've not yet checked, how libvirt/libxml handles a document with
multiple root nodes, as this would create interesting possibilities if I
can name my domain
--domain...devices...disk...source dev=/dev/sda/...
It might break on the / as this is the only prohibited character for
QEMU domains, as the name is directly used as a file name.

To fix such broken files (by hand), remove the broken comment by doing
something like this after making sure libvirtd is stopped:
  sed -i -ne '/^domainsnapshot$/,$p' /var/lib/libvirt/qemu/snapshot/*/*.xml
  sed -i -ne '/^domain /,$p' /etc/libvirt/qemu/*.xml
  sed -i -ne '/^pool /,$p' /etc/libvirt/storage/*.xml

@Debian: The bug is also in libvirt-0.9.12.

Signed-off-by: Philipp Hahn h...@univention.de
---
 src/util/virxml.c | 34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/util/virxml.c b/src/util/virxml.c
index dd530a6..ad45e68 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -798,6 +798,34 @@ const char *virXMLPickShellSafeComment(const char *str1, 
const char *str2)
 return NULL;
 }
 
+/*
+ * Break sequence of hyphens by inserting (arbitrarily chosen) backslashes.
+ * http://www.w3.org/TR/REC-xml/#sec-comments:
+ *  For compatibility, the string -- (double-hyphen) must not occur within
+ *  comments.
+ */
+static int virXMLEmitEscapedComment(int fd,
+const char *str)
+{
+size_t len;
+
+if (!strstr(str, --)) {
+len = strlen(str);
+if (safewrite(fd, str, len) != len)
+return -1;
+return 0;
+}
+
+for (;*str;str++) {
+if (safewrite(fd, str, 1) != 1)
+return -1;
+if (str[0] == '-'  str[1] == '-')
+if (safewrite(fd, \\, 1) != 1)
+return -1;
+}
+return 0;
+}
+
 static int virXMLEmitWarning(int fd,
  const char *name,
  const char *cmd)
@@ -822,16 +850,14 @@ static int virXMLEmitWarning(int fd,
 if (safewrite(fd, prologue, len) != len)
 return -1;
 
-len = strlen(cmd);
-if (safewrite(fd, cmd, len) != len)
+if (virXMLEmitEscapedComment(fd, cmd)  0)
 return -1;
 
 if (name) {
 if (safewrite(fd,  , 1) != 1)
 return -1;
 
-len = strlen(name);
-if (safewrite(fd, name, len) != len)
+if (virXMLEmitEscapedComment(fd, name)  0)
 return -1;
 }
 
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Ignore additional fields in iscsiadm output

2014-02-21 Thread Ján Tomko
There has been a new field introduced in iscsiadm --mode session
output [1], but our regex only expects four fields. This breaks
startup of iscsi pools:
error: Failed to start pool iscsi
error: internal error: cannot find session

Fix this by ignoring anything after the fourth field.

https://bugzilla.redhat.com/show_bug.cgi?id=1067173

[1] https://github.com/mikechristie/open-iscsi/commit/181af9a
---
 src/storage/storage_backend_iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_iscsi.c 
b/src/storage/storage_backend_iscsi.c
index 556c2cc..1149e43 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -102,7 +102,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
  * Pull out 2nd and 4th fields
  */
 const char *regexes[] = {
-^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+)\\s*$
+^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+).*$
 };
 int vars[] = {
 2,
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Ignore additional fields in iscsiadm output

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 11:01:17AM +0100, Ján Tomko wrote:
 There has been a new field introduced in iscsiadm --mode session
 output [1], but our regex only expects four fields. This breaks
 startup of iscsi pools:
 error: Failed to start pool iscsi
 error: internal error: cannot find session
 
 Fix this by ignoring anything after the fourth field.
 
 https://bugzilla.redhat.com/show_bug.cgi?id=1067173
 
 [1] https://github.com/mikechristie/open-iscsi/commit/181af9a
 ---
  src/storage/storage_backend_iscsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/storage/storage_backend_iscsi.c 
 b/src/storage/storage_backend_iscsi.c
 index 556c2cc..1149e43 100644
 --- a/src/storage/storage_backend_iscsi.c
 +++ b/src/storage/storage_backend_iscsi.c
 @@ -102,7 +102,7 @@ virStorageBackendISCSISession(virStoragePoolObjPtr pool,
   * Pull out 2nd and 4th fields
   */
  const char *regexes[] = {
 -^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+)\\s*$
 +^tcp:\\s+\\[(\\S+)\\]\\s+\\S+\\s+(\\S+).*$
  };
  int vars[] = {
  2,

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Ignore additional fields in iscsiadm output

2014-02-21 Thread Ján Tomko
On 02/21/2014 11:08 AM, Daniel P. Berrange wrote:
 On Fri, Feb 21, 2014 at 11:01:17AM +0100, Ján Tomko wrote:
 There has been a new field introduced in iscsiadm --mode session
 output [1], but our regex only expects four fields. This breaks
 startup of iscsi pools:
 error: Failed to start pool iscsi
 error: internal error: cannot find session

 Fix this by ignoring anything after the fourth field.

 https://bugzilla.redhat.com/show_bug.cgi?id=1067173

 [1] https://github.com/mikechristie/open-iscsi/commit/181af9a
 ---
  src/storage/storage_backend_iscsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 
 ACK
 
 Daniel
 

Thanks, pushed now.

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 01/65] Fix warnings about using raw types

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:09PM +0100, Claudio Bley wrote:
 Eclipse generates this kind of warning:
 
 org/libvirt/jna/virConnectCredential.java:20:
 List is a raw type. References to generic type ListE should be parameterized
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  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 ++--
  14 files changed, 28 insertions(+), 28 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 05/65] test: ensure that exceptions are thrown when expected

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:13PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/org/libvirt/TestJavaBindings.java |2 ++
  1 file changed, 2 insertions(+)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 06/65] Make comments proper javadoc comments for enum constants

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:14PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Error.java |  397 
 ++
  1 file changed, 262 insertions(+), 135 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 02/65] Fix warnings about accessing static methods

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:10PM +0100, Claudio Bley wrote:
 java/org/libvirt/Error.java:217:
 The static method wrap(int) from the type Error.ErrorDomain should be
 accessed in a static way
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Error.java |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 04/65] test: fix typo in testConnection()

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:12PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/org/libvirt/TestJavaBindings.java |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 08/65] Depend on JNA versions 3.4.1 to 4.0.0

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:16PM +0100, Claudio Bley wrote:
 Specify a version range for the net.java.dev.jna / jna artifact
 in order to accept any version we tested the libvirt Java bindings
 against.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
 As discussed previously[1], with a little delay, here's the patch.
 
 [1]: http://www.redhat.com/archives/libvir-list/2013-September/msg00929.html
 
  pom.xml.in |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 09/65] jna: load virt-0 or virt library depending on the platform

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:17PM +0100, Claudio Bley wrote:
 On Windows, the libvirt DLL is called libvirt-0.dll. Trying to load
 the virt library hence fails to find the file. Branch on the platform
 and load virt-0 if we're running on this OS, use virt otherwise.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/jna/Libvirt.java |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 10/65] Fix wrapping of native size_t data type

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:18PM +0100, Claudio Bley wrote:
 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 cb...@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   |   19 
  .../java/org/libvirt/jna/SizeTByReference.java |   50 
 
  6 files changed, 87 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

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 13/65] Make Device.listCapabilities return only valid array elements

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:21PM +0100, Claudio Bley wrote:
 The libvirt function virNodeDeviceListCaps might return fewer elements
 than requested.  Take this into account and properly decode the UTF-8
 strings returned.
 
 Additionally, the given strings are freed before returning the resulting
 string array.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Device.java  |   10 +++---
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 8 insertions(+), 4 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 12/65] tests: remove obsolete test driver

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:20PM +0100, Claudio Bley wrote:
 JUnit is used for quite some time now, which supercedes the tests
 defined in the old test class.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/test.java |  280 
 ---
  1 file changed, 280 deletions(-)
  delete mode 100644 src/test/java/test.java

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 07/65] Ignore editor backup files

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:15PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  .gitignore |2 ++
  1 file changed, 2 insertions(+)

ACK. Counts as a trivial patch that can be pushed without asking.

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 14/65] test: ensure the Device.listCapabilities method works

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:22PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/org/libvirt/TestJavaBindings.java |   14 ++
  1 file changed, 14 insertions(+)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 16/65] Remove processError from Device class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:24PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to ErrorHandler.processError(..).
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Device.java |   49 
 ++---
  1 file changed, 14 insertions(+), 35 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 15/65] Start refactoring of error handling

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:23PM +0100, Claudio Bley wrote:
 Almost every class contains a processError() method with an identical
 definition, just forwarding the call to ErrorHandler.processError(Libvirt).
 
 This function is always called after a libvirt function call (as per its
 javadoc comment).
 
 But, actually, there's no use in always calling processError when there was
 no error signalled by the libvirt function having been called. This is just
 a waste of CPU cycles.
 
 Furthermore, it's more than ugly that the error handling is littered all
 over the place in every class.
 
 This patch lays ground for generalizing the error handling in a common
 place and removing those functions from the individual classes.
 
 Basically, this copies the processError(int) and processErrorT(T)
 methods from the Connect class to the ErrorHandler class as static
 methods.
 
 It deprecates the processError(Libvirt) method, which will be removed
 eventually in a later patch.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/ErrorHandler.java |   47 
 ++-
  1 file changed, 46 insertions(+), 1 deletion(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 17/65] Remove processError from Domain class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:25PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to ErrorHandler.processError(..).
 
 Also update erroneous javadoc comments stating that methods would return a
 value in case an error occurs.  In case of a libvirt error, a
 LibvirtException is thrown.
 
 Add processErrorIfZero(long) to ErrorHandler class to handle special
 libvirt return codes, such as for virDomainGetMaxMemory. Use it in
 Domain.getMaxMemory().
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java   |  328 
 +--
  src/main/java/org/libvirt/ErrorHandler.java |5 +
  2 files changed, 113 insertions(+), 220 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 19/65] Remove processError from Interface class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:27PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Interface.java |   43 
 --
  1 file changed, 11 insertions(+), 32 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 20/65] Remove processError method from Network class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:28PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Network.java |   61 
 +---
  1 file changed, 17 insertions(+), 44 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 18/65] Remove processError from DomainSnapshot class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:26PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error happens.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/DomainSnapshot.java |   23 ++-
  1 file changed, 6 insertions(+), 17 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 27/65] Call processError only when virInitialize signalled an error

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:35PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Library.java |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 24/65] Remove processError method from StorageVol class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:32PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/StorageVol.java |   56 
 +
  1 file changed, 16 insertions(+), 40 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 11/65] Use virFree in order to release memory acquired from libvirt

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:19PM +0100, Claudio Bley wrote:
 When JNA is linked to a different runtime library than libvirt, using
 JNA's Native.free will probably lead to crashes as witnessed on
 Windows:
 
  # A fatal error has been detected by the Java Runtime Environment:
  #
  #  EXCEPTION_ACCESS_VIOLATION (0xc005) at pc=0x77363290, 
 pid=10180, tid=9908
  #
  # JRE version: 7.0_25-b16
  # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode 
 windows-amd64 compressed oops)
  # Problematic frame:
  # C  [ntdll.dll+0x53290]  RtlFreeHeap+0xd0
 
 The root cause is that the libvirt DLL uses MSVCRT as its runtime
 library, whereas the jnidispatch DLL of JNA uses a different one.
 
 At runtime, when calling org.sun.com.jna.Native.free() the OS function
 RtlFreeHeap is called with an invalid Pointer that was actually
 allocated by MSVCRT's malloc.
 
 Basically, we cannot simply mix and match memory allocation functions
 from different runtime libraries, but have to call virFree for
 pointers orignating from libvirt itself.
 
 So, this patch re-adds and uses the virFree method which had been
 removed in commit 3220de292990bed71828fba2f3700bc846d440f2.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Library.java |4 ++--
  src/main/java/org/libvirt/jna/Libvirt.java |2 ++
  2 files changed, 4 insertions(+), 2 deletions(-)

NACK to this.

virFree is an internal only symbol which is not guaranteeed to be
ABI stable across libvirt releases. ie we may remove or rename it
or change its API signature at any time. 

Not sure what else to suggest though.

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 28/65] Remove ErrorHandler.processError(Libvirt) method

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:36PM +0100, Claudio Bley wrote:
 It was deprecated and is no longer used.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/ErrorHandler.java |   12 
  1 file changed, 12 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 23/65] Remove processError method from StoragePool class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:31PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..).
 
 Adjust the doc comment for storageVolLookupByName to indicate that
 it might return null.
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/StoragePool.java |   95 
 +---
  1 file changed, 30 insertions(+), 65 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 30/65] Fix Domain.getSchedulerParameters / getSchedulerType

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:38PM +0100, Claudio Bley wrote:
 The getSchedulerType method returns a String (the name of the
 scheduler), not a String array containing a single element.
 
 It's OK to just pass null for the second argument to
 virDomainGetSchedulerType.
 
 Ensure to free the returned string.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java |   43 
 +++--
  1 file changed, 25 insertions(+), 18 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 29/65] Implement equals and hashCode methods for Connect and Domain

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:37PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java  |   35 +
  src/main/java/org/libvirt/Domain.java   |   48 
 ++-
  src/test/java/org/libvirt/TestJavaBindings.java |4 ++
  3 files changed, 86 insertions(+), 1 deletion(-)

NACK

 +/* (non-Javadoc)
 + * @see java.lang.Object#hashCode()
 + */
 +@Override
 +public int hashCode() {
 +final int prime = 31;
 +int result = 1;
 +result = prime * result + ((VCP == null) ? 0 : VCP.hashCode());
 +return result;
 +}
 +
 +/* (non-Javadoc)
 + * @see java.lang.Object#equals(java.lang.Object)
 + */
 +@Override
 +public boolean equals(Object obj) {
 +if (this == obj)
 +return true;
 +if (obj == null)
 +return false;
 +if (!(obj instanceof Connect))
 +return false;
 +Connect other = (Connect) obj;
 +if (VCP == null)
 +return (other.VCP == null);
 +else if (VCP.equals(other.VCP))
 +return true;
 +
 +try {
 +return getURI().equals(other.getURI());
 +} catch (LibvirtException e) {
 +throw new RuntimeException(libvirt error testing connect 
 equality, e);
 +}
 +}

This causes a violation of the hashCode API contract. Per the
java api docs for java.lang.Object

   If two objects are equal according to the equals(Object) method,
then calling the hashCode method on each of the two objects must
produce the same integer result.

If the equals method falls through to checking equality of the URIs
and returns true, the hashCode method is going to return different
results since they have different VCP pointers.

Either you have to remove the comparison of getURI in the equals
method, or make the hashCode method use the URI to build up the
hash code.

 diff --git a/src/main/java/org/libvirt/Domain.java 
 b/src/main/java/org/libvirt/Domain.java
 index 047ac33..ab6f9f0 100644
 --- a/src/main/java/org/libvirt/Domain.java
 +++ b/src/main/java/org/libvirt/Domain.java
 @@ -21,6 +21,8 @@ import com.sun.jna.NativeLong;
  import com.sun.jna.Pointer;
  import com.sun.jna.ptr.IntByReference;
  
 +import java.util.Arrays;
 +
  /**
   * A virtual machine defined within libvirt.
   */
 @@ -135,10 +137,52 @@ public class Domain {
   */
  DomainPointer VDP;
  
 +/* (non-Javadoc)
 + * @see java.lang.Object#hashCode()
 + */
 +@Override
 +public int hashCode() {
 +final int prime = 31;
 +int result = 1;
 +result = prime * result + ((VDP == null) ? 0 : VDP.hashCode());
 +result = prime * result
 ++ ((virConnect == null) ? 0 : virConnect.hashCode());
 +return result;
 +}
 +
 +/* (non-Javadoc)
 + * @see java.lang.Object#equals(java.lang.Object)
 + */
 +@Override
 +public boolean equals(Object obj) {
 +if (this == obj)
 +return true;
 +if (obj == null)
 +return false;
 +if (!(obj instanceof Domain))
 +return false;
 +Domain other = (Domain) obj;
 +
 +// return false when this domain belongs to
 +// a different hypervisor than the other
 +if (!this.virConnect.equals(other.virConnect))
 +return false;
 +
 +if (VDP == null) return (other.VDP == null);
 +
 +if (VDP.equals(other.VDP)) return true;
 +
 +try {
 +return Arrays.equals(getUUID(), other.getUUID());
 +} catch (LibvirtException e) {
 +throw new RuntimeException(libvirt error testing domain 
 equality, e);
 +}
 +}

Again, violation of hashCode API contract due to use of UUID comparison


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 25/65] Remove processError method from Stream class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:33PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Stream.java |   64 
 +++--
  1 file changed, 20 insertions(+), 44 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 32/65] Fix memleak in StoragePool.listVolumes

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:40PM +0100, Claudio Bley wrote:
 We need to free the char* entries of the result array returned
 ourselves.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/StoragePool.java |   13 ++---
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 11 insertions(+), 4 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 35/65] Fix memleak in StorageVol.getXMLDesc

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:43PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/StorageVol.java  |8 +++-
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 8 insertions(+), 2 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] make virDomainGetMaxVcpus work on inactive domains

2014-02-21 Thread Claudio Bley
At Thu, 20 Feb 2014 12:19:35 -0700,
Jim Fehlig wrote:
 
 Claudio Bley wrote:
  Signed-off-by: Claudio Bley cb...@av-test.de
  ---
  OK, how about this patch?
 
  While at it, should I convert the VIR_DOMAIN_VCPU_* instances to
  VIR_DOMAIN_AFFECT_* instances for consistency?
 
   src/esx/esx_driver.c   |2 +-
   src/openvz/openvz_driver.c |2 +-
   src/phyp/phyp_driver.c |2 +-
   src/qemu/qemu_driver.c |2 +-
   src/test/test_driver.c |2 +-
   src/vbox/vbox_tmpl.c   |2 +-
   src/xen/xen_driver.c   |2 +-
   src/xenapi/xenapi_driver.c |2 +-

 
 I think the libxl driver should be included here too.

Seems the libxl driver does not implement the virDomainGetMaxVcpus
function.

Claudio
-- 
BSc (Comp) Claudio Bley - Principal Software Engineer
AV-TEST GmbH, Klewitzstr. 7, 39112 Magdeburg, Germany
Phone: +49 391 6075460, Fax: +49 391 6075469
Web: http://www.av-test.org

* https://twitter.com/avtestorg * https://facebook.com/avtestorg *
* https://plus.google.com/100383867141221115206/ *

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

Our services shall be effected on the basis of the General Terms
and Conditions of AV-TEST GmbH, which are accessible under
http://www.av-test.org/en/av-test/terms-and-conditions/ or
obtainable upon request.

Unsere Leistungen erfolgen auf der Grundlage der Allgemeinen
Geschäftsbedingungen der AV-TEST GmbH, die unter
http://www.av-test.org/av-test/agb/ abrufbar sind oder auf
Anfrage übersandt werden.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 26/65] Remove processError method from Connect class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:34PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..) and remove calls to the deprecated
 ErrorHandler.processError(Libvirt) method.
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   69 
 +---
  1 file changed, 11 insertions(+), 58 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 31/65] Fix memleak in Domain.snapshotListNames

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:39PM +0100, Claudio Bley wrote:
 We need to free the char* entries of the result array returned ourselves.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |   14 +++---
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 8 insertions(+), 8 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 38/65] Implement Connect.setKeepAlive

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:46PM +0100, Claudio Bley wrote:
 This wraps the virConnectSetKeepAlive libvirt function available since
 version 0.9.8.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   34 
 
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  2 files changed, 35 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 40/65] Add constants for enum virDomainEventID

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:48PM +0100, Claudio Bley wrote:
 Note: these are only used internally.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   20 
  1 file changed, 20 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 33/65] Fix memleak in DomainSnapshot.getXMLDesc

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:41PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/DomainSnapshot.java |   10 +-
  src/main/java/org/libvirt/jna/Libvirt.java|2 +-
  2 files changed, 10 insertions(+), 2 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 36/65] jna: Wrap the virEvent(Add, Remove)Timeout libvirt functions

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:44PM +0100, Claudio Bley wrote:
 These functions are not (yet) exposed in the public org.libvirt
 package but only used internally.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/jna/Libvirt.java |   11 +++
  1 file changed, 11 insertions(+)
 
 diff --git a/src/main/java/org/libvirt/jna/Libvirt.java 
 b/src/main/java/org/libvirt/jna/Libvirt.java
 index 67b6053..ae03f18 100644
 --- a/src/main/java/org/libvirt/jna/Libvirt.java
 +++ b/src/main/java/org/libvirt/jna/Libvirt.java
 @@ -98,6 +98,13 @@ public interface Libvirt extends Library {
  void eventCallback(ConnectionPointer virConnectPtr, DomainPointer 
 virDomainPointer, Pointer opaque) ;
  }
  
 +/*
 + * Timeout Callback
 + */
 +interface VirEventTimeoutCallback extends Callback {
 +void tick(int timerID, Pointer opaque);
 +}
 +
  Libvirt INSTANCE = (Libvirt) Native.loadLibrary(Platform.isWindows() ? 
 virt-0 : virt, Libvirt.class);
  
  // Constants we need
 @@ -397,4 +404,8 @@ public interface Libvirt extends Library {
  int virNWFilterGetUUID(NetworkFilterPointer virNWFilterPtr, byte[] 
 uuidString);
  int virNWFilterGetUUIDString(NetworkFilterPointer virNWFilterPtr, byte[] 
 uuidString);
  int virNWFilterUndefine(NetworkFilterPointer virNWFilterPtr);
 +
 +// Event functions
 +int virEventAddTimeout(int milliSeconds, VirEventTimeoutCallback cb, 
 Pointer opaque, Pointer ff);
 +int virEventRemoveTimeout(int timer);
  }

ACK, if you also add the virEventUpdateTimeout  method


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 41/65] Prepare to define proper domain event callback support

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:49PM +0100, Claudio Bley wrote:
 Remove the public domainEventRegisterAny and domainEventDeregisterAny
 methods. These methods basically were of no use since the only thing you
 could register was a generic callback.
 
 At runtime, you would have to provide a real callback function matching
 the prototype of the native callback type.
 
 Trying to use a generic callback instead quickly leads to failures or
 JVM crashes.
 
 For convenience and the sake of type safety we don't let the
 user deal with Libvirt.VirDomainEventCallback interfaces directly.
 
 Instead, there will be a specific interface definition for each type
 of callback as we soon shall see.
 
 To prevent the garbage collector from reaping registered callback objects
 every event callback will be stored along with its eventID and
 corresponding listener instance.
 
 This will provide a natural, idiomatic interface using
 addListener/removeListener methods.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   79 
 
  src/main/java/org/libvirt/event/EventListener.java |7 ++
  src/main/java/org/libvirt/jna/Libvirt.java |   22 --
  3 files changed, 73 insertions(+), 35 deletions(-)
  create mode 100644 src/main/java/org/libvirt/event/EventListener.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 43/65] events: handle registration for IOError events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:51PM +0100, Claudio Bley wrote:
 Add IOErrorActionListener and IOErrorAction enum which is handed to the
 onIOError callback method when an IO error event occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   59 
 
  src/main/java/org/libvirt/Domain.java  |   16 ++
  src/main/java/org/libvirt/Library.java |   20 +++
  src/main/java/org/libvirt/event/IOErrorAction.java |   39 +
  .../java/org/libvirt/event/IOErrorListener.java|   21 +++
  src/main/java/org/libvirt/jna/Libvirt.java |8 +++
  6 files changed, 163 insertions(+)
  create mode 100644 src/main/java/org/libvirt/event/IOErrorAction.java
  create mode 100644 src/main/java/org/libvirt/event/IOErrorListener.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 44/65] events: handle registration for Reboot events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:52PM +0100, Claudio Bley wrote:
 Add RebootListener interface in package org.libvirt.event and
 implement addRebootListener methods in classes Domain and Connect.
 
 Add removeRebootListener to Connect class.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   41 
 
  src/main/java/org/libvirt/Domain.java  |   17 
  .../java/org/libvirt/event/RebootListener.java |   15 +++
  src/main/java/org/libvirt/jna/Libvirt.java |4 ++
  4 files changed, 77 insertions(+)
  create mode 100644 src/main/java/org/libvirt/event/RebootListener.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 34/65] Fix memleak in StorageVol.getPath

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:42PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/StorageVol.java  |   10 +-
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 10 insertions(+), 2 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 49/65] Implement connection close callback support

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:57PM +0100, Claudio Bley wrote:
 There can only be a single connection close listener registered
 per connection object.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   57 
 
  src/main/java/org/libvirt/jna/Libvirt.java |   11 ++
  2 files changed, 68 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 46/65] test: add unit test for domain lifecycle events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:54PM +0100, Claudio Bley wrote:
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/org/libvirt/TestJavaBindings.java |   69 
 +++
  1 file changed, 69 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 39/65] Introduce event loop support

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:47PM +0100, Claudio Bley wrote:
 Add initEventLoop(), processEvent(), runEventLoop() and stopEventLoop()
 static methods to the Library class.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Library.java |   91 
 
  src/main/java/org/libvirt/jna/Libvirt.java |4 ++
  2 files changed, 95 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 45/65] events: handle registration of domain lifecycle events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:53PM +0100, Claudio Bley wrote:
 Add LifecycleListener interface which needs to be implemented
 when the user wishes to receive lifecycle change events on domains.
 
 The DomainEvent class represents the kind of event that
 occurred including details on that event.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   66 ++
  src/main/java/org/libvirt/Domain.java  |   18 +
  src/main/java/org/libvirt/event/CrashedDetail.java |   15 +
  src/main/java/org/libvirt/event/DefinedDetail.java |   17 +
  src/main/java/org/libvirt/event/DetailInfo.java|5 ++
  src/main/java/org/libvirt/event/DomainEvent.java   |   71 
 
  .../java/org/libvirt/event/DomainEventDetail.java  |7 ++
  .../java/org/libvirt/event/DomainEventType.java|   60 +
  .../java/org/libvirt/event/LifecycleListener.java  |   24 +++
  .../java/org/libvirt/event/PMSuspendedDetail.java  |   15 +
  src/main/java/org/libvirt/event/ResumedDetail.java |   20 ++
  .../java/org/libvirt/event/ShutdownDetail.java |   12 
  src/main/java/org/libvirt/event/StartedDetail.java |   30 +
  src/main/java/org/libvirt/event/StoppedDetail.java |   40 +++
  .../java/org/libvirt/event/SuspendedDetail.java|   40 +++
  .../java/org/libvirt/event/UndefinedDetail.java|7 ++
  src/main/java/org/libvirt/jna/Libvirt.java |7 ++
  17 files changed, 454 insertions(+)
  create mode 100644 src/main/java/org/libvirt/event/CrashedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/DefinedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/DetailInfo.java
  create mode 100644 src/main/java/org/libvirt/event/DomainEvent.java
  create mode 100644 src/main/java/org/libvirt/event/DomainEventDetail.java
  create mode 100644 src/main/java/org/libvirt/event/DomainEventType.java
  create mode 100644 src/main/java/org/libvirt/event/LifecycleListener.java
  create mode 100644 src/main/java/org/libvirt/event/PMSuspendedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/ResumedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/ShutdownDetail.java
  create mode 100644 src/main/java/org/libvirt/event/StartedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/StoppedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/SuspendedDetail.java
  create mode 100644 src/main/java/org/libvirt/event/UndefinedDetail.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 48/65] events: add support for PMSuspend events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:56PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   59 
 
  src/main/java/org/libvirt/Domain.java  |   20 +++
  .../java/org/libvirt/event/PMSuspendListener.java  |   17 ++
  .../java/org/libvirt/event/PMSuspendReason.java|5 ++
  4 files changed, 101 insertions(+)
  create mode 100644 src/main/java/org/libvirt/event/PMSuspendListener.java
  create mode 100644 src/main/java/org/libvirt/event/PMSuspendReason.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 50/65] Implement Connect.getSysinfo

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:58PM +0100, Claudio Bley wrote:
 This wraps the virConnectGetSysinfo function available since libvirt
 version 0.8.8.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   21 +
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  2 files changed, 22 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 53/65] Implement Secret.getUsageType

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:01PM +0100, Claudio Bley wrote:
 This wraps the virSecretGetUsageType libvirt function available since
 version 0.7.1.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Secret.java  |5 +
  src/main/java/org/libvirt/SecretUsageType.java |   23 +++
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  3 files changed, 29 insertions(+)
  create mode 100644 src/main/java/org/libvirt/SecretUsageType.java

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 52/65] Implement Domain.memoryPeek

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:00PM +0100, Claudio Bley wrote:
 This wraps the virDomainMemoryPeek libvirt function, available since
 version 0.4.5.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java|   40 
 ++
  src/main/java/org/libvirt/MemoryAddressMode.java |   19 ++
  src/main/java/org/libvirt/jna/Libvirt.java   |5 +--
  3 files changed, 60 insertions(+), 4 deletions(-)
  create mode 100644 src/main/java/org/libvirt/MemoryAddressMode.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 55/65] Implement Domain.reset

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:03PM +0100, Claudio Bley wrote:
 This wraps the virDomainReset libvirt function available since
 version 0.9.7.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |7 +++
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  2 files changed, 8 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 59/65] Implement Domain.screenshot

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:07PM +0100, Claudio Bley wrote:
 This wraps the native virDomainScreenshot libvirt function available
 since version 0.9.2.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |   10 ++
  src/main/java/org/libvirt/Stream.java  |4 
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  3 files changed, 15 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 60/65] test: add testDomainScreenshot JUnit test

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:08PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/test/java/org/libvirt/TestJavaBindings.java |   44 
 +++
  1 file changed, 44 insertions(+)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 58/65] Implement interface ByteChannel for Stream class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:06PM +0100, Claudio Bley wrote:
 This makes the Stream class a native citizen of the Java API.
 
 It can be used with the NIO Channel API, as well as (In,Out)putStream's
 using the java.nio.channels.Channels convenience wrappers.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Stream.java  |  183 
 ++--
  src/main/java/org/libvirt/jna/Libvirt.java |4 +-
  2 files changed, 178 insertions(+), 9 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 42/65] Add constructIncRef factory method to Domain class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:50PM +0100, Claudio Bley wrote:
 This method constructs a new Domain class instance while
 increasing the reference count on the virDomainPtr in
 order to make sure the Domain object owns the given
 virDomainPtr.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |   14 ++
  src/main/java/org/libvirt/jna/Libvirt.java |2 +-
  2 files changed, 15 insertions(+), 1 deletion(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 47/65] events: handle registration for PMWakeup events

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:55PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   57 
 
  src/main/java/org/libvirt/Domain.java  |   20 +++
  .../java/org/libvirt/event/PMWakeupListener.java   |   17 ++
  .../java/org/libvirt/event/PMWakeupReason.java |5 ++
  src/main/java/org/libvirt/jna/Libvirt.java |6 +++
  5 files changed, 105 insertions(+)
  create mode 100644 src/main/java/org/libvirt/event/PMWakeupListener.java
  create mode 100644 src/main/java/org/libvirt/event/PMWakeupReason.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 54/65] Implement Domain.isUpdated

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:02PM +0100, Claudio Bley wrote:
 This wraps the virDomainIsUpdated libvirt function available since version
 0.8.6.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |8 
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  2 files changed, 9 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 62/65] Connect: add constructors using java.net.URI params

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:10PM +0100, Claudio Bley wrote:
 Additionally, add an OpenFlags enum to the Connect classes which
 implements the BitFlags interface.
 
 This should be used when creating a read-only connection or
 to prevent using URI aliases.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |  104 
 +---
  1 file changed, 82 insertions(+), 22 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] XML: Escape double-hyphens in XML comment

2014-02-21 Thread Ján Tomko
On 02/21/2014 10:01 AM, Philipp Hahn wrote:
 To quote http://www.w3.org/TR/REC-xml/#sec-comments:
 For compatibility, the string -- (double-hyphen) must not occur within 
 comments.
 
 For example this breaks creating snapshots:
 $ virsh snapshot-create-as $VM comment--bug
 $ xmllint --noout /var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml
 /var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml:4: parser error : Comment 
 not terminated
 !--
 WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES
   virsh snapshot-edit $VM comment--bug
 $ /etc/init.d/libvirt-bin restart
 error : qemuDomainSnapshotLoad:367 : Failed to parse snapshot XML from file 
 '/var/lib/libvirt/qemu/snapshot/$VM/comment--bug.xml'
 $ virsh snapshot-list ucs32-33787-performance
  Name Creation Time State
 
 
 Also applies to QEMU domains, where the name contains double-hyphens.

This no longer reproduces with current master, it has been fixed by either of:
commit 0b121614a2086a8e66ae1f004fe912ba7c1d8a75
Author: Ján Tomko jto...@redhat.com
CommitDate: 2012-10-29 14:38:43 +0100

xml: print uuids in the warning

commit 9b704ab8235af010b1fda4886201aab02098b969
Author: Ján Tomko jto...@redhat.com
CommitDate: 2012-10-23 14:24:31 +0200

xml: omit domain name from comment if it contains double hyphen

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 63/65] Replace Connect.getLibVirVersion method with Library.getVersion

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:11PM +0100, Claudio Bley wrote:
 It should not be necessary to create a Connect object in order to
 determine the version of the libvirt library.
 
 Introduce Library.getVersion which returns this information.
 
 Deprecate Connect.getLibVirVersion but keep it for backwards compat.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java|5 +++--
  src/main/java/org/libvirt/Library.java|   15 ++-
  src/test/java/org/libvirt/TestJavaBindings.java   |3 +--
  src/test/java/org/libvirt/TestLibvirtGlobals.java |4 
  4 files changed, 22 insertions(+), 5 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 37/65] Implement Connect.isAlive

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:45PM +0100, Claudio Bley wrote:
 This wraps the virConnectIsAlive libvirt function available since
 version 0.9.8.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java  |   12 
  src/main/java/org/libvirt/jna/Libvirt.java  |1 +
  src/test/java/org/libvirt/TestJavaBindings.java |1 +
  3 files changed, 14 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 64/65] Replace static connectionVersion method with getLibVersion

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:12PM +0100, Claudio Bley wrote:
 Since the libvirt version information is a property of an *instance* of a
 connnection, the method to retrieve this information should not be static.
 
 Deprecate its use and recommend using aConnect.getLibVersion instead.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java  |   18 ++
  src/test/java/org/libvirt/TestJavaBindings.java |2 +-
  2 files changed, 19 insertions(+), 1 deletion(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 glib] gobject-stream: fix issue found by coverity

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 20, 2014 at 04:58:21PM +0100, Pavel Hrdina wrote:
 The coverity server found issue in gvir_stream_close function that
 we ignore return values of g_input_stream_close and
 g_output_stream_close, but we also ignore the error message and we
 assume that it's closed without error.
 
 Now we will check return values and also propagate the error message
 to the upper layers. We should try to close both streams even if
 closing the first one will fails. We can propagate only one error
 message.
 
 Signed-off-by: Pavel Hrdina phrd...@redhat.com
 ---
  libvirt-gobject/libvirt-gobject-stream.c | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 61/65] Add helper for handling bit-flags

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:09PM +0100, Claudio Bley wrote:
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/BitFlags.java |   18 ++
  1 file changed, 18 insertions(+)
  create mode 100644 src/main/java/org/libvirt/BitFlags.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 57/65] Implement Domain.sendKey

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:05PM +0100, Claudio Bley wrote:
 This wraps the virDomainSendKey libvirt function available since version
 0.9.3.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |   12 
  src/main/java/org/libvirt/KeycodeSet.java  |   46 
 
  src/main/java/org/libvirt/jna/Libvirt.java |1 +
  3 files changed, 59 insertions(+)
  create mode 100644 src/main/java/org/libvirt/KeycodeSet.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 00/65]

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:08PM +0100, Claudio Bley wrote:
 Hi.
 
 Here are a few patches that piled up in my local branch. Some of them
 I already submitted to this list, but there has been no reponse to
 them.
 
 Included are a few trivial fixes as well as memory leak fixes and
 additions to the public API.
 
 There had been some minor interest in my first version of domain event
 support in the Java wrapper[1], which I have reworked almost entirely.
 
 If nobody objects, say, within the next two weeks or so, I'll go ahead
 and push the whole series as was suggested to me by Daniel P. Berrange
 on this list[2].
 
 I've made sure that all JUnit tests pass after every commit with JNA
 versions 3.4.1, 3.4.2, 3.5.0, 3.5.1, 3.5.2 and 4.0.0.
 
 I'd really appreciate your comments or suggestions.

I've ACK'd all of the patches except for the one about virFree and a
couple related to hashCode/equals implementation.

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v12 01/11] change used_by: specify both driver and domain

2014-02-21 Thread Daniel P. Berrange
On Mon, Feb 17, 2014 at 09:31:36AM +0100, Cedric Bosdonnat wrote:
  diff --git a/src/util/virpci.c b/src/util/virpci.c
  index 00d1064..4ea2bcf 100644
  --- a/src/util/virpci.c
  +++ b/src/util/virpci.c
  @@ -59,7 +59,10 @@ struct _virPCIDevice {
   char  name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
   char  id[PCI_ID_LEN]; /* product vendor */
   char  *path;
  -const char*used_by;   /* The domain which uses the device 
  */
  +
  +/* The driver:domain which uses the device */
  +char  *used_by_drvname;
  +char  *used_by_domname;
 
 Why changing from const char* to char*?

I requested this change previously. These values are passed into this
class by its callers. It is bad design practice to assume you can
keep a reference to pointers that are passed into you - they could
be free'd by the caller at any time. strdup'ing them provides a
safer API design.


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 51/65] Implement Domain.blockPeek

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:59PM +0100, Claudio Bley wrote:
 This wraps the virDomainBlockPeek libvirt function, available since
 version 0.4.5.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java  |   53 
 
  src/main/java/org/libvirt/jna/Libvirt.java |4 +++
  2 files changed, 57 insertions(+)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] XML: Escape double-hyphens in XML comment

2014-02-21 Thread Philipp Hahn
On 21.02.2014 12:18, Ján Tomko wrote:
 This no longer reproduces with current master, it has been fixed by either of:
 commit 0b121614a2086a8e66ae1f004fe912ba7c1d8a75
 Author: Ján Tomko jto...@redhat.com
 CommitDate: 2012-10-29 14:38:43 +0100
 
 xml: print uuids in the warning
 
 commit 9b704ab8235af010b1fda4886201aab02098b969
 Author: Ján Tomko jto...@redhat.com
 CommitDate: 2012-10-23 14:24:31 +0200
 
 xml: omit domain name from comment if it contains double hyphen

Thanks and sorry for the noise - your solution looks much better :-)

Philipp



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 56/65] Implement Domain.PMwakeup

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:04PM +0100, Claudio Bley wrote:
 This wraps the virDomainPMWakeup libvirt function available since
 version 0.9.11.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Domain.java|   27 
 ++
  src/main/java/org/libvirt/SuspendTarget.java |   15 ++
  src/main/java/org/libvirt/jna/Libvirt.java   |2 ++
  3 files changed, 44 insertions(+)
  create mode 100644 src/main/java/org/libvirt/SuspendTarget.java

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 65/65] Deprecate Connect.getHypervisorVersion

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:23:13PM +0100, Claudio Bley wrote:
 In libvirt 0.9.3 this has been changed to simply return the libvirt
 version number.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Connect.java |   11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)

ACK


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 00/65]

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:08PM +0100, Claudio Bley wrote:
 Hi.
 
 Here are a few patches that piled up in my local branch. Some of them
 I already submitted to this list, but there has been no reponse to
 them.
 
 Included are a few trivial fixes as well as memory leak fixes and
 additions to the public API.
 
 There had been some minor interest in my first version of domain event
 support in the Java wrapper[1], which I have reworked almost entirely.
 
 If nobody objects, say, within the next two weeks or so, I'll go ahead
 and push the whole series as was suggested to me by Daniel P. Berrange
 on this list[2].

BTW, when you push these patches, you should also update AUTHORS
to list yourself as the primary maintainer of the binding, similar
to how we list maintainers in the main libvirt AUTHORS file.


Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 01/10] nwfilter: don't ignore child process failures

2014-02-21 Thread Laine Stump
On 02/20/2014 07:13 AM, Eric Blake wrote:
 While auditing all callers of virCommandRun, I noticed that nwfilter
 code never paid attention to commands with a non-zero status.
 In the cases where status was captured, either the callers required
 that the status was 0, or they discarded any failures from
 virCommandRun.  Collecting status manually means that a non-zero
 child exit status is not logged, but I could not see the benefit
 in avoiding the logging in any command issued in the code.
 Therefore, it was simpler to just nuke the wasted effort of
 manually checking or ignoring non-zero status.

You need to be careful with this - for some of the external execs in
nwfilter (same with viriptables.c), a non-0 status *should* be ignored
and not reported. In particular, if a command that is attempting to
remove an iptables or ebtables rule fails, that is often because libvirt
is attempting to remove a rule that actually isn't there.

As a matter of fact, in all the cases where the 2nd argument to
ebiptablesExecCLI is non-NULL, that is exactly what's happening - the
code was written that way to avoid putting a bogus and misleading error
message in the logs; viriptables.c *does* log these errors, and that has
led to many bug reports that incorrectly list the error message about
failure to remove a rule as evidence that there is a bug. (I think there
may even be a BZ filed requesting that these error logs be removed
because they are misleading.)

Because of the experience with viriptables.c, I don't think we should
change the code to add back in the logging of these messages.


 While at it, I also noticed that ebiptablesRemoveRules would
 actually report success if the child process failed for a
 reason other than non-zero status, such as OOM.

 * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
 Drop parameter.
 (ebtablesApplyBasicRules, ebtablesApplyDHCPOnlyRules)
 (ebtablesApplyDropAllRules, ebtablesCleanAll)
 (ebiptablesApplyNewRules, ebiptablesTearNewRules)
 (ebiptablesTearOldRules, ebiptablesAllTeardown)
 (ebiptablesDriverInitWithFirewallD)
 (ebiptablesDriverTestCLITools, ebiptablesDriverProbeStateMatch):
 Adjust all clients.
 (ebiptablesRemoveRules): Likewise, and fix return value on failure.

 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/nwfilter/nwfilter_ebiptables_driver.c | 89 
 ---
  1 file changed, 35 insertions(+), 54 deletions(-)

 diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c 
 b/src/nwfilter/nwfilter_ebiptables_driver.c
 index dc651a2..002a844 100644
 --- a/src/nwfilter/nwfilter_ebiptables_driver.c
 +++ b/src/nwfilter/nwfilter_ebiptables_driver.c
 @@ -1,7 +1,7 @@
  /*
   * nwfilter_ebiptables_driver.c: driver for ebtables/iptables on tap devices
   *
 - * Copyright (C) 2011-2013 Red Hat, Inc.
 + * Copyright (C) 2011-2014 Red Hat, Inc.
   * Copyright (C) 2010-2012 IBM Corp.
   * Copyright (C) 2010-2012 Stefan Berger
   *
 @@ -2799,8 +2799,6 @@ ebiptablesDisplayRuleInstance(void *_inst)
   * ebiptablesExecCLI:
   * @buf : pointer to virBuffer containing the string with the commands to
   *execute.
 - * @status: Pointer to an integer for returning the WEXITSTATUS of the
 - *commands executed via the script the was run.
   * @outbuf: Optional pointer to a string that will hold the buffer with
   *  output of the executed command. The actual buffer holding
   *  the message will be newly allocated by this function and
 @@ -2815,15 +2813,11 @@ ebiptablesDisplayRuleInstance(void *_inst)
   * NULL, then the script must exit with status 0).
   */
  static int
 -ebiptablesExecCLI(virBufferPtr buf,
 -  int *status, char **outbuf)
 +ebiptablesExecCLI(virBufferPtr buf, char **outbuf)
  {
  int rc = -1;
  virCommandPtr cmd;

 -if (status)
 - *status = 0;
 -
  if (!virBufferError(buf)  !virBufferUse(buf))
  return 0;

 @@ -2837,7 +2831,7 @@ ebiptablesExecCLI(virBufferPtr buf,

  virMutexLock(execCLIMutex);

 -rc = virCommandRun(cmd, status);
 +rc = virCommandRun(cmd, NULL);

  virMutexUnlock(execCLIMutex);

 @@ -3293,7 +3287,7 @@ ebtablesApplyBasicRules(const char *ifname,
  ebtablesLinkTmpRootChain(buf, 1, ifname, 1);
  ebtablesRenameTmpRootChain(buf, 1, ifname);

 -if (ebiptablesExecCLI(buf, NULL, NULL)  0)
 +if (ebiptablesExecCLI(buf, NULL)  0)
  goto tear_down_tmpebchains;

  return 0;
 @@ -3441,7 +3435,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname,
  ebtablesRenameTmpRootChain(buf, 0, ifname);
  }

 -if (ebiptablesExecCLI(buf, NULL, NULL)  0)
 +if (ebiptablesExecCLI(buf, NULL)  0)
  goto tear_down_tmpebchains;

  return 0;
 @@ -3511,7 +3505,7 @@ ebtablesApplyDropAllRules(const char *ifname)
  ebtablesRenameTmpRootChain(buf, 1, ifname);
  ebtablesRenameTmpRootChain(buf, 0, ifname);

 -if (ebiptablesExecCLI(buf, NULL, NULL)  0)
 +if (ebiptablesExecCLI(buf, NULL)  0)
 

Re: [libvirt] [PATCH v2 glib] gobject-stream: fix issue found by coverity

2014-02-21 Thread Pavel Hrdina

On 21.2.2014 12:24, Daniel P. Berrange wrote:

On Thu, Feb 20, 2014 at 04:58:21PM +0100, Pavel Hrdina wrote:

The coverity server found issue in gvir_stream_close function that
we ignore return values of g_input_stream_close and
g_output_stream_close, but we also ignore the error message and we
assume that it's closed without error.

Now we will check return values and also propagate the error message
to the upper layers. We should try to close both streams even if
closing the first one will fails. We can propagate only one error
message.

Signed-off-by: Pavel Hrdina phrd...@redhat.com
---
  libvirt-gobject/libvirt-gobject-stream.c | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)


ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|



Thanks, pushed.

Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH glib] Disable test suite unless glib = 2.38

2014-02-21 Thread Pavel Hrdina

On 20.2.2014 17:24, Daniel P. Berrange wrote:

The TAP harness for glib only works with version 2.38 or later,
so must be disabled for earlier versions

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---


ACK

Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 22/65] Remove processError method from Secret class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:30PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/Secret.java |   61 
 +
  1 file changed, 16 insertions(+), 45 deletions(-)

ACK

Regards,
Daniel
--
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 21/65] Remove processError method from NetworkFilter class

2014-02-21 Thread Daniel P. Berrange
On Thu, Feb 13, 2014 at 04:22:29PM +0100, Claudio Bley wrote:
 Wrap any fallible libvirt function in a call to
 ErrorHandler.processError(..).
 
 Also correct wrong javadoc comments stating that methods would return
 a value in case an error occurs.
 
 Signed-off-by: Claudio Bley cb...@av-test.de
 ---
  src/main/java/org/libvirt/NetworkFilter.java |   43 
 ++
  1 file changed, 10 insertions(+), 33 deletions(-)

ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices

2014-02-21 Thread Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1031696

When creating a new domain, we let systemd know about it by calling
CreateMachine() function via dbus. Systemd then creates a scope and
places domain into it. However, later when the host is shutting
down, systemd computes the shutdown order to see what processes can
be shut down in parallel. And since we were not setting
dependencies at all, the slices (and thus domains) were most likely
killed before libvirt-guests.service. So user domains that had to
be saved, shut off, whatever were in fact killed.  This problem can
be solved by letting systemd know that scopes we're creating must
not be killed before libvirt-guests.service.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 src/util/virsystemd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 503fff7..9247c92 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -243,8 +243,10 @@ int virSystemdCreateMachine(const char *name,
   iscontainer ? container : vm,
   (unsigned int)pidleader,
   rootdir ? rootdir : ,
-  1, Slice, s,
-  slicename)  0)
+  3,
+  Slice, s, slicename,
+  After, as, 1, libvirtd.service,
+  Before, as, 1, libvirt-guests.service)  0)
 goto cleanup;
 
 ret = 0;
-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/3] Couple of libvirt-guests fixes

2014-02-21 Thread Michal Privoznik
*** BLURB HERE ***

Michal Privoznik (3):
  virSystemdCreateMachine: Set dependencies for slices
  libvirt-guests: Wait for libirtd to initialize
  virNetServerRun: Notify systemd that we're accepting clients

 configure.ac   |  2 ++
 daemon/libvirtd.service.in |  1 +
 m4/virt-systemd-daemon.m4  | 34 ++
 src/Makefile.am|  4 ++--
 src/libvirt_private.syms   |  1 +
 src/rpc/virnetserver.c |  7 +++
 src/util/virsystemd.c  | 18 --
 src/util/virsystemd.h  |  2 ++
 tools/libvirt-guests.sh.in | 19 +--
 9 files changed, 78 insertions(+), 10 deletions(-)
 create mode 100644 m4/virt-systemd-daemon.m4

-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize

2014-02-21 Thread Michal Privoznik
I've noticed that in some cases systemd was quick enough and even
if libvirt-guests.service is marked to be started after the
libvirtd.service my guests were not resumed as
libvirt-guests.sh failed to connect. This is because of a
simple fact: systemd correctly starts libvirt-guests after it
execs libvirtd. However, the daemon is not able to accept
connections right from the start. It's doing some
initialization which may take ages. This problem is not limited
to systemd only, indeed. Any init system that is able to startup
services in parallel (e.g. OpenRC) may run into this situation.
The fix is to try connecting not only once, but continuously a few
times with a small sleep in between tries.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 tools/libvirt-guests.sh.in | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 38e93c5..f14598e 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -37,6 +37,8 @@ SHUTDOWN_TIMEOUT=300
 PARALLEL_SHUTDOWN=0
 START_DELAY=0
 BYPASS_CACHE=0
+CONNECT_RETRIES=10
+RETRIES_SLEEP=.5
 
 test -f $sysconfdir/sysconfig/libvirt-guests 
 . $sysconfdir/sysconfig/libvirt-guests
@@ -87,12 +89,17 @@ test_connect()
 {
 uri=$1
 
-run_virsh $uri connect 2/dev/null
-if [ $? -ne 0 ]; then
-eval_gettext Can't connect to \$uri. Skipping.
-echo
-return 1
-fi
+for ((i = 0; i  ${CONNECT_RETRIES}; i++)); do
+run_virsh $uri connect 2/dev/null
+if [ $? -eq 0 ]; then
+return 0;
+fi
+sleep ${RETRIES_SLEEP}
+eval_gettext Unable to connect to libvirt currently. Retrying .. \$i
+done
+eval_gettext Can't connect to \$uri. Skipping.
+echo
+return 1
 }
 
 # list_guests URI PERSISTENT
-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/3] virNetServerRun: Notify systemd that we're accepting clients

2014-02-21 Thread Michal Privoznik
Systemd does not forget about the cases, where client service needs to
wait for daemon service to initialize and start accepting new clients.
Setting a dependency in client is not enough as systemd doesn't know
when the daemon has initialized itself and started accepting new
clients. However, it offers a mechanism to solve this. The daemon needs
to call a special systemd function by which the daemon tells I'm ready
to accept new clients. This is exactly what we need with
libvirtd-guests (client) and libvirtd (daemon). So now, with this
change, libvirt-guests.service is invoked not any sooner than
libvirtd.service calls the systemd notify function.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 configure.ac   |  2 ++
 daemon/libvirtd.service.in |  1 +
 m4/virt-systemd-daemon.m4  | 34 ++
 src/Makefile.am|  4 ++--
 src/libvirt_private.syms   |  1 +
 src/rpc/virnetserver.c |  7 +++
 src/util/virsystemd.c  | 12 
 src/util/virsystemd.h  |  2 ++
 8 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 m4/virt-systemd-daemon.m4

diff --git a/configure.ac b/configure.ac
index 9e76353..f30ac76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,6 +239,7 @@ LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_SASL
 LIBVIRT_CHECK_SELINUX
 LIBVIRT_CHECK_SSH2
+LIBVIRT_CHECK_SYSTEMD_DAEMON
 LIBVIRT_CHECK_UDEV
 LIBVIRT_CHECK_YAJL
 
@@ -2773,6 +2774,7 @@ LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_SASL
 LIBVIRT_RESULT_SELINUX
 LIBVIRT_RESULT_SSH2
+LIBVIRT_RESULT_SYSTEMD_DAEMON
 LIBVIRT_RESULT_UDEV
 LIBVIRT_RESULT_YAJL
 AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index dc2433a..e1f2a07 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -13,6 +13,7 @@ Documentation=man:libvirtd(8)
 Documentation=http://libvirt.org
 
 [Service]
+Type=notify
 EnvironmentFile=-/etc/sysconfig/libvirtd
 ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
diff --git a/m4/virt-systemd-daemon.m4 b/m4/virt-systemd-daemon.m4
new file mode 100644
index 000..8516e41
--- /dev/null
+++ b/m4/virt-systemd-daemon.m4
@@ -0,0 +1,34 @@
+dnl The libsystemd-daemon.so library
+dnl
+dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+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/.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_SYSTEMD_DAEMON],[
+  LIBVIRT_CHECK_PKG([SYSTEMD_DAEMON], [libsystemd-daemon], [0.27.1])
+
+old_CFLAGS=$CFLAGS
+old_LIBS=$LIBS
+CFLAGS=$CFLAGS $SYSTEMD_DAEMON_CFLAGS
+LIBS=$LIBS $SYSTEMD_DAEMON_LIBS
+AC_CHECK_FUNCS([sd_notify])
+CFLAGS=$old_CFLAGS
+LIBS=$old_LIBS
+])
+
+AC_DEFUN([LIBVIRT_RESULT_SYSTEMD_DAEMON],[
+  LIBVIRT_RESULT_LIB([SYSTEMD_DAEMON])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 6d21e5d..6ef32ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -958,11 +958,11 @@ libvirt_util_la_SOURCES = 
\
 libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
$(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \
$(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS)  \
-   -I$(top_srcdir)/src/conf
+   $(SYSTEMD_DAEMON_CFLAGS) -I$(top_srcdir)/src/conf
 libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
$(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS) \
-   $(SECDRIVER_LIBS) $(NUMACTL_LIBS)
+   $(SECDRIVER_LIBS) $(NUMACTL_LIBS) $(SYSTEMD_DAEMON_LIBS)
 
 
 noinst_LTLIBRARIES += libvirt_conf.la
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0896287..21c6b66 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1826,6 +1826,7 @@ virSystemdCreateMachine;
 virSystemdMakeMachineName;
 virSystemdMakeScopeName;
 virSystemdMakeSliceName;
+virSystemdNotifyStartup;
 virSystemdTerminateMachine;
 
 
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 8907768..be27913 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -38,6 +38,7 @@
 #include virnetservermdns.h
 #include virdbus.h
 #include virstring.h
+#include virsystemd.h
 
 #ifndef SA_SIGINFO
 # define SA_SIGINFO 0
@@ 

Re: [libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 01:32:36PM +0100, Michal Privoznik wrote:
 I've noticed that in some cases systemd was quick enough and even
 if libvirt-guests.service is marked to be started after the
 libvirtd.service my guests were not resumed as
 libvirt-guests.sh failed to connect. This is because of a
 simple fact: systemd correctly starts libvirt-guests after it
 execs libvirtd. However, the daemon is not able to accept
 connections right from the start. It's doing some
 initialization which may take ages. This problem is not limited
 to systemd only, indeed. Any init system that is able to startup
 services in parallel (e.g. OpenRC) may run into this situation.
 The fix is to try connecting not only once, but continuously a few
 times with a small sleep in between tries.

The long term fix for this will be to use socket activation for
libvirtd. Unfortunately we can't do that yet since then VMs marked
to autostart on boot won't be booted


ACK

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 01:32:35PM +0100, Michal Privoznik wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1031696
 
 When creating a new domain, we let systemd know about it by calling
 CreateMachine() function via dbus. Systemd then creates a scope and
 places domain into it. However, later when the host is shutting
 down, systemd computes the shutdown order to see what processes can
 be shut down in parallel. And since we were not setting
 dependencies at all, the slices (and thus domains) were most likely
 killed before libvirt-guests.service. So user domains that had to
 be saved, shut off, whatever were in fact killed.  This problem can
 be solved by letting systemd know that scopes we're creating must
 not be killed before libvirt-guests.service.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/3] virNetServerRun: Notify systemd that we're accepting clients

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 01:32:37PM +0100, Michal Privoznik wrote:
 Systemd does not forget about the cases, where client service needs to
 wait for daemon service to initialize and start accepting new clients.
 Setting a dependency in client is not enough as systemd doesn't know
 when the daemon has initialized itself and started accepting new
 clients. However, it offers a mechanism to solve this. The daemon needs
 to call a special systemd function by which the daemon tells I'm ready
 to accept new clients. This is exactly what we need with
 libvirtd-guests (client) and libvirtd (daemon). So now, with this
 change, libvirt-guests.service is invoked not any sooner than
 libvirtd.service calls the systemd notify function.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  configure.ac   |  2 ++
  daemon/libvirtd.service.in |  1 +
  m4/virt-systemd-daemon.m4  | 34 ++
  src/Makefile.am|  4 ++--
  src/libvirt_private.syms   |  1 +
  src/rpc/virnetserver.c |  7 +++
  src/util/virsystemd.c  | 12 
  src/util/virsystemd.h  |  2 ++
  8 files changed, 61 insertions(+), 2 deletions(-)
  create mode 100644 m4/virt-systemd-daemon.m4
 
 diff --git a/configure.ac b/configure.ac
 index 9e76353..f30ac76 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -239,6 +239,7 @@ LIBVIRT_CHECK_SANLOCK
  LIBVIRT_CHECK_SASL
  LIBVIRT_CHECK_SELINUX
  LIBVIRT_CHECK_SSH2
 +LIBVIRT_CHECK_SYSTEMD_DAEMON
  LIBVIRT_CHECK_UDEV
  LIBVIRT_CHECK_YAJL
  
 @@ -2773,6 +2774,7 @@ LIBVIRT_RESULT_SANLOCK
  LIBVIRT_RESULT_SASL
  LIBVIRT_RESULT_SELINUX
  LIBVIRT_RESULT_SSH2
 +LIBVIRT_RESULT_SYSTEMD_DAEMON
  LIBVIRT_RESULT_UDEV
  LIBVIRT_RESULT_YAJL
  AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
 diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
 index dc2433a..e1f2a07 100644
 --- a/daemon/libvirtd.service.in
 +++ b/daemon/libvirtd.service.in
 @@ -13,6 +13,7 @@ Documentation=man:libvirtd(8)
  Documentation=http://libvirt.org
  
  [Service]
 +Type=notify
  EnvironmentFile=-/etc/sysconfig/libvirtd
  ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
  ExecReload=/bin/kill -HUP $MAINPID
 diff --git a/m4/virt-systemd-daemon.m4 b/m4/virt-systemd-daemon.m4
 new file mode 100644
 index 000..8516e41
 --- /dev/null
 +++ b/m4/virt-systemd-daemon.m4
 @@ -0,0 +1,34 @@
 +dnl The libsystemd-daemon.so library
 +dnl
 +dnl Copyright (C) 2012-2013 Red Hat, Inc.
 +dnl
 +dnl This library is free software; you can redistribute it and/or
 +dnl modify it under the terms of the GNU Lesser General Public
 +dnl License as published by the Free Software Foundation; either
 +dnl version 2.1 of the License, or (at your option) any later version.
 +dnl
 +dnl This library is distributed in the hope that it will be useful,
 +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +dnl Lesser General Public License for more details.
 +dnl
 +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/.
 +dnl
 +
 +AC_DEFUN([LIBVIRT_CHECK_SYSTEMD_DAEMON],[
 +  LIBVIRT_CHECK_PKG([SYSTEMD_DAEMON], [libsystemd-daemon], [0.27.1])
 +
 +old_CFLAGS=$CFLAGS
 +old_LIBS=$LIBS
 +CFLAGS=$CFLAGS $SYSTEMD_DAEMON_CFLAGS
 +LIBS=$LIBS $SYSTEMD_DAEMON_LIBS
 +AC_CHECK_FUNCS([sd_notify])
 +CFLAGS=$old_CFLAGS
 +LIBS=$old_LIBS
 +])
 +
 +AC_DEFUN([LIBVIRT_RESULT_SYSTEMD_DAEMON],[
 +  LIBVIRT_RESULT_LIB([SYSTEMD_DAEMON])
 +])
 diff --git a/src/Makefile.am b/src/Makefile.am
 index 6d21e5d..6ef32ee 100644
 --- a/src/Makefile.am
 +++ b/src/Makefile.am
 @@ -958,11 +958,11 @@ libvirt_util_la_SOURCES =   
 \
  libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
   $(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \
   $(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS)  \
 - -I$(top_srcdir)/src/conf
 + $(SYSTEMD_DAEMON_CFLAGS) -I$(top_srcdir)/src/conf
  libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
   $(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
   $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS) \
 - $(SECDRIVER_LIBS) $(NUMACTL_LIBS)
 + $(SECDRIVER_LIBS) $(NUMACTL_LIBS) $(SYSTEMD_DAEMON_LIBS)
  
  
  noinst_LTLIBRARIES += libvirt_conf.la
 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
 index 0896287..21c6b66 100644
 --- a/src/libvirt_private.syms
 +++ b/src/libvirt_private.syms
 @@ -1826,6 +1826,7 @@ virSystemdCreateMachine;
  virSystemdMakeMachineName;
  virSystemdMakeScopeName;
  virSystemdMakeSliceName;
 +virSystemdNotifyStartup;
  virSystemdTerminateMachine;
  
  
 diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
 index 8907768..be27913 100644
 --- a/src/rpc/virnetserver.c
 

Re: [libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize

2014-02-21 Thread Michal Privoznik

On 21.02.2014 13:50, Daniel P. Berrange wrote:

On Fri, Feb 21, 2014 at 01:32:36PM +0100, Michal Privoznik wrote:

I've noticed that in some cases systemd was quick enough and even
if libvirt-guests.service is marked to be started after the
libvirtd.service my guests were not resumed as
libvirt-guests.sh failed to connect. This is because of a
simple fact: systemd correctly starts libvirt-guests after it
execs libvirtd. However, the daemon is not able to accept
connections right from the start. It's doing some
initialization which may take ages. This problem is not limited
to systemd only, indeed. Any init system that is able to startup
services in parallel (e.g. OpenRC) may run into this situation.
The fix is to try connecting not only once, but continuously a few
times with a small sleep in between tries.


The long term fix for this will be to use socket activation for
libvirtd. Unfortunately we can't do that yet since then VMs marked
to autostart on boot won't be booted


I think that we can create a .socket within libvirt and set 
libvirt-guests.service to be dependent on the libvirt.socket. Something 
among:


diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index e1f2a07..35963ce 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -22,5 +22,9 @@ Restart=on-failure
 # Override the maximum number of opened files
 #LimitNOFILE=2048

+[Socket]
+ListenStream=/var/run/libvirt/libvirt-sock
+ListenStream=0.0.0.0:16509
+
 [Install]
 WantedBy=multi-user.target
diff --git a/tools/libvirt-guests.service.in 
b/tools/libvirt-guests.service.in

index d8d7adf..03120da 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -1,6 +1,6 @@
 [Unit]
 Description=Suspend Active Libvirt Guests
-After=network.target libvirtd.service
+After=network.target libvirtd.socket
 Documentation=man:libvirtd(8)
 Documentation=http://libvirt.org

My inspiration comes from here:

https://bugzilla.redhat.com/show_bug.cgi?id=714426

However, I was unable to make this work with this particular change. 
Moreover, it would require users to adjust libvirtd.service file if they 
ever change socket path or listen address. That's why I've decided for 
approach implemented in 3/3.


Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 02:25:24PM +0100, Michal Privoznik wrote:
 On 21.02.2014 13:50, Daniel P. Berrange wrote:
 On Fri, Feb 21, 2014 at 01:32:36PM +0100, Michal Privoznik wrote:
 I've noticed that in some cases systemd was quick enough and even
 if libvirt-guests.service is marked to be started after the
 libvirtd.service my guests were not resumed as
 libvirt-guests.sh failed to connect. This is because of a
 simple fact: systemd correctly starts libvirt-guests after it
 execs libvirtd. However, the daemon is not able to accept
 connections right from the start. It's doing some
 initialization which may take ages. This problem is not limited
 to systemd only, indeed. Any init system that is able to startup
 services in parallel (e.g. OpenRC) may run into this situation.
 The fix is to try connecting not only once, but continuously a few
 times with a small sleep in between tries.
 
 The long term fix for this will be to use socket activation for
 libvirtd. Unfortunately we can't do that yet since then VMs marked
 to autostart on boot won't be booted
 
 I think that we can create a .socket within libvirt and set
 libvirt-guests.service to be dependent on the libvirt.socket.
 Something among:
 
 diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
 index e1f2a07..35963ce 100644
 --- a/daemon/libvirtd.service.in
 +++ b/daemon/libvirtd.service.in
 @@ -22,5 +22,9 @@ Restart=on-failure
  # Override the maximum number of opened files
  #LimitNOFILE=2048
 
 +[Socket]
 +ListenStream=/var/run/libvirt/libvirt-sock
 +ListenStream=0.0.0.0:16509
 +
  [Install]
  WantedBy=multi-user.target
 diff --git a/tools/libvirt-guests.service.in
 b/tools/libvirt-guests.service.in
 index d8d7adf..03120da 100644
 --- a/tools/libvirt-guests.service.in
 +++ b/tools/libvirt-guests.service.in
 @@ -1,6 +1,6 @@
  [Unit]
  Description=Suspend Active Libvirt Guests
 -After=network.target libvirtd.service
 +After=network.target libvirtd.socket
  Documentation=man:libvirtd(8)
  Documentation=http://libvirt.org

Hmm, i guess that would work in fact, provided we ensured that the
main libvirtd.service was still always enabled by default too.

 My inspiration comes from here:
 
 https://bugzilla.redhat.com/show_bug.cgi?id=714426
 
 However, I was unable to make this work with this particular change.

You need to also make libvirtd receive the socket file handle from
systemd, and create the libvirtd.socket file too. See what the
virtlockd daemon does in this regard.

 Moreover, it would require users to adjust libvirtd.service file if
 they ever change socket path or listen address. That's why I've
 decided for approach implemented in 3/3.

Sure, patch 3 is fine regardless because it gives fine grained
synchronization of startup beyond simply the socket availability.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/3] libvirt-guests: Wait for libirtd to initialize

2014-02-21 Thread Ján Tomko
s/libirtd/libvirtd/ in the subject

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 00/65]

2014-02-21 Thread Claudio Bley
At Fri, 21 Feb 2014 11:19:23 +,
Daniel P. Berrange wrote:
 
 On Thu, Feb 13, 2014 at 04:22:08PM +0100, Claudio Bley wrote:
  Hi.
  
  Here are a few patches that piled up in my local branch. Some of them
  I already submitted to this list, but there has been no reponse to
  them.
  
  Included are a few trivial fixes as well as memory leak fixes and
  additions to the public API.
  
  There had been some minor interest in my first version of domain event
  support in the Java wrapper[1], which I have reworked almost entirely.
  
  If nobody objects, say, within the next two weeks or so, I'll go ahead
  and push the whole series as was suggested to me by Daniel P. Berrange
  on this list[2].
  
  I've made sure that all JUnit tests pass after every commit with JNA
  versions 3.4.1, 3.4.2, 3.5.0, 3.5.1, 3.5.2 and 4.0.0.
  
  I'd really appreciate your comments or suggestions.
 
 I've ACK'd all of the patches except for the one about virFree and a
 couple related to hashCode/equals implementation.

Thank you! I'm just about clocking out now and will be on vacation until
the first week of march.

So, I'll push after I've returned and managed to read through my pile
of emails.

Claudio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt-java] [PATCH 07/65] Ignore editor backup files

2014-02-21 Thread Claudio Bley
At Fri, 14 Feb 2014 11:06:12 +0100,
Guido Günther wrote:
 
 On Thu, Feb 13, 2014 at 04:22:15PM +0100, Claudio Bley wrote:
  
  Signed-off-by: Claudio Bley cb...@av-test.de
  ---
   .gitignore |2 ++
   1 file changed, 2 insertions(+)
  
  diff --git a/.gitignore b/.gitignore
  index b02fd55..28ddc6e 100644
  --- a/.gitignore
  +++ b/.gitignore
  @@ -1,3 +1,5 @@
  +*~
  +\#*\#
   .classpath
   .project
   .settings
 
 ACK (from a non Java expert).

Thank you for your reviews! It's always good to have a second pair of
eyes look over... :-)

Claudio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt-java] [PATCH 10/65] Fix wrapping of native size_t data type

2014-02-21 Thread Claudio Bley
At Fri, 21 Feb 2014 10:37:36 +,
Daniel P. Berrange wrote:
 
 On Thu, Feb 13, 2014 at 04:22:18PM +0100, Claudio Bley wrote:
  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 cb...@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   |   19 
   .../java/org/libvirt/jna/SizeTByReference.java |   50 
  
   6 files changed, 87 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
 
 ACK

Thanks. I'll squash this in before pushing, since throwing an
IllegalArgumentException is not appropriate here.

--- 8 --- 8  8 - 8 
---
diff --git a/src/main/java/org/libvirt/jna/SizeTByReference.java 
b/src/main/java/org/libvirt/jna/SizeTByReference.java
index 474527f..24a4677 100644
--- a/src/main/java/org/libvirt/jna/SizeTByReference.java
+++ b/src/main/java/org/libvirt/jna/SizeTByReference.java
@@ -30,7 +30,7 @@ public final class SizeTByReference extends ByReference {
 p.setLong(0, value);
 break;
 default:
-throw new IllegalArgumentException(Unsupported size:  + 
Native.SIZE_T_SIZE);
+throw new RuntimeException(Unsupported size:  + 
Native.SIZE_T_SIZE);
 }
 }

@@ -44,7 +44,7 @@ public final class SizeTByReference extends ByReference {
 case 8:
 return p.getLong(0);
 default:
-throw new IllegalArgumentException(Unsupported size:  + 
Native.SIZE_T_SIZE);
+throw new RuntimeException(Unsupported size:  + 
Native.SIZE_T_SIZE);
 }
 }
 }

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/7] conf: clarify what is returned for actual bandwidth and vlan

2014-02-21 Thread Laine Stump
In practice, if a virDomainNetDef has a virDomainActualNetDef
allocated, the ActualNetDef will *always* contain the bandwidth and
vlan data from the NetDef (unless there was also a portgroup involved
- see networkAllocateActualDevice()).

However, virDomainNetGetActual(Bandwidth|Vlan)() were coded to make it
appear as if it might be possible to have a valid bandwidth/vlan in
the NetDef, but a NULL in the ActualNetDef. Believing this un-truth
could lead to writing unnecessarily defensive code when dealing with
the virDomainGetActual*() functions, so this patch makes it more
obvious:

   If there is an ActualNetDef, it will always have a copy of the
   various appropriate bits from its parent NetDef, and the
   virDomainGetActual* function will *always* return the data from the
   ActualNetDef, not from the NetDef.

The reason for this effective-NOP patch is that a subsequent patch to
change virDomainNetDefFormat will rely on the above rule.
---
 src/conf/domain_conf.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 064a40e..755066c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18638,8 +18638,11 @@ 
virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface)
 virNetDevBandwidthPtr
 virDomainNetGetActualBandwidth(virDomainNetDefPtr iface)
 {
+/* if there is an ActualNetDef, *always* return
+ * its bandwidth rather than the NetDef's bandwidth.
+ */
 if (iface-type == VIR_DOMAIN_NET_TYPE_NETWORK 
-iface-data.network.actual  iface-data.network.actual-bandwidth) {
+iface-data.network.actual) {
 return iface-data.network.actual-bandwidth;
 }
 return iface-bandwidth;
@@ -18648,12 +18651,17 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr 
iface)
 virNetDevVlanPtr
 virDomainNetGetActualVlan(virDomainNetDefPtr iface)
 {
+virNetDevVlanPtr vlan = iface-vlan;
+
+/* if there is an ActualNetDef, *always* return
+ * its vlan rather than the NetDef's vlan.
+ */
 if (iface-type == VIR_DOMAIN_NET_TYPE_NETWORK 
-iface-data.network.actual 
-iface-data.network.actual-vlan.nTags  0)
-return iface-data.network.actual-vlan;
-if (iface-vlan.nTags  0)
-return iface-vlan;
+iface-data.network.actual)
+vlan = iface-data.network.actual-vlan;
+
+if (vlan-nTags  0)
+return vlan;
 return 0;
 }
 
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/7] conf: handle null pointer in virNetDevVlanFormat

2014-02-21 Thread Laine Stump
Other *Format() functions (e.g. virNetDevBandwidthFormat()) return
with no action when called with a NULL *Def pointer. This makes
virNetDevVlanFormat() consistent with that behavior.
---
 src/conf/netdev_vlan_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index f58b4b8..dbe203e 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -144,7 +144,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr 
buf)
 {
 size_t i;
 
-if (def-nTags == 0)
+if (!(def  def-nTags))
 return 0;
 
 if (!def-tag) {
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 5/7] conf: new function virDomainActualNetDefContentsFormat

2014-02-21 Thread Laine Stump
This function is currently only called from one place, but in a
subsequent patch will be called from a 2nd place.

The new function exactly replicates the original behavior of the part
of virDomainActualNetDefFormat() that it replaces, but takes a
virDomainNetDefPtr instead of virDomainActualNetDefPtr, and uses the
virDomainNetGetActual*() functions whenever possible, rather than
reaching into def-data.network.actual - this is to be sure that we
are reporting exactly what is being used internally, just in case
there are any discrepancies (there shouldn't be).
---
 src/conf/domain_conf.c | 101 +++--
 1 file changed, 64 insertions(+), 37 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 67fc372..5c7e6ca 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15427,78 +15427,100 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf,
 return 0;
 }
 
+/* virDomainActualNetDefContentsFormat() - format just the subelements
+ * of interface that may be overridden by what is in the
+ * virDomainActualNetDef, but inside the current element, rather
+ * than enclosed in an actual subelement.
+ */
 static int
-virDomainActualNetDefFormat(virBufferPtr buf,
-virDomainActualNetDefPtr def,
-unsigned int flags)
+virDomainActualNetDefContentsFormat(virBufferPtr buf,
+virDomainNetDefPtr def,
+const char *typeStr,
+unsigned int flags)
 {
-const char *type;
 const char *mode;
 
-if (!def)
-return 0;
-
-type = virDomainNetTypeToString(def-type);
-if (!type) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected net type %d), def-type);
-return -1;
-}
-
-virBufferAsprintf(buf, actual type='%s', type);
-if (def-type == VIR_DOMAIN_NET_TYPE_HOSTDEV 
-def-data.hostdev.def.managed) {
-virBufferAddLit(buf,  managed='yes');
-}
-virBufferAddLit(buf, \n);
-
-virBufferAdjustIndent(buf, 2);
-switch (def-type) {
+switch (virDomainNetGetActualType(def)) {
 case VIR_DOMAIN_NET_TYPE_BRIDGE:
 virBufferEscapeString(buf, source bridge='%s'/\n,
-  def-data.bridge.brname);
+  virDomainNetGetActualBridgeName(def));
 break;
 
 case VIR_DOMAIN_NET_TYPE_DIRECT:
 virBufferAddLit(buf, source);
-if (def-data.direct.linkdev)
-virBufferEscapeString(buf,  dev='%s',
-  def-data.direct.linkdev);
+virBufferEscapeString(buf,  dev='%s',
+  virDomainNetGetActualDirectDev(def));
 
-mode = virNetDevMacVLanModeTypeToString(def-data.direct.mode);
+mode = 
virNetDevMacVLanModeTypeToString(virDomainNetGetActualDirectMode(def));
 if (!mode) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(unexpected source mode %d),
-   def-data.direct.mode);
+   virDomainNetGetActualDirectMode(def));
 return -1;
 }
 virBufferAsprintf(buf,  mode='%s'/\n, mode);
 break;
 
 case VIR_DOMAIN_NET_TYPE_HOSTDEV:
-if (virDomainHostdevDefFormatSubsys(buf, def-data.hostdev.def,
+if (virDomainHostdevDefFormatSubsys(buf, 
virDomainNetGetActualHostdev(def),
 flags, true)  0) {
 return -1;
 }
 break;
 
 case VIR_DOMAIN_NET_TYPE_NETWORK:
-if (def-class_id)
-virBufferAsprintf(buf, class id='%u'/, def-class_id);
+if (def-data.network.actual  def-data.network.actual-class_id)
+virBufferAsprintf(buf, class id='%u'/,
+  def-data.network.actual-class_id);
 break;
 default:
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected net type %s), type);
+   _(unexpected actual net type %s), typeStr);
 return -1;
 }
 
-if (virNetDevVlanFormat(def-vlan, buf)  0)
+if (virNetDevVlanFormat(virDomainNetGetActualVlan(def), buf)  0)
 return -1;
-if (virNetDevVPortProfileFormat(def-virtPortProfile, buf)  0)
+if (virNetDevVPortProfileFormat(virDomainNetGetActualVirtPortProfile(def), 
buf)  0)
 return -1;
-if (virNetDevBandwidthFormat(def-bandwidth, buf)  0)
+if (virNetDevBandwidthFormat(virDomainNetGetActualBandwidth(def), buf)  0)
 return -1;
+return 0;
+}
+
+
+/* virDomainActualNetDefFormat() - format the ActualNetDef
+ * info inside an actual element, as required for internal storage
+ * of domain status
+ */
+static int
+virDomainActualNetDefFormat(virBufferPtr buf,
+virDomainNetDefPtr def,
+unsigned int 

[libvirt] [PATCH 4/7] conf: re-situate bandwidth element in interface

2014-02-21 Thread Laine Stump
This moves the call to virNetDevBandwidthFormat() in
virDomainNetDefFormat() to be called right after the call to
virNetDevVPortProfileFormat(), so that a single chunk of that function
can be placed inside an if that conditionally calls
virDomainActualNetDefContentsFormat() instead (next patch). The
re-ordering necessitates modifying a couple of test data files.
---
 src/conf/domain_conf.c  | 6 +++---
 .../qemuhotplug-console-compat-2+console-virtio.xml | 4 ++--
 tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml| 4 ++--
 tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml   | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b5b70cd..67fc372 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15599,6 +15599,9 @@ virDomainNetDefFormat(virBufferPtr buf,
 return -1;
 if (virNetDevVPortProfileFormat(def-virtPortProfile, buf)  0)
 return -1;
+if (virNetDevBandwidthFormat(def-bandwidth, buf)  0)
+return -1;
+
 virBufferEscapeString(buf, script path='%s'/\n,
   def-script);
 if (def-ifname 
@@ -15651,9 +15654,6 @@ virDomainNetDefFormat(virBufferPtr buf,
   
virDomainNetInterfaceLinkStateTypeToString(def-linkstate));
 }
 
-if (virNetDevBandwidthFormat(def-bandwidth, buf)  0)
-return -1;
-
 virBufferAdjustIndent(buf, -6);
 
 if (virDomainDeviceInfoFormat(buf, def-info,
diff --git 
a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml 
b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
index a484e82..25fc120 100644
--- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
+++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
@@ -59,12 +59,12 @@
 interface type='network'
   mac address='52:54:00:ea:35:6f'/
   source network='default'/
-  target dev='vnet0'/
-  model type='virtio'/
   bandwidth
 inbound average='4000' peak='8000' floor='200' burst='1024'/
 outbound average='4000' peak='8000' burst='1024'/
   /bandwidth
+  target dev='vnet0'/
+  model type='virtio'/
   alias name='net0'/
   address type='pci' domain='0x' bus='0x00' slot='0x03' 
function='0x0'/
 /interface
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
index 065ef2d..e5c45a3 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
@@ -59,12 +59,12 @@
 interface type='network'
   mac address='52:54:00:ea:35:6f'/
   source network='default'/
-  target dev='vnet0'/
-  model type='virtio'/
   bandwidth
 inbound average='4000' peak='8000' floor='200' burst='1024'/
 outbound average='4000' peak='8000' burst='1024'/
   /bandwidth
+  target dev='vnet0'/
+  model type='virtio'/
   alias name='net0'/
   address type='pci' domain='0x' bus='0x00' slot='0x03' 
function='0x0'/
 /interface
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
index 064a05f..f70e20a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
@@ -45,11 +45,11 @@
 interface type='network'
   mac address='52:54:00:24:a5:9f'/
   source network='default'/
-  model type='rtl8139'/
   bandwidth
 inbound average='1000' peak='4000' burst='1024'/
 outbound average='128' peak='256' burst='32768'/
   /bandwidth
+  model type='rtl8139'/
   address type='pci' domain='0x' bus='0x00' slot='0x07' 
function='0x0'/
 /interface
 serial type='pty'
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/7] network: include plugged interface XML in plugged network hook

2014-02-21 Thread Laine Stump
Although the immediate reason for all these patches is $subject, it
really is something that should have been done a long time ago (I just
hadn't convinced myself it was the right thing to do). These patches
will allow a management application to easily learn exactly what
physical hardware is being used by a domain's interface, which wasn't
previously possible (e.g., it will be simple to learn which SRIOV VF
is being used by a domain interface that is configured as interface
type='network' where the network is a pool of VFs).

Laine Stump (7):
  conf: clarify what is returned for actual bandwidth and vlan
  conf: handle null pointer in virNetDevVlanFormat
  conf: make virDomainNetDefFormat a public function
  conf: re-situate bandwidth element in interface
  conf: new function virDomainActualNetDefContentsFormat
  conf: output actual netdev status in interface XML
  network: include plugged interface XML in plugged network hook

 src/conf/domain_conf.c | 303 +
 src/conf/domain_conf.h |   4 +
 src/conf/netdev_vlan_conf.c|   4 +-
 src/libvirt_private.syms   |   1 +
 src/network/bridge_driver.c|  48 ++--
 ...qemuhotplug-console-compat-2+console-virtio.xml |   4 +-
 .../qemuxml2argv-console-compat-2.xml  |   4 +-
 .../qemuxml2argv-net-bandwidth.xml |   2 +-
 8 files changed, 233 insertions(+), 137 deletions(-)

-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 4/5] apparmor: add debug traces when changing profile.

2014-02-21 Thread Cédric Bosdonnat
The reason for these is that aa-status doesn't show the process using
the profile as they are in another namespace.
---
 src/security/security_apparmor.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 14dc707..1c1b128 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -593,6 +593,7 @@ AppArmorSetSecurityProcessLabel(virSecurityManagerPtr mgr 
ATTRIBUTE_UNUSED,
 goto cleanup;
 }
 
+VIR_DEBUG(Changing AppArmor profile to %s, profile_name);
 if (aa_change_profile(profile_name)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
_(error calling aa_change_profile()));
@@ -618,6 +619,7 @@ AppArmorSetSecurityChildProcessLabel(virSecurityManagerPtr 
mgr ATTRIBUTE_UNUSED,
 {
 int rc = -1;
 char *profile_name = NULL;
+char *cmd_str = NULL;
 virSecurityLabelDefPtr secdef =
 virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
 
@@ -637,11 +639,14 @@ 
AppArmorSetSecurityChildProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
 if ((profile_name = get_profile_name(def)) == NULL)
 goto cleanup;
 
+cmd_str = virCommandToString(cmd);
+VIR_DEBUG(Changing AppArmor profile to %s on %s, profile_name, cmd_str);
 virCommandSetAppArmorProfile(cmd, profile_name);
 rc = 0;
 
   cleanup:
 VIR_FREE(profile_name);
+VIR_FREE(cmd_str);
 return rc;
 }
 
-- 
1.8.5.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


  1   2   >