[libvirt] [PATCH] maint: update to latest gnulib

2014-01-01 Thread Eric Blake
'make syntax-check' wants a newer gnulib for 2014 copyright.

Also, a couple of fixes for bootstrap issues reported on IRC:
- on some older glibc systems, ./configure could deadlock due to
a glibc malloc bug
- on FreeBSD systems, a broken autom4te coupled with gettext
0.18.3 prevents bootstrap; we can't work around it, but can at
least inform the user why they have a problem

And as always, portability fixes in other modules, some of which
are used by libvirt.

* .gnulib: Update to latest, in part for bootstrap improvements,
and for the new year.
* bootstrap: Resync to gnulib.
* gnulib/local/m4/ssize_t.m4.diff: Regenerate.

Signed-off-by: Eric Blake ebl...@redhat.com
---

Pushing under the build-breaker rule now that 'make syntax-check'
is impacted.

* .gnulib 831b84c...c7802e2 (33):
   doc: update main copyright year
   maint: update copyright
   version-etc: new year
   autoupdate
   passfd: give nicer error for recvfd at eof
   autoupdate
   gettimeofday: port recent C++ fix to Emacs
   gettimeofday: fix C++ crosscompilation
   qacl: port to Windows better
   md5, sha1, sha256, sha512: fix compile error in c++ mode
   open-tests: fix build failure with -Werror=old-style-declaration
   md5, sha1, sha256, sha512: fix link error with partial libcrypto
   md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT
   md5, sha1, sha256, sha512: add 'auto', and a way to specify default
   autoupdate
   bootstrap: warn about BSD toolchain snafu
   open-tests: port to glibc with _FORTIFY_SOURCE and -O1
   include_next: minimize code duplication
   getcwd: fix compile error in configure check
   regex: suppress core dumps from detection code
   md5, sha1, sha256, sha512: support mandating use of openssl
   test-xvasprintf: disable some -Wformat-security diagnostics
   regex: avoid glibc deadlock during configure
   md5, sha1, sha256, sha512: use openssl routines if available
   base64: fix recent compilation regression on some compilers
   autoupdate
   autoupdate
   ignore-value: revert previous code change
   selinux-h: improve stub types and add more stub functions
   ignore-value: prefer GCC version back through 2.0
   pty: Activate the signature wrapper of forkpty.
   maint: fix gendocs.sh permissions
   autoupdate

 .gnulib |  2 +-
 bootstrap   | 12 ++--
 gnulib/local/m4/ssize_t.m4.diff |  2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.gnulib b/.gnulib
index 831b84c..1276a2c 16
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 831b84c59ef413c57a36b67344467d66a8a2ba70
+Subproject commit 1276a2c5f24c0c932426aca9c899fa524d2443f2
diff --git a/bootstrap b/bootstrap
index e31d17d..ce90bc4 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2013-08-15.22; # UTC
+scriptversion=2013-12-05.23; # UTC

 # Bootstrap this package from checked-out sources.

-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -551,6 +551,14 @@ if ! printf $buildreq | check_versions; then
   fi
 fi

+# Warn the user if autom4te appears to be broken; this causes known
+# issues with at least gettext 0.18.3.
+probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
+if test x$probe != xhi; then
+  warn_ WARNING: your autom4te wrapper eats stdin;
+  warn_ if bootstrap fails, consider upgrading your autotools
+fi
+
 echo $0: Bootstrapping from checked-out $package sources...

 # See if we can use gnulib's git-merge-changelog merge driver.
diff --git a/gnulib/local/m4/ssize_t.m4.diff b/gnulib/local/m4/ssize_t.m4.diff
index 93f8ad7..08c2b9c 100644
--- a/gnulib/local/m4/ssize_t.m4.diff
+++ b/gnulib/local/m4/ssize_t.m4.diff
@@ -5,7 +5,7 @@ index 209d64c..5ea72a1 100644
 @@ -1,4 +1,4 @@
 -# ssize_t.m4 serial 5 (gettext-0.18.2)
 +# ssize_t.m4 serial 6 (gettext-0.18.2)
- dnl Copyright (C) 2001-2003, 2006, 2010-2013 Free Software Foundation, Inc.
+ dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
 @@ -17,7 +17,21 @@ AC_DEFUN([gt_TYPE_SSIZE_T],
-- 
1.8.4.2

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


[libvirt] [PATCH] aarch64: Disable -fstack-protector.

2014-01-01 Thread Richard W.M. Jones
From: Richard W.M. Jones rjo...@redhat.com

I'm using gcc-4.8.2-7.fc21.aarch64 which does not appear to support
this option.
---
 m4/virt-compile-warnings.m4 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 1547e03..574fbc4 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -163,6 +163,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
 dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
 dnl on Mingw32, but fails when actually used
 case $host in
+   aarch64-*-*)
+   dnl error: -fstack-protector not supported for this target [-Werror]
+   ;;
*-*-linux*)
dnl Fedora only uses -fstack-protector, but doesn't seem to
dnl be great overhead in adding -fstack-protector-all instead
-- 
1.8.3.1

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


[libvirt] Jenkins build is back to normal : libvirt-syntax-check #1805

2014-01-01 Thread Jenkins CI
See http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/1805/

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


Re: [libvirt] [PATCH] aarch64: Disable -fstack-protector.

2014-01-01 Thread Eric Blake
On 01/01/2014 06:42 AM, Richard W.M. Jones wrote:
 From: Richard W.M. Jones rjo...@redhat.com
 
 I'm using gcc-4.8.2-7.fc21.aarch64 which does not appear to support
 this option.
 ---
  m4/virt-compile-warnings.m4 | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
 index 1547e03..574fbc4 100644
 --- a/m4/virt-compile-warnings.m4
 +++ b/m4/virt-compile-warnings.m4
 @@ -163,6 +163,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
  dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
  dnl on Mingw32, but fails when actually used
  case $host in
 +   aarch64-*-*)
 +   dnl error: -fstack-protector not supported for this target [-Werror]
 +   ;;

ACK.  It would be nicer to figure out why gl_WARN_ADD isn't able to flag
this warning as broken for your setup in the first place, but as that's
probably more of a task for gnulib, I'm okay with this patch in the
meantime.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH] aarch64: Disable -fstack-protector.

2014-01-01 Thread Richard W.M. Jones

On Wed, Jan 01, 2014 at 06:52:09AM -0700, Eric Blake wrote:
 On 01/01/2014 06:42 AM, Richard W.M. Jones wrote:
  From: Richard W.M. Jones rjo...@redhat.com
  
  I'm using gcc-4.8.2-7.fc21.aarch64 which does not appear to support
  this option.
  ---
   m4/virt-compile-warnings.m4 | 3 +++
   1 file changed, 3 insertions(+)
  
  diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
  index 1547e03..574fbc4 100644
  --- a/m4/virt-compile-warnings.m4
  +++ b/m4/virt-compile-warnings.m4
  @@ -163,6 +163,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
   dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
   dnl on Mingw32, but fails when actually used
   case $host in
  +   aarch64-*-*)
  +   dnl error: -fstack-protector not supported for this target 
  [-Werror]
  +   ;;
 
 ACK.  It would be nicer to figure out why gl_WARN_ADD isn't able to flag
 this warning as broken for your setup in the first place, but as that's
 probably more of a task for gnulib, I'm okay with this patch in the
 meantime.

Well ... gl_WARN_ADD is a horrible mess of m4 and autoconf macros so
it's hard to understand exactly how it works.  However it is only
*specified* to work on warnings (-Wstack-protector) not on feature
flags (-fstack-protector).  So it seems like a mistake that libvirt's
m4 module calls gl_WARN_ADD with all the flags.

Anyway I've pushed this now, thanks.

Obviously this is a commit that we'll revert when gcc is fixed/enhanced!

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

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


[libvirt] FYI: aarch64 test suite failures

2014-01-01 Thread Richard W.M. Jones
Libvirt compiles fine on aarch64.  You will need to configure with
--without-dtrace as systemtap tracepoints are pretty broken, giving
lots of strange compile-time errors/link failures in both libvirt and qemu.

The test suite fails, see attachment.

Note this is all running under qemu-arm64 userspace emulation[1], so
certain things are expected to be a bit different.

In particular, any aarch64 binary which the test suite runs is
actually run under the qemu-arm64 interpreter (using binfmt).  I'm
guessing this explains the extra file descriptor in some tests.

Also qemu intercepts system calls and thunks them into host system
calls (an x86-64 host in this case), and its support for IPv6 seems
shaky at best.

Rich.

[1] 
http://rwmj.wordpress.com/2013/12/22/how-to-run-aarch64-binaries-on-an-x86-64-host-using-qemu-userspace-emulation/#content

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
=
   libvirt 1.2.1: tests/test-suite.log
=

# TOTAL: 96
# PASS:  89
# SKIP:  4
# XFAIL: 0
# FAIL:  3
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

SKIP: nodeinfotest
==


FAIL: commandtest
=

TEST: commandtest
 1) Command Exec test0 test   ... OK
 2) Command Exec test1 test   ... OK
 3) Command Exec test2 test   ... 
Offset 0
Expect [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
DAEMON:no
CWD:/tmp
]
Actual [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
DAEMON:no
CWD:/tmp
]
  ... FAILED
 4) Command Exec test3 test   ... 
Offset 0
Expect [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:5
FD:7
DAEMON:no
CWD:/tmp
]
Actual [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
FD:5
FD:7
DAEMON:no
CWD:/tmp
]
  ... FAILED
 5) Command Exec test4 test   ... 
Offset 0
Expect [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
DAEMON:yes
CWD:/
]
Actual [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
DAEMON:yes
CWD:/
]
  ... FAILED
 6) Command Exec test5 test   ... 
Offset 0
Expect [ENV:HOME=/home/test
ENV:LC_ALL=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
DAEMON:no
CWD:/tmp
]
Actual [ENV:HOME=/home/test
ENV:LC_ALL=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
DAEMON:no
CWD:/tmp
]
  ... FAILED
 7) Command Exec test6 test   ... 
Offset 0
Expect [ENV:DISPLAY=:0.0
FD:0
FD:1
FD:2
DAEMON:no
CWD:/tmp
]
Actual [ENV:DISPLAY=:0.0
FD:0
FD:1
FD:2
FD:3
DAEMON:no
CWD:/tmp
]
  ... FAILED
 8) Command Exec test7 test   ... 
Offset 0
Expect [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:LC_ALL=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
DAEMON:no
CWD:/tmp
]
Actual [ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:LC_ALL=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
DAEMON:no
CWD:/tmp
]
  ... FAILED
 9) Command Exec test8 test   ... 
Offset 0
Expect [ENV:LANG=C
ENV:USER=test
FD:0
FD:1
FD:2
DAEMON:no
CWD:/tmp
]
Actual [ENV:LANG=C
ENV:USER=test
FD:0
FD:1
FD:2
FD:3
DAEMON:no
CWD:/tmp
]
  ... FAILED
10) Command Exec test9 test   ... 
Offset 0
Expect [ARG:-version
ARG:-log=bar.log
ARG:arg1
ARG:arg2
ARG:
ARG:arg4
ARG:arg5
ARG:arg6
ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test
ENV:LANG=C
ENV:LOGNAME=testTMPDIR=/tmp
ENV:PATH=/usr/bin:/bin
ENV:USER=test
FD:0

Re: [libvirt] FYI: aarch64 test suite failures

2014-01-01 Thread Richard W.M. Jones
On Wed, Jan 01, 2014 at 02:51:30PM +, Richard W.M. Jones wrote:
 In particular, any aarch64 binary which the test suite runs is
 actually run under the qemu-arm64 interpreter (using binfmt).  I'm
 guessing this explains the extra file descriptor in some tests.

More precisely, qemu opens a file descriptor for the binary, and then
seems to leak that fd across fork/exec.  Compare:

On the host:
  $ ls -l /proc/self/fd
  total 0
  lrwx--. 1 rjones rjones 64 Jan  1 15:04 0 - /dev/pts/7
  lrwx--. 1 rjones rjones 64 Jan  1 15:04 1 - /dev/pts/7
  lrwx--. 1 rjones rjones 64 Jan  1 15:04 2 - /dev/pts/7
  lr-x--. 1 rjones rjones 64 Jan  1 15:04 3 - /proc/18301/fd

In the qemu chroot:
  $ ./arm64-chroot.sh 
  # ls -l /proc/self/fd
  total 0
  lrwx--. 1 root root 64 Jan  1 15:04 0 - /dev/pts/7
  lrwx--. 1 root root 64 Jan  1 15:04 1 - /dev/pts/7
  lrwx--. 1 root root 64 Jan  1 15:04 2 - /dev/pts/7
  lr-x--. 1 root root 64 Jan  1 15:04 3 - /usr/bin/bash
  lr-x--. 1 root root 64 Jan  1 15:04 4 - /usr/bin/ls
  lr-x--. 1 root root 64 Jan  1 15:04 5 - /proc/18331/fd

So anything which is testing file descriptors should probably be
skipped until we can afford to run this on real hardware or qemu gets
system emulation of aarch64.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

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


Re: [libvirt] FYI: aarch64 test suite failures

2014-01-01 Thread Richard W.M. Jones
On Wed, Jan 01, 2014 at 02:51:30PM +, Richard W.M. Jones wrote:
 FAIL: sysinfotest
 =
 
 TEST: sysinfotest
  1) aarch64 sysinfo   ... 
 Offset 0
 Expect [sysinfo type='smbios'
 /sysinfo
 ]
 Actual [sysinfo type='smbios'
   processor
 entry name='socket_destination'0/entry
 entry name='type'AArch64 Processor rev 0 (aarch64) /entry
   /processor
   processor
 entry name='socket_destination'1/entry
 entry name='type'AArch64 Processor rev 0 (aarch64)/entry
   /processor
 /sysinfo
 ]
   ... 
 FAILED

/proc/cpuinfo is emulated by qemu by intercepting any system call
which tries to open that file.  Under qemu:

  $ cat /proc/sysinfo
  /bin/cat: /proc/sysinfo: No such file or directory
  $ cat /proc/cpuinfo 
  Processor: AArch64 Processor rev 0 (aarch64)
  processor: 0
  BogoMIPS : 200.00
  
  Features : fp asimd 
  CPU implementer  : 0x41
  CPU architecture: AArch64
  CPU variant : 0x0
  CPU part: 0xd00
  CPU revision: 0
  
  Hardware: V2P-AARCH64

However my understanding of this test is that it doesn't use
/proc/cpuinfo from the system, but uses the test data from
tests/sysinfodata/aarch64cpuinfo.data, and since it is using fixed
test data, the test output should be identical.

Therefore this appears to be a genuine libvirt bug.  I will post a
patch in a few minutes.

 FAIL: virnetsockettest
 ==
 
 TEST: virnetsockettest
 Cannot identify IPv4/6 availability

This one fails because:

  getifaddrs: Address family not supported by protocol

getifaddrs first calls socket(PF_NETLINK, SOCK_RAW, 0) [see netlink(7)].

This seems firmly in the category of qemu emulation failure, so I
think we should ignore it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

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


[libvirt] [PATCH 2/3] tests: sysinfotest: Actual/expected were swapped in error message.

2014-01-01 Thread Richard W.M. Jones
From: Richard W.M. Jones rjo...@redhat.com

---
 tests/sysinfotest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index 8357701..c8675f9 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -83,7 +83,7 @@ testSysinfo(const void *data)
 goto cleanup;
 
 if (STRNEQ(sysfsActualData, sysfsExpectData)) {
-virtTestDifference(stderr, sysfsActualData, sysfsExpectData);
+virtTestDifference(stderr, sysfsExpectData, sysfsActualData);
 goto cleanup;
 }
 
-- 
1.8.3.1

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


[libvirt] [PATCH 3/3] aarch64: Fix sysinfo test.

2014-01-01 Thread Richard W.M. Jones
From: Richard W.M. Jones rjo...@redhat.com

On AArch64 the kernel prints one processor (lower case 'p') line per
core.  As this was missing from the test data, virSysinfo was not
parsing any processors at all.

Fix the test data so the test now passes.
---
 tests/sysinfodata/aarch64cpuinfo.data   | 1 +
 tests/sysinfodata/aarch64sysinfo.expect | 4 
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/sysinfodata/aarch64cpuinfo.data 
b/tests/sysinfodata/aarch64cpuinfo.data
index 0d63139..fbab543 100644
--- a/tests/sysinfodata/aarch64cpuinfo.data
+++ b/tests/sysinfodata/aarch64cpuinfo.data
@@ -1,4 +1,5 @@
 Processor  : AArch64 Processor rev 0 (aarch64)
+processor  : 0
 BogoMIPS   : 100.00
 
 Features   : fp asimd
diff --git a/tests/sysinfodata/aarch64sysinfo.expect 
b/tests/sysinfodata/aarch64sysinfo.expect
index 518434d..2cb8932 100644
--- a/tests/sysinfodata/aarch64sysinfo.expect
+++ b/tests/sysinfodata/aarch64sysinfo.expect
@@ -1,10 +1,6 @@
 sysinfo type='smbios'
   processor
 entry name='socket_destination'0/entry
-entry name='type'AArch64 Processor rev 0 (aarch64) /entry
-  /processor
-  processor
-entry name='socket_destination'1/entry
 entry name='type'AArch64 Processor rev 0 (aarch64)/entry
   /processor
 /sysinfo
-- 
1.8.3.1

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


[libvirt] [PATCH 1/3] tests: virnetsockettest: Print the error if getifaddrs fails.

2014-01-01 Thread Richard W.M. Jones
From: Richard W.M. Jones rjo...@redhat.com

---
 tests/virnetsockettest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index eda95bc..82c202e 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -60,8 +60,10 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
 *hasIPv4 = *hasIPv6 = false;
 *freePort = 0;
 
-if (getifaddrs(ifaddr)  0)
+if (getifaddrs(ifaddr)  0) {
+perror (getifaddrs);
 goto cleanup;
+}
 
 for (ifa = ifaddr; ifa != NULL; ifa = ifa-ifa_next) {
 if (!ifa-ifa_addr)
-- 
1.8.3.1

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


Re: [libvirt] FYI: aarch64 test suite failures

2014-01-01 Thread Richard W.M. Jones
On Wed, Jan 01, 2014 at 03:34:33PM +, Richard W.M. Jones wrote:
 On Wed, Jan 01, 2014 at 02:51:30PM +, Richard W.M. Jones wrote:
  FAIL: sysinfotest
  =

In fact, since this test is entirely test-data-driven, why does the
test contain arch-specific sections at all?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

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


Re: [libvirt] [PATCH 1/3] tests: virnetsockettest: Print the error if getifaddrs fails.

2014-01-01 Thread Eric Blake
On 01/01/2014 08:49 AM, Richard W.M. Jones wrote:
 From: Richard W.M. Jones rjo...@redhat.com
 
 ---
  tests/virnetsockettest.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
 index eda95bc..82c202e 100644
 --- a/tests/virnetsockettest.c
 +++ b/tests/virnetsockettest.c
 @@ -60,8 +60,10 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
  *hasIPv4 = *hasIPv6 = false;
  *freePort = 0;
  
 -if (getifaddrs(ifaddr)  0)
 +if (getifaddrs(ifaddr)  0) {
 +perror (getifaddrs);
  goto cleanup;
 +}

ACK.  Doesn't change pass/fail status, but makes debugging failure nicer.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH 2/3] tests: sysinfotest: Actual/expected were swapped in error message.

2014-01-01 Thread Eric Blake
On 01/01/2014 08:49 AM, Richard W.M. Jones wrote:
 From: Richard W.M. Jones rjo...@redhat.com
 
 ---
  tests/sysinfotest.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
 index 8357701..c8675f9 100644
 --- a/tests/sysinfotest.c
 +++ b/tests/sysinfotest.c
 @@ -83,7 +83,7 @@ testSysinfo(const void *data)
  goto cleanup;
  
  if (STRNEQ(sysfsActualData, sysfsExpectData)) {
 -virtTestDifference(stderr, sysfsActualData, sysfsExpectData);
 +virtTestDifference(stderr, sysfsExpectData, sysfsActualData);

ACK.  A quick:
 git grep virtTestDiff'.*,.*ctual.*,' tests/
didn't turn up any other obvious swaps (but not all tests use the same
naming, so that's not conclusive)

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH 3/3] aarch64: Fix sysinfo test.

2014-01-01 Thread Eric Blake
On 01/01/2014 08:49 AM, Richard W.M. Jones wrote:
 From: Richard W.M. Jones rjo...@redhat.com
 
 On AArch64 the kernel prints one processor (lower case 'p') line per
 core.  As this was missing from the test data, virSysinfo was not
 parsing any processors at all.
 
 Fix the test data so the test now passes.
 ---
  tests/sysinfodata/aarch64cpuinfo.data   | 1 +
  tests/sysinfodata/aarch64sysinfo.expect | 4 
  2 files changed, 1 insertion(+), 4 deletions(-)

ACK.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

[libvirt] Build failed in Jenkins: libvirt-syntax-check #1807

2014-01-01 Thread Jenkins CI
See http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/1807/

--
Started by upstream project libvirt-build build number 2016
Building on master in workspace 
http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/ws/
[workspace] $ /bin/sh -xe /tmp/hudson5237641448459273791.sh
+ make syntax-check
  GENbracket-spacing-check
tests/virnetsockettest.c:64: perror (getifaddrs);
maint.mk: incorrect whitespace, see HACKING for rules
make: *** [bracket-spacing-check] Error 1
Build step 'Execute shell' marked build as failure

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


Re: [libvirt] [PATCH 1/3] tests: virnetsockettest: Print the error if getifaddrs fails.

2014-01-01 Thread Eric Blake
On 01/01/2014 09:24 AM, Eric Blake wrote:
 On 01/01/2014 08:49 AM, Richard W.M. Jones wrote:
 From: Richard W.M. Jones rjo...@redhat.com

 ---
  tests/virnetsockettest.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

 diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
 index eda95bc..82c202e 100644
 --- a/tests/virnetsockettest.c
 +++ b/tests/virnetsockettest.c
 @@ -60,8 +60,10 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
  *hasIPv4 = *hasIPv6 = false;
  *freePort = 0;
  
 -if (getifaddrs(ifaddr)  0)
 +if (getifaddrs(ifaddr)  0) {
 +perror (getifaddrs);
  goto cleanup;
 +}
 
 ACK.  Doesn't change pass/fail status, but makes debugging failure nicer.

Jenkins caught you.  'make syntax-check' would have warned you about the
spurious space in the function call.  I'll push the obvious fix.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

[libvirt] [PATCH] test: share state driver between test:///default connections

2014-01-01 Thread Eric Blake
Prior to this patch, every test:/// URI has its own event manager,
which means that registering for an event can only ever receive
events from the connection where it issued the API that triggered
the event.  But the whole idea of events is to be able to learn
about something where an API call did NOT trigger the action.

In order to actually test asynchronous events, I wanted to be able
to tie multiple test connections to the same state.  Use of a file
in a test URI is still per-connection state, but now parallel
connections to test:///default (from the same binary, of course)
now share common state and can affect one another.

Here's the test program I used to expose the difference (maybe not
the most polished, but does the trick):

 #include stdbool.h
 #include stdlib.h
 #include errno.h
 #include stdio.h
 #include unistd.h
 #include signal.h
 #include libvirt/libvirt.h
 #include libvirt/virterror.h

static int counter;
static int counter2;
static virConnectPtr conn1;
static virConnectPtr conn2;
static virDomainPtr dom1;
static virDomainPtr dom2;

static int
common(virConnectPtr conn, virDomainPtr dom, int event, int detail,
   void *opaque, int caller)
{
printf(%d: in callback %d, from domain %s (%d), event/detail %d/%d\n,
   counter2++, caller, virDomainGetName(dom),
   virDomainGetID(dom), event, detail);
return 0;
}

static int
callback1(virConnectPtr conn, virDomainPtr dom, int event, int detail,
  void *opaque)
{
return common(conn, dom, event, detail, opaque, 1);
}

static int
callback2(virConnectPtr conn, virDomainPtr dom, int event, int detail,
  void *opaque)
{
return common(conn, dom, event, detail, opaque, 2);
}

static bool quit;
static void
handler(int sig)
{
quit = true;
}
static void
timer(int id, void *opaque)
{
printf(%d: timer %d firing\n, counter++, id);
unsigned long l;
switch (counter) {
case 1:
if (virDomainSuspend(dom2)  0)
exit(10);
printf(suspended\n);
break;
case 2:
if (virDomainResume(dom2)  0)
exit(11);
printf(resumed\n);
break;
case 4:
quit = true;
/* fallthrough */
default:
virConnectGetLibVersion(conn1, l);
break;
}
}

int main(int argc, char **argv)
{
signal(SIGINT, handler);
conn1 = virConnectOpen(test:///default);
conn2 = virConnectOpen(test:///default);
if (!conn1 || !conn2)
return 1;
dom1 = virDomainLookupByName(conn1, test);
dom2 = virDomainLookupByName(conn2, test);
if (!dom1 || !dom2)
return 2;
if (virEventRegisterDefaultImpl()  0)
return 3;
int id0 = virEventAddTimeout(1000, timer, NULL, NULL);
if (id0  0)
return 4;
int id1 = virConnectDomainEventRegisterAny(conn1, dom1,
   VIR_DOMAIN_EVENT_ID_LIFECYCLE,
   
VIR_DOMAIN_EVENT_CALLBACK(callback1),
   NULL, NULL);
if (id1  0)
return 5;
int id2 = -1;
if (argc  1) {
id2 = virConnectDomainEventRegisterAny(conn2, dom2,
   VIR_DOMAIN_EVENT_ID_LIFECYCLE,
   
VIR_DOMAIN_EVENT_CALLBACK(callback2),
   NULL, NULL);
if (id2  0)
return 6;
if (argc  2) {
if (virConnectDomainEventDeregisterAny(conn2, id2)  0)
return 7;
}
}

while (!quit)
if (virEventRunDefaultImpl()  0)
return 20;
if (virConnectDomainEventDeregisterAny(conn1, id1)  0)
return 21;
if (id2 = 0  virConnectDomainEventDeregisterAny(conn2, id2)  0)
return 22;
if (virEventRemoveTimeout(id0)  0)
return 23;
if (virDomainFree(dom1)  0 || virDomainFree(dom2)  0 ||
virConnectClose(conn1)  0 || virConnectClose(conn2)  0)
return 24;
return 0;
}

Pre-patch results:
$ ./run ./bar
0: timer 1 firing
suspended
1: timer 1 firing
resumed
2: timer 1 firing
3: timer 1 firing

Post-patch results:

$ ./run ./bar
0: timer 1 firing
suspended
0: in callback 1, from domain test (1), event/detail 3/0
1: timer 1 firing
resumed
1: in callback 1, from domain test (1), event/detail 4/0
2: timer 1 firing
3: timer 1 firing
$ ./run ./bar 1
0: timer 1 firing
suspended
0: in callback 1, from domain test (1), event/detail 3/0
1: in callback 2, from domain test (1), event/detail 3/0
1: timer 1 firing
resumed
2: in callback 1, from domain test (1), event/detail 4/0
3: in callback 2, from domain test (1), event/detail 4/0
2: timer 1 firing
3: timer 1 firing

Valgrind didn't report any leaks.

* src/test/test_driver.c (testConnectOpen): Move per-connection
state initialization...
(testOpenFromFile): ...here.
(defaultConn, defaultConnections, defaultLock, testOnceInit): New
shared state.
(testOpenDefault): 

[libvirt] Jenkins build is back to normal : libvirt-syntax-check #1808

2014-01-01 Thread Jenkins CI
See http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/1808/

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


[libvirt] [PATCHv2] test: share state driver between test:///default connections

2014-01-01 Thread Eric Blake
Prior to this patch, every test:/// URI has its own event manager,
which means that registering for an event can only ever receive
events from the connection where it issued the API that triggered
the event.  But the whole idea of events is to be able to learn
about something where an API call did NOT trigger the action.

In order to actually test asynchronous events, I wanted to be able
to tie multiple test connections to the same state.  Use of a file
in a test URI is still per-connection state, but now parallel
connections to test:///default (from the same binary, of course)
now share common state and can affect one another.

The updated testsuite fails without the rest of this patch.
Valgrind didn't report any leaks.

* src/test/test_driver.c (testConnectOpen): Move per-connection
state initialization...
(testOpenFromFile): ...here.
(defaultConn, defaultConnections, defaultLock, testOnceInit): New
shared state.
(testOpenDefault): Only initialize on first connection.
(testConnectClose): Don't clobber state if still shared.
* tests/objecteventtest.c (testDomainStartStopEvent): Enhance to
cover this.
(timeout, mymain): Ensure test fails rather than blocks.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/test/test_driver.c  | 88 +++--
 tests/objecteventtest.c | 50 
 2 files changed, 107 insertions(+), 31 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a48404a..9696044 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1,7 +1,7 @@
 /*
  * test.c: A mock hypervisor for use by application unit tests
  *
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -105,6 +105,10 @@ struct _testConn {
 typedef struct _testConn testConn;
 typedef struct _testConn *testConnPtr;

+static testConn defaultConn;
+static int defaultConnections;
+static virMutex defaultLock;
+
 #define TEST_MODEL i686
 #define TEST_MODEL_WORDSIZE 32
 #define TEST_EMULATOR /usr/bin/test-hv
@@ -125,6 +129,14 @@ static int testConnectClose(virConnectPtr conn);
 static void testObjectEventQueue(testConnPtr driver,
  virObjectEventPtr event);

+static int
+testOnceInit(void)
+{
+return virMutexInit(defaultLock);
+}
+
+VIR_ONCE_GLOBAL_INIT(test)
+

 static void testDriverLock(testConnPtr driver)
 {
@@ -665,9 +677,15 @@ cleanup:
 return ret;
 }

-static int testOpenDefault(virConnectPtr conn) {
+
+/* Simultaneous test:///default connections should share the same
+ * common state (among other things, this allows testing event
+ * detection in one connection for an action caused in another).  */
+static int
+testOpenDefault(virConnectPtr conn)
+{
 int u;
-testConnPtr privconn;
+testConnPtr privconn = defaultConn;
 virDomainDefPtr domdef = NULL;
 virDomainObjPtr domobj = NULL;
 virNetworkDefPtr netdef = NULL;
@@ -679,18 +697,26 @@ static int testOpenDefault(virConnectPtr conn) {
 virNodeDeviceDefPtr nodedef = NULL;
 virNodeDeviceObjPtr nodeobj = NULL;

-if (VIR_ALLOC(privconn)  0)
-return VIR_DRV_OPEN_ERROR;
+virMutexLock(defaultLock);
+if (defaultConnections++) {
+conn-privateData = defaultConn;
+virMutexUnlock(defaultLock);
+return VIR_DRV_OPEN_SUCCESS;
+}
+
 if (virMutexInit(privconn-lock)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
%s, _(cannot initialize mutex));
-VIR_FREE(privconn);
+defaultConnections--;
+virMutexUnlock(defaultLock);
 return VIR_DRV_OPEN_ERROR;
 }

-testDriverLock(privconn);
 conn-privateData = privconn;

+if (!(privconn-domainEventState = virObjectEventStateNew()))
+goto error;
+
 if (!(privconn-domains = virDomainObjListNew()))
 goto error;

@@ -791,7 +817,7 @@ static int testOpenDefault(virConnectPtr conn) {
 }
 virNodeDeviceObjUnlock(nodeobj);

-testDriverUnlock(privconn);
+virMutexUnlock(defaultLock);

 return VIR_DRV_OPEN_SUCCESS;

@@ -802,10 +828,12 @@ error:
 virStoragePoolObjListFree(privconn-pools);
 virNodeDeviceObjListFree(privconn-devs);
 virObjectUnref(privconn-caps);
-testDriverUnlock(privconn);
+virObjectEventStateFree(privconn-domainEventState);
+virMutexDestroy(privconn-lock);
 conn-privateData = NULL;
-VIR_FREE(privconn);
 virDomainDefFree(domdef);
+defaultConnections--;
+virMutexUnlock(defaultLock);
 return VIR_DRV_OPEN_ERROR;
 }

@@ -1327,6 +1355,9 @@ error:
 return ret;
 }

+
+/* No shared state between simultaneous test connections initialized
+ * from a file.  */
 static int
 testOpenFromFile(virConnectPtr conn, const char *file)
 {
@@ -1355,6 +1386,9 @@ testOpenFromFile(virConnectPtr conn, const char *file)
 if (!(privconn-xmlopt = 

Re: [libvirt] [PATCH] test: share state driver between test:///default connections

2014-01-01 Thread Eric Blake
On 01/01/2014 09:54 AM, Eric Blake wrote:
 Prior to this patch, every test:/// URI has its own event manager,
 which means that registering for an event can only ever receive
 events from the connection where it issued the API that triggered
 the event.  But the whole idea of events is to be able to learn
 about something where an API call did NOT trigger the action.
 

 ---
 
 I'm actually playing with moving my test out of the commit message
 and into tests/objecteventtest.c; if I get that working, I'll
 post a v2.

Turned out to be easier than I feared.

https://www.redhat.com/archives/libvir-list/2014-January/msg00022.html

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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 live modify

2014-01-01 Thread Michal Novotny
Hi Umar,
please contact libvirt guys for python bindings. Python bindings for libvirt 
are not handled by me, I handle just the PHP bindings and I'm not aware of the 
function support in the Python bindings.

Happy New Year!

Thanks,
Michal

- Original Message -
From: Umar Draz unix...@gmail.com
To: Michal Novotny minov...@redhat.com
Sent: Monday, December 23, 2013 7:03:17 PM
Subject: Re: [libvirt] libvirt live modify

Hi Michal

Thanks, its work, Ok one question

http://libvirt.org/php/api-reference.html#libvirt_domain_set_metadata

the above link is php api reference link

is there same kind of thing is available for python?

Br.

Umar


On Mon, Dec 23, 2013 at 3:27 PM, Michal Novotny minov...@redhat.com wrote:

 Hi Umar,
 I'm on PTO, fortunately I was checking my e-mail because of the goods to
 declare so I can reply to you.

 For updating this please use the libvirt_domain_set_metadata() API
 function, please see [1] for documentation.

 Hope it helps,
 Michal

 [1] http://libvirt.org/php/api-reference.html#libvirt_domain_set_metadata

 - Original Message -
 From: Umar Draz unix...@gmail.com
 To: Michal Novotny minov...@redhat.com
 Sent: Monday, December 23, 2013 11:05:11 AM
 Subject: Re: [libvirt] libvirt live modify

 Hi Michal,

 Sorry to disturb you again, this works great

 $info = @libvirt_domain_get_metadata($res,
 VIR_DOMAIN_METADATA_DESCRIPTION, '', VIR_DOMAIN_AFFECT_CURRENT);

 Now what I need to do for setting/updating for the domain description or
 title

 Br.

 Umar


 On Wed, Dec 18, 2013 at 8:25 PM, Michal Novotny minov...@redhat.com
 wrote:

  Hi Umar,
  then you don't have working automake setup. Please google how to solve
  it, I apologize but I don't really have much time to solve it right now.
 
  Thanks for understanding,
  Michal
 
  On 12/18/2013 04:21 PM, Umar Draz wrote:
   Hi Michal
  
   I tried
  
   but on autogen.sh is failed
  
   automake: error: global options already processed
   automake: Please contact bug-autom...@gnu.org
   mailto:bug-autom...@gnu.org.
at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0
   line 77.
   Automake::Channels::msg('automake', '', 'global options
   already processed') called at
   /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212
   Automake::ChannelDefs::prog_error('global options already
   processed') called at /usr/share/automake-1.14/Automake/Options.pm
   line 421
  
   Automake::Options::process_global_option_list('HASH(0x246df60)')
   called at /usr/bin/automake line 5331
   Automake::scan_autoconf_traces('configure.ac
   http://configure.ac') called at /usr/bin/automake line 5431
   Automake::scan_autoconf_files() called at /usr/bin/automake
   line 8259
   autoreconf: automake failed with exit status: 29
  
  
   Br.
  
   Umar
  
  
   On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com
   mailto:minov...@redhat.com wrote:
  
   Hi Umar,
   you have to clone it from git repository and compile it and
   install. You
   can simply do it by:
  
   git clone git://libvirt.org/libvirt-php.git
   http://libvirt.org/libvirt-php.git
   ./autogen.sh
   make
   sudo make install
  
   And then you have to restart your Apache webserver.
  
   For example how to use it, see the test in
   test-domain-create-get-metadata.phpt file (it's normal PHP script,
   however I use phpt extension as PHP test but it's standard PHP
 code).
  
   Michal
  
   On 12/18/2013 03:45 PM, Umar Draz wrote:
Hi Michal,
   
Thanks, Now what I need here? I already have
installed libvirt-php-0.4.8, do I need to copy
   
libvirt-php.c
   
   
 
 http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0
  
libvirt-php.
   
   
 
 http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0
  h
in the src directory and reconfigure the php-libvirt?
   
Br.
   
Umar
   
   
On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny
   minov...@redhat.com mailto:minov...@redhat.com
mailto:minov...@redhat.com mailto:minov...@redhat.com
 wrote:
   
Hi Umar,
please see commit
   
  
 
 http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0
.
   
The functions mentioned below have been implemented.
   
Michal
   
On 12/18/2013 01:29 PM, Umar Draz wrote:
 Hi Michal,

 Thanks for your efforts and help. If I need any other API
   I will
 definitely ask you.

 Br.

 Umar


 

[libvirt] help debugging event timing

2014-01-01 Thread Eric Blake
In my recent work on events, I'm running into something where I'm
stumped on timing behavior.  I'm using
virEventRegisterDefaultImpl()/virEventRunDefaultImpl() as my event loop,
and trying to test that an event is firing correctly.

With the test:///default (or any other local URI), if I register an
event callback function, the callback gets invoked almost right after
the event happens.  This is the same behavior under test in our
testsuite (in objecteventtest.c). But with qemu:///system (or any other
remote URI), when I register an event callback function, my callback
does not get invoked until I make some other RPC call on the connection.
 At first, I thought the events were not being wired up at all, and that
I was just blocking forever because I missed something, but while
stepping through gdb on the client side, I noticed that calling
virConnectDomainEventDeregisterAny() in my shutdown code then indeed
proceeded to go through the entire backlog of events that had been
generated, but at that point I was no longer registered so my callback
was not called.  So I ended up using virEventAddTimeout() to set up a
periodic interrupt (at 10 seconds, slow enough to see the delays), where
in the handler I called virConnectGetLibVersion() as a way to force RPC
traffic and at least get events as a result of my timer.  If it matters,
I was initially using keepalive_interval=-1 in
/etc/libvirt/libvirtd.conf in order to avoid killing my debug sessions;
but even when I switched to keepalive_interval=3, I'm still seeing the
same delayed behavior (if the keepalive were to make a difference, I
would have expected seeing the event at 3 seconds instead of my timer at
10 seconds).

I thought that the RPC protocol was supposed to allow asynchronous
events, and with minimal downtime.  gdb in libvirtd says that
remoteDispatchObjectEventSend() is called in a timely manner, but that
merely queues things up, and I got lost trying to follow where
virNetSocketUpdateIOCallback() turned into something that wakes up the
actual write() to the socket.  On the other side, I don't see a call to
virDomainEventDispatchDefaultFunc() which then calls my callback until
the next RPC call/response, but again, I got lost on trying to trace
whether a read() of the socket was getting data in a timely manner but
just not firing anything in my event loop, or whether things were
getting stuck client side after the read but with nothing waking up my
event loop.  Any advice on how to better debug where things are getting
stuck, to determine whether the holdup is in the server not sending or
in the client not being responsive to the send?  Is it something where
systemtap might give me a better picture?  Or better yet, a patch to fix
the problem would be nice.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH] event: improve public API docs

2014-01-01 Thread Eric Blake
On 12/31/2013 08:21 AM, Eric Blake wrote:
 Since libvirt 0.9.3, the entire virevent.c file has been a public
 API, so improve the documentation in this file.  Also, fix a
 potential core dump - it could only be triggered by bogus use of
 the API and would only affect the caller (not libvirtd), but we
 might as well be nice.
 
 * src/libvirt.c (virConnectDomainEventRegister)
 (virConnectDomainEventRegisterAny)
 (virConnectNetworkEventRegisterAny): Document event loop requirement.
 * src/util/virevent.c (virEventAddHandle, virEventRemoveHandle)
 (virEventAddTimeout, virEventRemoveTimeout): Likewise.
 (virEventUpdateHandle, virEventUpdateTimeout): Likewise, and avoid
 core dump if caller didn't register handler.
 (virEventRunDefaultImpl): Expand example, and set up code block in
 html docs.
 (virEventRegisterImpl, virEventRegisterDefaultImpl): Document more
 on the use of the event loop.
 
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/libvirt.c   | 24 ++--
  src/util/virevent.c | 82 
 +++--
  2 files changed, 70 insertions(+), 36 deletions(-)

I plan on squashing this in, too.

diff --git i/src/libvirt.c w/src/libvirt.c
index 0752c3f..753c71f 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -2,7 +2,7 @@
  * libvirt.c: Main interfaces for the libvirt library to handle
virtualization
  *   domains from a process running in domain 0
  *
- * Copyright (C) 2005-2006, 2008-2013 Red Hat, Inc.
+ * Copyright (C) 2005-2006, 2008-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
@@ -21454,17 +21454,18 @@ error:
  * @interval: number of seconds of inactivity before a keepalive
message is sent
  * @count: number of messages that can be sent in a row
  *
- * Start sending keepalive messages after interval second of inactivity and
+ * Start sending keepalive messages after @interval seconds of
inactivity and
  * consider the connection to be broken when no response is received after
- * count keepalive messages sent in a row.  In other words, sending
count + 1
- * keepalive message results in closing the connection.  When interval
is = 0,
- * no keepalive messages will be sent.  When count is 0, the connection
will be
- * automatically closed after interval seconds of inactivity without
sending
- * any keepalive messages.
- *
- * Note: client has to implement and run event loop to be able to use
keepalive
- * messages.  Failure to do so may result in connections being closed
- * unexpectedly.
+ * @count keepalive messages sent in a row.  In other words, sending
count + 1
+ * keepalive message results in closing the connection.  When @interval is
+ * = 0, no keepalive messages will be sent.  When @count is 0, the
connection
+ * will be automatically closed after interval seconds of inactivity
without
+ * sending any keepalive messages.
+ *
+ * Note: The client has to implement and run an event loop with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl() to be able to
+ * use keepalive messages.  Failure to do so may result in connections
+ * being closed unexpectedly.
  *
  * Note: This API function controls only keepalive messages sent by the
client.
  * If the server is configured to use keepalive you still need to run
the event
diff --git i/src/util/virevent.c w/src/util/virevent.c
index 0c94946..f3cebe0 100644
--- i/src/util/virevent.c
+++ w/src/util/virevent.c
@@ -1,7 +1,7 @@
 /*
  * virevent.c: event loop for monitoring file handles
  *
- * Copyright (C) 2007, 2011, 2013 Red Hat, Inc.
+ * Copyright (C) 2007, 2011, 2013-2014 Red Hat, Inc.
  * Copyright (C) 2007 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -205,7 +205,11 @@ virEventRemoveTimeout(int timer)
  * Use of the virEventAddHandle() and similar APIs require that the
  * corresponding handler be registered.  Use of the
  * virConnectDomainEventRegisterAny() and similar APIs requires that
- * the three timeout handlers be registered.
+ * the three timeout handlers be registered.  Likewise, the three
+ * timeout handlers must be registered if the remote server has been
+ * configured to send keepalive messages, or if the client intends
+ * to call virConnectSetKeepAlive(), to avoid either side from
+ * unexpectedly closing the connection due to inactivity.
  *
  * If an application does not need to integrate with an
  * existing event loop implementation, then the

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

[libvirt] How to execute an initial script in a container to start the network interface automatically

2014-01-01 Thread WANG Cheng D
Dear All,

Happy new year to you.

I have a similar question which had been replied by Daniel in the following 
post:

http://www.redhat.com/archives/libvir-list/2010-March/msg00296.html

I also want to assign a static IP to the container.

As Daniel said, I can successfully assign a static IP to the container manually 
using  # ifconfig eth0 192.168.122.3 netmask 255.255.255.0 up.

Daniel also said that we can use the regular distro initscripts to 
automatically start the network interface, but this doesn't work on my system.

My host is fedora16. I used the command yum --installroot=/root/fedora16lxc 
--releasever=16 install -y openssh, bridge-utils to setup the rootfs for my 
container, but I am not sure if it is a right way.

After rootfs installation, there is no sub-directory named network-scripts in 
/etc/sysconfig . So, I created this directory manually and added a file named 
ifcfg-eth0.

In my container's XML script, I use init/bin/sh/init. If I use 
init/bin/init/init,  it seems that the container doesn't boot correctly 
because there are strings keeping rolling in the console.

My libvirtd and virsh version is 1.0.3.

I tried to add files .bash_profile and .bashrc in which I revised the shell 
environment variable such as PATH, I also added the ifconfig in the script to 
try to configure eth0 automatically, but it doesn't work.

I wonder if there is a .bashrc for the root of a container? If there is, 
where should this file be located?

In summary, I have two questions


1)   How to setup rootfs for a container?



2)   If a container can automatically execute an initial script when 
booting?

Your reply is highly appreciated.

With my warmest regards,

Cheng

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