Re: [libvirt] problems starting several qemu VMS simultaneously

2012-03-29 Thread Serge Hallyn
Quoting Serge Hallyn (serge.hal...@canonical.com):
 Quoting Wen Congyang (we...@cn.fujitsu.com):
  At 03/22/2012 06:54 AM, Serge Hallyn Wrote:
   Hi,
   
   I grabbed today's git head of libvirt.  Created a VM (clean install of
   ubuntu oneiric, installed through virt-manager), and cloned it 3 times.
   Then I did
   
   serge@ubuntu:~$ for i in `seq 1 4`; do virsh start o$i   /tmp/o$i 21  
   done
   [1] 12184
   [2] 12185
   [3] 12186
   [4] 12187
   serge@ubuntu:~$ virsh list
   error: Failed to list active domains
   error: End of file while reading data: Input/output error

(Note that most of the time, virsh list actually succeeds, only one of
the virsh start's fails)

  I cannot reproduce this problem on RHEL6.
 
 ...
 
 Hmm, today I can't either.  With various packages and built binaries.  I
 wonder if it has to do with the kernel.  I'll re-try an install from
 scratch.

It's not the kernel.  (Well, at least not the oneiric kernel).  However
I have to do the 'virsh list' very fast, so it happens while the others
are still starting up.  That seems to be the trigger.  Without that,
all start up fine.  With that, more often than not I get at least one
failure.

I'll try to reproduce with rhel6, but setup will take me some time.

Or maybe I'll first add some debugging info to qemuDomainObjBeginJobInternal()
and qemuProcessStart().  Since virsh always seems to lose the connection
while waiting for handshake from child, it seems a good place to check.

-serge

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


Re: [libvirt] Constantly changing USB product ID

2012-03-29 Thread Philipp Hahn
Hello Jaap,

On Thursday 29 March 2012 01:51:21 Jaap Winius wrote:
 Okay, thanks; so now I know that it's not just badly designed hardware
 that may do this. My device, however, is not a smart-phone or some
 other consumer device: it's a scanner with a rotating drum on which to
 mount flexible, reusable photographic plates from an X-ray machine.
 It's rather expensive too. Of course, it only works with a Windows
 application. Can you imagine a legitimate reason why a machine like
 this might keep flipping its product ID?

I know of some USB devices which use this trick to load there firmware: 
Initially the start without a firmware (so the manufacurer doesn't need to 
put a flash chip on the device) an USB-ID A. Windows detects the device using 
the ID and uploads the firmware to the device, which then soft-resets itself 
and re-appears with USB-ID B.

Sincerely
Philipp
-- 
Philipp Hahn   Open Source Software Engineer  h...@univention.de
Univention GmbHbe open.   fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen fax: +49 421 22 232-99
   http://www.univention.de/


signature.asc
Description: This is a digitally signed message part.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH test-API 1/2] lib: pass instance of ConnectAPI into other lib modules

2012-03-29 Thread Martin Kletzander
On 03/26/2012 07:18 PM, Guannan Ren wrote:
  This change make any instance of subclasses in libvirt.py
  invisible to testcases in order to catch libvirtError.
 
connectAPI.py
domainAPI.py
interfaceAPI.py
networkAPI.py
nodedevAPI.py
nwfilterAPI.py
secretAPI.py
snapshotAPI.py
storageAPI.py
streamAPI.py
 ---
  lib/connectAPI.py   |   21 +++--
  lib/domainAPI.py|2 +-
  lib/interfaceAPI.py |2 +-
  lib/networkAPI.py   |2 +-
  lib/nodedevAPI.py   |2 +-
  lib/nwfilterAPI.py  |2 +-
  lib/secretAPI.py|2 +-
  lib/snapshotAPI.py  |2 +-
  lib/storageAPI.py   |2 +-
  lib/streamAPI.py|5 +++--
  10 files changed, 22 insertions(+), 20 deletions(-)
 
 diff --git a/lib/connectAPI.py b/lib/connectAPI.py
 index 9f2b728..796df33 100644
 --- a/lib/connectAPI.py
 +++ b/lib/connectAPI.py
 @@ -39,36 +39,37 @@ append_path(result.group(0))
  import exception
  
  class ConnectAPI(object):
 -def __init__(self):
 +def __init__(self, uri):
 +self.uri = uri
  self.conn = None
  
 -def open(self, uri):
 +def open(self):
  try:
 -self.conn = libvirt.open(uri)
 -return self.conn
 +self.conn = libvirt.open(self.uri)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)
  
 -def open_read_only(self, uri):
 +def open_read_only(self):
  try:
 -self.conn = libvirt.openReadOnly(uri)
 -return self.conn
 +self.conn = libvirt.openReadOnly(self.uri)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)
  
 -def openAuth(self, uri, auth, flags = 0):
 +def openAuth(self, auth, flags = 0):
  try:
 -self.conn = libvirt.openAuth(uri, auth, flags)
 -return self.conn
 +self.conn = libvirt.openAuth(self.uri, auth, flags)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)
  
 +def get_conn(self):
 +return self.conn
 +
  def get_caps(self):
  try:
  caps = self.conn.getCapabilities()
 diff --git a/lib/domainAPI.py b/lib/domainAPI.py
 index 43565c2..e38acb6 100644
 --- a/lib/domainAPI.py
 +++ b/lib/domainAPI.py
 @@ -42,7 +42,7 @@ import exception
  
  class DomainAPI(object):
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
This is one option how to keep the object, however maybe we can make use
of the encapsulation everywhere, not just in the test cases, but this
would require rewriting a lot more code and is not needed at this point.
  def get_list(self):
  dom_list = []
 diff --git a/lib/interfaceAPI.py b/lib/interfaceAPI.py
 index 1abf861..2f4c13b 100644
 --- a/lib/interfaceAPI.py
 +++ b/lib/interfaceAPI.py
 @@ -44,7 +44,7 @@ VIR_INTERFACE_ERROR = -1
  
  class InterfaceAPI(object):
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
  def get_active_list(self):
  try:
 diff --git a/lib/networkAPI.py b/lib/networkAPI.py
 index d28f699..e0f0721 100644
 --- a/lib/networkAPI.py
 +++ b/lib/networkAPI.py
 @@ -39,7 +39,7 @@ import exception
  
  class NetworkAPI(object):
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
  def define(self, netxmldesc):
  try:
 diff --git a/lib/nodedevAPI.py b/lib/nodedevAPI.py
 index 64fc4b8..4ce3cf1 100644
 --- a/lib/nodedevAPI.py
 +++ b/lib/nodedevAPI.py
 @@ -40,7 +40,7 @@ import exception
  
  class NodedevAPI:
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
  def create(self, device_xml):
  try:
 diff --git a/lib/nwfilterAPI.py b/lib/nwfilterAPI.py
 index 9cf7050..4f5c58f 100644
 --- a/lib/nwfilterAPI.py
 +++ b/lib/nwfilterAPI.py
 @@ -39,7 +39,7 @@ import exception
  
  class nwfilterAPI(object):
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
  def get_list(self):
  try:
 diff --git a/lib/secretAPI.py b/lib/secretAPI.py
 index 4aac27f..149517c 100644
 --- a/lib/secretAPI.py
 +++ b/lib/secretAPI.py
 @@ -39,7 +39,7 @@ import exception
  
  class SecretAPI(object):
  def __init__(self, connection):
 -self.conn = connection
 +self.conn = connection.get_conn()
  
  def get_defined_list(self):
  try:
 diff --git a/lib/snapshotAPI.py b/lib/snapshotAPI.py
 

Re: [libvirt] [PATCH test-API 1/2] lib: pass instance of ConnectAPI into other lib modules

2012-03-29 Thread Guannan Ren

On 03/29/2012 05:14 PM, Martin Kletzander wrote:

On 03/26/2012 07:18 PM, Guannan Ren wrote:

  This change make any instance of subclasses in libvirt.py
  invisible to testcases in order to catch libvirtError.

connectAPI.py
domainAPI.py
interfaceAPI.py
networkAPI.py
nodedevAPI.py
nwfilterAPI.py
secretAPI.py
snapshotAPI.py
storageAPI.py
streamAPI.py
---
  lib/connectAPI.py   |   21 +++--
  lib/domainAPI.py|2 +-
  lib/interfaceAPI.py |2 +-
  lib/networkAPI.py   |2 +-
  lib/nodedevAPI.py   |2 +-
  lib/nwfilterAPI.py  |2 +-
  lib/secretAPI.py|2 +-
  lib/snapshotAPI.py  |2 +-
  lib/storageAPI.py   |2 +-
  lib/streamAPI.py|5 +++--
  10 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/lib/connectAPI.py b/lib/connectAPI.py
index 9f2b728..796df33 100644
--- a/lib/connectAPI.py
+++ b/lib/connectAPI.py
@@ -39,36 +39,37 @@ append_path(result.group(0))
  import exception

  class ConnectAPI(object):
-def __init__(self):
+def __init__(self, uri):
+self.uri = uri
  self.conn = None

-def open(self, uri):
+def open(self):
  try:
-self.conn = libvirt.open(uri)
-return self.conn
+self.conn = libvirt.open(self.uri)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)

-def open_read_only(self, uri):
+def open_read_only(self):
  try:
-self.conn = libvirt.openReadOnly(uri)
-return self.conn
+self.conn = libvirt.openReadOnly(self.uri)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)

-def openAuth(self, uri, auth, flags = 0):
+def openAuth(self, auth, flags = 0):
  try:
-self.conn = libvirt.openAuth(uri, auth, flags)
-return self.conn
+self.conn = libvirt.openAuth(self.uri, auth, flags)
  except libvirt.libvirtError, e:
  message = e.get_error_message()
  code = e.get_error_code()
  raise exception.LibvirtAPI(message, code)

+def get_conn(self):
+return self.conn
+
  def get_caps(self):
  try:
  caps = self.conn.getCapabilities()
diff --git a/lib/domainAPI.py b/lib/domainAPI.py
index 43565c2..e38acb6 100644
--- a/lib/domainAPI.py
+++ b/lib/domainAPI.py
@@ -42,7 +42,7 @@ import exception

  class DomainAPI(object):
  def __init__(self, connection):
-self.conn = connection
+self.conn = connection.get_conn()


This is one option how to keep the object, however maybe we can make use
of the encapsulation everywhere, not just in the test cases, but this
would require rewriting a lot more code and is not needed at this point.


  yes, I agree.


ACK with the second patch modified as written in it.

Martin


 Thanks and pushed.

 Guannan Ren

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


[libvirt] [PATCH 0/4] Fix problems in test suite on Win32

2012-03-29 Thread Daniel P. Berrange
Since we enable the test suite by default now for all git
checkouts, we need to make sure it actually builds on Win32.
This series fixes it

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


Re: [libvirt] [PATCH] Set default name for SPICE agent channel

2012-03-29 Thread Christophe Fergeau
On Wed, Mar 28, 2012 at 03:20:45PM -0400, Laine Stump wrote:
 I know I'm a bit late to the party (I missed your mail before), but
 would it have been possible to do the default processing in the caller
 rather than in the parsing function itself?

I cannot disagree since I was not sure at all that this was the right place
for setting defaults, I should have mentioned this explicitly when sending
the patch.. Who is the caller exactly in this case?

Thanks,

Christophe


pgp2qVMgVs7SJ.pgp
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/4] Fix some format specifiers for size_t vs ssize_t

2012-03-29 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

A handful of places used %zd for format specifiers even
though the args was size_t, not ssize_t.

* src/remote/remote_driver.c, src/util/xml.c: s/%zd/%zu/

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 src/remote/remote_driver.c |6 +++---
 src/util/xml.c |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 8df690b..30ca6a5 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1839,7 +1839,7 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, 
virSecurityLabelPtr seclabel)
 
 if (ret.label.label_val != NULL) {
 if (strlen (ret.label.label_val) = sizeof seclabel-label) {
-remoteError(VIR_ERR_RPC, _(security label exceeds maximum: %zd),
+remoteError(VIR_ERR_RPC, _(security label exceeds maximum: %zu),
 sizeof seclabel-label - 1);
 goto cleanup;
 }
@@ -1910,7 +1910,7 @@ remoteNodeGetSecurityModel (virConnectPtr conn, 
virSecurityModelPtr secmodel)
 
 if (ret.model.model_val != NULL) {
 if (strlen (ret.model.model_val) = sizeof secmodel-model) {
-remoteError(VIR_ERR_RPC, _(security model exceeds maximum: %zd),
+remoteError(VIR_ERR_RPC, _(security model exceeds maximum: %zu),
 sizeof secmodel-model - 1);
 goto cleanup;
 }
@@ -1919,7 +1919,7 @@ remoteNodeGetSecurityModel (virConnectPtr conn, 
virSecurityModelPtr secmodel)
 
 if (ret.doi.doi_val != NULL) {
 if (strlen (ret.doi.doi_val) = sizeof secmodel-doi) {
-remoteError(VIR_ERR_RPC, _(security doi exceeds maximum: %zd),
+remoteError(VIR_ERR_RPC, _(security doi exceeds maximum: %zu),
 sizeof secmodel-doi - 1);
 goto cleanup;
 }
diff --git a/src/util/xml.c b/src/util/xml.c
index 1e0a48a..79a9d27 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -107,7 +107,7 @@ virXPathStringLimit(const char *xpath,
 
 if (tmp != NULL  strlen(tmp) = maxlen) {
 virXMLError(VIR_ERR_INTERNAL_ERROR,
-_(\'%s\' value longer than %zd bytes),
+_(\'%s\' value longer than %zu bytes),
 xpath, maxlen);
 VIR_FREE(tmp);
 return NULL;
-- 
1.7.7.6

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


[libvirt] [PATCH 2/4] Fix format specifiers in test cases on Win32

2012-03-29 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

Some of the test suites use fprintf with format specifiers
that are not supported on Win32 and are not fixed by gnulib.

The mingw32 compiler also has trouble detecting ssize_t
correctly, complaining that 'ssize_t' does not match
'signed size_t' (which it expects for %zd). Force the
cast to size_t to avoid this problem

* tests/testutils.c, tests/testutils.h: Fix printf
  annotation on virTestResult. Use virVasprintf
  instead of vfprintf
* tests/virhashtest.c: Use VIR_WARN instead of fprintf(stderr).
  Cast to size_t to avoid mingw32 compiler bug

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 tests/testutils.c   |8 ++--
 tests/testutils.h   |3 ++-
 tests/virhashtest.c |   24 +++-
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 4b224ee..4e8484f 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -72,7 +72,7 @@ virtTestCountAverage(double *items, int nitems)
 return (double) (sum / nitems);
 }
 
-ATTRIBUTE_FMT_PRINTF(3,4)
+
 void virtTestResult(const char *name, int ret, const char *msg, ...)
 {
 va_list vargs;
@@ -89,7 +89,11 @@ void virtTestResult(const char *name, int ret, const char 
*msg, ...)
 else {
 fprintf(stderr, FAILED\n);
 if (msg) {
-vfprintf(stderr, msg, vargs);
+char *str;
+if (virVasprintf(str, msg, vargs) == 0) {
+fprintf(stderr, %s, str);
+VIR_FREE(str);
+}
 }
 }
 } else {
diff --git a/tests/testutils.h b/tests/testutils.h
index 2fde1b5..f8c7567 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -23,7 +23,8 @@ extern char *abs_srcdir;
 double virtTestCountAverage(double *items,
 int nitems);
 
-void virtTestResult(const char *name, int ret, const char *msg, ...);
+void virtTestResult(const char *name, int ret, const char *msg, ...)
+ATTRIBUTE_FMT_PRINTF(3,4);
 int virtTestRun(const char *title,
 int nloops,
 int (*body)(const void *data),
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index ba0cf02..be82281 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -10,11 +10,17 @@
 #include virhashdata.h
 #include testutils.h
 #include memory.h
+#include util.h
+#include logging.h
 
 
 #define testError(...)  \
 do {\
-fprintf(stderr, __VA_ARGS__);   \
+char *str;  \
+if (virAsprintf(str, __VA_ARGS__) == 0) {  \
+fprintf(stderr, %s, str); \
+VIR_FREE(str);  \
+}   \
 /* Pad to line up with test name ... in virTestRun */   \
 fprintf(stderr, %74s, ... );\
 } while (0)
@@ -40,16 +46,16 @@ testHashInit(int size)
 }
 
 if (virHashTableSize(hash) != oldsize  virTestGetDebug()) {
-fprintf(stderr, \nhash grown from %zd to %zd,
-oldsize, virHashTableSize(hash));
+VIR_WARN(hash grown from %zd to %zd,
+ (size_t)oldsize, (size_t)virHashTableSize(hash));
 }
 }
 
 for (i = 0; i  ARRAY_CARDINALITY(uuids); i++) {
 if (!virHashLookup(hash, uuids[i])) {
 if (virTestGetVerbose()) {
-fprintf(stderr, \nentry \%s\ could not be found\n,
-uuids[i]);
+VIR_WARN(\nentry \%s\ could not be found\n,
+ uuids[i]);
 }
 virHashFree(hash);
 return NULL;
@@ -75,15 +81,15 @@ testHashCheckCount(virHashTablePtr hash, size_t count)
 ssize_t iter_count = 0;
 
 if (virHashSize(hash) != count) {
-testError(\nhash contains %zd instead of %zu elements\n,
-  virHashSize(hash), count);
+testError(\nhash contains %zu instead of %zu elements\n,
+  (size_t)virHashSize(hash), count);
 return -1;
 }
 
 iter_count = virHashForEach(hash, testHashCheckForEachCount, NULL);
 if (count != iter_count) {
-testError(\nhash claims to have %zu elements but iteration finds 
%zd\n,
-  count, iter_count);
+testError(\nhash claims to have %zu elements but iteration finds 
%zu\n,
+  count, (size_t)iter_count);
 return -1;
 }
 
-- 
1.7.7.6

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


[libvirt] [PATCH 3/4] Don't redefine the CPU comparison constants in CPU test

2012-03-29 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

Defining an enum with names like ERROR causes  a world of
hurt on Win32 whose headers have such symbol names already

* tests/cputest.c: Remove redefinition of CPU constants

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 tests/cputest.c |   75 +--
 1 files changed, 34 insertions(+), 41 deletions(-)

diff --git a/tests/cputest.c b/tests/cputest.c
index 6c1efe6..9928e5d 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -43,13 +43,6 @@ static const char *abs_top_srcdir;
 
 #define VIR_FROM_THIS VIR_FROM_CPU
 
-enum compResultShadow {
-ERROR   = VIR_CPU_COMPARE_ERROR,
-INCOMPATIBLE= VIR_CPU_COMPARE_INCOMPATIBLE,
-IDENTICAL   = VIR_CPU_COMPARE_IDENTICAL,
-SUPERSET= VIR_CPU_COMPARE_SUPERSET
-};
-
 enum cpuTestBoolWithError {
 FAIL= -1,
 NO  = 0,
@@ -558,45 +551,45 @@ mymain(void)
 preferred, result)
 
 /* host to host comparison */
-DO_TEST_COMPARE(x86, host, host, IDENTICAL);
-DO_TEST_COMPARE(x86, host, host-better, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, host-worse, SUPERSET);
-DO_TEST_COMPARE(x86, host, host-amd-fake, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, host-incomp-arch, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, host-no-vendor, IDENTICAL);
-DO_TEST_COMPARE(x86, host-no-vendor, host, INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, host, VIR_CPU_COMPARE_IDENTICAL);
+DO_TEST_COMPARE(x86, host, host-better, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, host-worse, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, host-amd-fake, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, host-incomp-arch, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, host-no-vendor, 
VIR_CPU_COMPARE_IDENTICAL);
+DO_TEST_COMPARE(x86, host-no-vendor, host, 
VIR_CPU_COMPARE_INCOMPATIBLE);
 
 /* guest to host comparison */
-DO_TEST_COMPARE(x86, host, bogus-model, ERROR);
-DO_TEST_COMPARE(x86, host, bogus-feature, ERROR);
-DO_TEST_COMPARE(x86, host, min, SUPERSET);
-DO_TEST_COMPARE(x86, host, pentium3, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-forbid, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, exact-forbid-extra, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-disable, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-disable2, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-disable-extra, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-require, SUPERSET);
-DO_TEST_COMPARE(x86, host, exact-require-extra, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, exact-force, SUPERSET);
-DO_TEST_COMPARE(x86, host, strict, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host, strict-full, IDENTICAL);
-DO_TEST_COMPARE(x86, host, strict-disable, IDENTICAL);
-DO_TEST_COMPARE(x86, host, strict-force-extra, IDENTICAL);
-DO_TEST_COMPARE(x86, host, guest, SUPERSET);
-DO_TEST_COMPARE(x86, host, pentium3-amd, INCOMPATIBLE);
-DO_TEST_COMPARE(x86, host-amd, pentium3-amd, SUPERSET);
-DO_TEST_COMPARE(x86, host-worse, nehalem-force, IDENTICAL);
+DO_TEST_COMPARE(x86, host, bogus-model, VIR_CPU_COMPARE_ERROR);
+DO_TEST_COMPARE(x86, host, bogus-feature, VIR_CPU_COMPARE_ERROR);
+DO_TEST_COMPARE(x86, host, min, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, pentium3, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-forbid, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, exact-forbid-extra, 
VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-disable, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-disable2, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-disable-extra, 
VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-require, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, exact-require-extra, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, exact-force, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, strict, VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host, strict-full, VIR_CPU_COMPARE_IDENTICAL);
+DO_TEST_COMPARE(x86, host, strict-disable, 
VIR_CPU_COMPARE_IDENTICAL);
+DO_TEST_COMPARE(x86, host, strict-force-extra, 
VIR_CPU_COMPARE_IDENTICAL);
+DO_TEST_COMPARE(x86, host, guest, VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host, pentium3-amd, 
VIR_CPU_COMPARE_INCOMPATIBLE);
+DO_TEST_COMPARE(x86, host-amd, pentium3-amd, 
VIR_CPU_COMPARE_SUPERSET);
+DO_TEST_COMPARE(x86, host-worse, nehalem-force, 
VIR_CPU_COMPARE_IDENTICAL);
 
 /* guest updates for migration
  * automatically compares host CPU with the result */
-DO_TEST_UPDATE(x86, host, min, IDENTICAL);
-DO_TEST_UPDATE(x86, host, pentium3, IDENTICAL);
-

[libvirt] [PATCH 4/4] Disable build of commandhelper ssh on Win32

2012-03-29 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

The commandhelper.c  ssh.c programs rely on various APIs not present
on Win32. Disable them, since the tests that uses these helpers are
already disabled

* tests/commandhelper.c, tests/ssh.c: Disable on WIN32

Signed-off-by: Daniel P. Berrange berra...@redhat.com
---
 tests/commandhelper.c |   13 +
 tests/ssh.c   |   13 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 71d93be..a80d191 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -30,6 +30,9 @@
 #include util.h
 #include memory.h
 #include virfile.h
+#include testutils.h
+
+#ifndef WIN32
 
 
 static int envsort(const void *a, const void *b) {
@@ -140,3 +143,13 @@ int main(int argc, char **argv) {
 error:
 return EXIT_FAILURE;
 }
+
+#else
+
+int
+main(void)
+{
+return EXIT_AM_SKIP;
+}
+
+#endif
diff --git a/tests/ssh.c b/tests/ssh.c
index 08bb63d..49b6bce 100644
--- a/tests/ssh.c
+++ b/tests/ssh.c
@@ -22,6 +22,9 @@
 
 #include stdio.h
 #include internal.h
+#include testutils.h
+
+#ifndef WIN32
 
 int main(int argc, char **argv)
 {
@@ -52,3 +55,13 @@ int main(int argc, char **argv)
 
 return 0;
 }
+
+#else
+
+int
+main(void)
+{
+return EXIT_AM_SKIP;
+}
+
+#endif
-- 
1.7.7.6

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


Re: [libvirt] [PATCH test-API 2/2] repos: modify existing testcases to support it

2012-03-29 Thread Guannan Ren

On 03/29/2012 05:17 PM, Martin Kletzander wrote:

On 03/26/2012 07:18 PM, Guannan Ren wrote:

---
  repos/domain/attach_disk.py|6 +++---
  repos/domain/attach_interface.py   |6 +++---
  repos/domain/autostart.py  |6 +++---
  repos/domain/balloon_memory.py |6 +++---
  repos/domain/blkstats.py   |6 +++---
  repos/domain/cpu_affinity.py   |6 +++---
  repos/domain/cpu_topology.py   |6 +++---
  repos/domain/create.py |6 +++---
  repos/domain/define.py |6 +++---
  repos/domain/destroy.py|6 +++---
  repos/domain/detach_disk.py|6 +++---
  repos/domain/detach_interface.py   |6 +++---
  repos/domain/domain_blkinfo.py |6 +++---
  repos/domain/domain_id.py  |6 +++---
  repos/domain/domain_uuid.py|6 +++---
  repos/domain/dump.py   |6 +++---
  repos/domain/eventhandler.py   |6 +++---
  repos/domain/ifstats.py|6 +++---
  repos/domain/install_image.py  |6 +++---
  repos/domain/install_linux_cdrom.py|6 +++---
  repos/domain/install_linux_check.py|6 +++---
  repos/domain/install_linux_net.py  |6 +++---
  repos/domain/install_windows_cdrom.py  |6 +++---
  repos/domain/migrate.py|   11 ++-
  repos/domain/ownership_test.py |6 +++---
  repos/domain/reboot.py |6 +++---
  repos/domain/restore.py|6 +++---
  repos/domain/resume.py |6 +++---
  repos/domain/save.py   |6 +++---
  repos/domain/sched_params.py   |6 +++---
  repos/domain/shutdown.py   |6 +++---
  repos/domain/start.py  |6 +++---
  repos/domain/suspend.py|6 +++---
  repos/domain/undefine.py   |6 +++---
  repos/domain/update_devflag.py |6 +++---
  repos/interface/create.py  |6 +++---
  repos/interface/define.py  |6 +++---
  repos/interface/destroy.py |6 +++---
  repos/interface/undefine.py|6 +++---
  repos/libvirtd/qemu_hang.py|6 +++---
  repos/libvirtd/restart.py  |6 +++---
  repos/network/autostart.py |6 +++---
  repos/network/create.py|6 +++---
  repos/network/define.py|6 +++---
  repos/network/destroy.py   |6 +++---
  repos/network/network_list.py  |6 +++---
  repos/network/network_name.py  |6 +++---
  repos/network/network_uuid.py  |6 +++---
  repos/network/start.py |6 +++---
  repos/network/undefine.py  |6 +++---
  repos/nodedevice/detach.py |6 +++---
  repos/nodedevice/reattach.py   |6 +++---
  repos/nodedevice/reset.py  |6 +++---
  repos/npiv/create_virtual_hba.py   |6 +++---
  .../multiple_thread_block_on_domain_create.py  |6 +++---
  repos/remoteAccess/tcp_setup.py|6 +++---
  repos/remoteAccess/tls_setup.py|6 +++---
  repos/remoteAccess/unix_perm_sasl.py   |   10 +-
  repos/sVirt/domain_nfs_start.py|   18 +-
  repos/snapshot/delete.py   |8 
  repos/snapshot/file_flag.py|6 +++---
  repos/snapshot/flag_check.py   |6 +++---
  repos/snapshot/internal_create.py  |8 
  repos/snapshot/revert.py   |8 
  repos/storage/activate_pool.py |6 +++---
  repos/storage/build_dir_pool.py|6 +++---
  repos/storage/build_disk_pool.py   |6 +++---
  repos/storage/build_logical_pool.py|6 +++---
  repos/storage/build_netfs_pool.py  |6 +++---
  repos/storage/create_dir_pool.py   |6 +++---
  repos/storage/create_dir_volume.py |6 +++---
  repos/storage/create_fs_pool.py|6 +++---
  repos/storage/create_iscsi_pool.py 

Re: [libvirt] [PATCH 1/4] Fix some format specifiers for size_t vs ssize_t

2012-03-29 Thread Laine Stump
On 03/29/2012 05:53 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com

 A handful of places used %zd for format specifiers even
 though the args was size_t, not ssize_t.

 * src/remote/remote_driver.c, src/util/xml.c: s/%zd/%zu/

 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  src/remote/remote_driver.c |6 +++---
  src/util/xml.c |2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)

ACK


 diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
 index 8df690b..30ca6a5 100644
 --- a/src/remote/remote_driver.c
 +++ b/src/remote/remote_driver.c
 @@ -1839,7 +1839,7 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, 
 virSecurityLabelPtr seclabel)
  
  if (ret.label.label_val != NULL) {
  if (strlen (ret.label.label_val) = sizeof seclabel-label) {
 -remoteError(VIR_ERR_RPC, _(security label exceeds maximum: 
 %zd),
 +remoteError(VIR_ERR_RPC, _(security label exceeds maximum: 
 %zu),
  sizeof seclabel-label - 1);
  goto cleanup;
  }
 @@ -1910,7 +1910,7 @@ remoteNodeGetSecurityModel (virConnectPtr conn, 
 virSecurityModelPtr secmodel)
  
  if (ret.model.model_val != NULL) {
  if (strlen (ret.model.model_val) = sizeof secmodel-model) {
 -remoteError(VIR_ERR_RPC, _(security model exceeds maximum: 
 %zd),
 +remoteError(VIR_ERR_RPC, _(security model exceeds maximum: 
 %zu),
  sizeof secmodel-model - 1);
  goto cleanup;
  }
 @@ -1919,7 +1919,7 @@ remoteNodeGetSecurityModel (virConnectPtr conn, 
 virSecurityModelPtr secmodel)
  
  if (ret.doi.doi_val != NULL) {
  if (strlen (ret.doi.doi_val) = sizeof secmodel-doi) {
 -remoteError(VIR_ERR_RPC, _(security doi exceeds maximum: %zd),
 +remoteError(VIR_ERR_RPC, _(security doi exceeds maximum: %zu),
  sizeof secmodel-doi - 1);
  goto cleanup;
  }
 diff --git a/src/util/xml.c b/src/util/xml.c
 index 1e0a48a..79a9d27 100644
 --- a/src/util/xml.c
 +++ b/src/util/xml.c
 @@ -107,7 +107,7 @@ virXPathStringLimit(const char *xpath,
  
  if (tmp != NULL  strlen(tmp) = maxlen) {
  virXMLError(VIR_ERR_INTERNAL_ERROR,
 -_(\'%s\' value longer than %zd bytes),
 +_(\'%s\' value longer than %zu bytes),
  xpath, maxlen);
  VIR_FREE(tmp);
  return NULL;

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


Re: [libvirt] [PATCH 2/4] Fix format specifiers in test cases on Win32

2012-03-29 Thread Laine Stump
On 03/29/2012 05:53 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com

 Some of the test suites use fprintf with format specifiers
 that are not supported on Win32 and are not fixed by gnulib.

 The mingw32 compiler also has trouble detecting ssize_t
 correctly, complaining that 'ssize_t' does not match
 'signed size_t' (which it expects for %zd). Force the
 cast to size_t to avoid this problem

 * tests/testutils.c, tests/testutils.h: Fix printf
   annotation on virTestResult. Use virVasprintf
   instead of vfprintf
 * tests/virhashtest.c: Use VIR_WARN instead of fprintf(stderr).
   Cast to size_t to avoid mingw32 compiler bug

 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  tests/testutils.c   |8 ++--
  tests/testutils.h   |3 ++-
  tests/virhashtest.c |   24 +++-
  3 files changed, 23 insertions(+), 12 deletions(-)

ACK

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


Re: [libvirt] [PATCH 3/4] Don't redefine the CPU comparison constants in CPU test

2012-03-29 Thread Laine Stump
On 03/29/2012 05:53 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com

 Defining an enum with names like ERROR causes  a world of
 hurt on Win32 whose headers have such symbol names already

 * tests/cputest.c: Remove redefinition of CPU constants

 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  tests/cputest.c |   75 
 +--
  1 files changed, 34 insertions(+), 41 deletions(-)

 diff --git a/tests/cputest.c b/tests/cputest.c
 index 6c1efe6..9928e5d 100644
 --- a/tests/cputest.c
 +++ b/tests/cputest.c
 @@ -43,13 +43,6 @@ static const char *abs_top_srcdir;
  
  #define VIR_FROM_THIS VIR_FROM_CPU
  
 -enum compResultShadow {
 -ERROR   = VIR_CPU_COMPARE_ERROR,
 -INCOMPATIBLE= VIR_CPU_COMPARE_INCOMPATIBLE,
 -IDENTICAL   = VIR_CPU_COMPARE_IDENTICAL,
 -SUPERSET= VIR_CPU_COMPARE_SUPERSET
 -};
 -

Why was this done to begin with? To save typing/columns?

At any rate, ACK.

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


Re: [libvirt] [PATCH 4/4] Disable build of commandhelper ssh on Win32

2012-03-29 Thread Laine Stump
On 03/29/2012 05:53 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com

 The commandhelper.c  ssh.c programs rely on various APIs not present
 on Win32. Disable them, since the tests that uses these helpers are
 already disabled

 * tests/commandhelper.c, tests/ssh.c: Disable on WIN32

 Signed-off-by: Daniel P. Berrange berra...@redhat.com
 ---
  tests/commandhelper.c |   13 +
  tests/ssh.c   |   13 +
  2 files changed, 26 insertions(+), 0 deletions(-)

ACK.

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


[libvirt] [PATCH] qemu, util fix netlink callback registration for migration

2012-03-29 Thread D. Herrendoerfer
From: D. Herrendoerfer d.herrendoer...@herrendoerfer.name

This patch adds a netlink callback when migrating a VEPA enabled
virtual machine.
It fixes a Bug where a VM would not request a port association when
it was cleared by lldpad.
This patch requires the latest git version of lldpad to work. 

Signed-off-by: D. Herrendoerfer d.herrendoer...@herrendoerfer.name
---
 src/qemu/qemu_migration.c   |6 ++
 src/util/virnetdevmacvlan.c |   14 +-
 src/util/virnetdevmacvlan.h |8 
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 77d40c0..7a8a7c4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2654,6 +2654,12 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr 
def) {
def-uuid,

VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH, false)  0)
 goto err_exit;
+
+if (virNetDevMacVLanVPortProfileRegisterCallback(net-ifname, 
net-mac,
+ 
virDomainNetGetActualDirectDev(net), def-uuid,
+ 
virDomainNetGetActualVirtPortProfile(net),
+ 
VIR_NETDEV_VPORT_PROFILE_OP_CREATE))
+goto err_exit;
 }
 last_good_net = i;
 }
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 90888b0..b259e00 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -769,7 +769,7 @@ virNetDevMacVLanVPortProfileDestroyCallback(int watch 
ATTRIBUTE_UNUSED,
 virNetlinkCallbackDataFree((virNetlinkCallbackDataPtr)opaque);
 }
 
-static int
+int
 virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
  const unsigned char *macaddress,
  const char *linkdev,
@@ -1125,4 +1125,16 @@ int virNetDevMacVLanRestartWithVPortProfile(const char 
*cr_ifname ATTRIBUTE_UNUS
  _(Cannot create macvlan devices on this platform));
 return -1;
 }
+
+int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname 
ATTRIBUTE_UNUSED,
+ const unsigned char *macaddress 
ATTRIBUTE_UNUSED,
+ const char *linkdev 
ATTRIBUTE_UNUSED,
+ const unsigned char *vmuuid 
ATTRIBUTE_UNUSED,
+ virNetDevVPortProfilePtr 
virtPortProfile ATTRIBUTE_UNUSED,
+ enum virNetDevVPortProfileOp vmOp 
ATTRIBUTE_UNUSED)
+{
+virReportSystemError(ENOSYS, %s,
+ _(Cannot create macvlan devices on this platform));
+return -1;
+}
 #endif /* ! WITH_MACVTAP */
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 14640cf..2299f1d 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -84,4 +84,12 @@ int virNetDevMacVLanRestartWithVPortProfile(const char 
*cr_ifname,
 ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
 ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
 
+int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
+ const unsigned char *macaddress ,
+ const char *linkdev,
+ const unsigned char *vmuuid,
+ virNetDevVPortProfilePtr 
virtPortProfile,
+ enum virNetDevVPortProfileOp vmOp)
+ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
 #endif /* __UTIL_MACVTAP_H__ */
-- 
1.7.7.6

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


[libvirt] [PATCH test-API 0/2] add modules search path in main executable file

2012-03-29 Thread Guannan Ren

 repos/domain/attach_disk.py|   11 ---
 repos/domain/attach_interface.py   |   11 ---
 repos/domain/autostart.py  |   11 ---
 repos/domain/balloon_memory.py |   11 ---
 repos/domain/blkstats.py   |5 -
 repos/domain/cpu_affinity.py   |   11 ---
 repos/domain/cpu_topology.py   |   11 ---
 repos/domain/create.py |   11 ---
 repos/domain/define.py |   11 ---
 repos/domain/destroy.py|   11 ---
 repos/domain/detach_disk.py|   11 ---
 repos/domain/detach_interface.py   |   11 ---
 repos/domain/domain_blkinfo.py |   11 ---
 repos/domain/domain_id.py  |   11 ---
 repos/domain/domain_list.py|   13 -
 repos/domain/domain_name.py|   11 ---
 repos/domain/domain_uuid.py|   11 ---
 repos/domain/dump.py   |   11 ---
 repos/domain/eventhandler.py   |   11 ---
 repos/domain/hostname.py   |   11 ---
 repos/domain/ifstats.py|   11 ---
 repos/domain/install_image.py  |   12 
 repos/domain/install_linux_cdrom.py|   12 
 repos/domain/install_linux_check.py|   12 
 repos/domain/install_linux_net.py  |   12 
 repos/domain/install_windows_cdrom.py  |   12 
 repos/domain/migrate.py|   11 ---
 repos/domain/ownership_test.py |   15 +++
 repos/domain/reboot.py |   11 ---
 repos/domain/restore.py|   11 ---
 repos/domain/resume.py |   14 +-
 repos/domain/save.py   |   11 ---
 repos/domain/sched_params.py   |5 -
 repos/domain/shutdown.py   |   13 +
 repos/domain/start.py  |   13 +
 repos/domain/suspend.py|   14 +-
 repos/domain/undefine.py   |   11 ---
 repos/domain/update_devflag.py |   12 
 repos/interface/create.py  |   11 ---
 repos/interface/define.py  |   11 ---
 repos/interface/destroy.py |   11 ---
 repos/interface/iface_list.py  |   11 ---
 repos/interface/iface_mac.py   |   11 ---
 repos/interface/iface_name.py  |   11 ---
 repos/interface/undefine.py|   12 
 repos/libvirtd/qemu_hang.py|9 -
 repos/libvirtd/restart.py  |9 -
 repos/libvirtd/upstart.py  |9 -
 repos/network/autostart.py |   12 
 repos/network/create.py|   11 ---
 repos/network/define.py|   12 
 repos/network/destroy.py   |   11 ---
 repos/network/network_list.py  |   11 ---
 repos/network/network_name.py  |   11 ---
 repos/network/network_uuid.py  |   11 ---
 repos/network/start.py |   11 ---
 repos/network/undefine.py  |   11 ---
 repos/nodedevice/detach.py |   11 ---
 repos/nodedevice/reattach.py   |   12 
 repos/nodedevice/reset.py  |   11 ---
 repos/npiv/create_virtual_hba.py   |   12 
 .../multiple_thread_block_on_domain_create.py  |   12 
 repos/remoteAccess/tcp_setup.py|   11 ---
 repos/remoteAccess/tls_setup.py|   11 ---
 repos/remoteAccess/unix_perm_sasl.py   |   14 +-
 repos/sVirt/domain_nfs_start.py|   11 +--
 repos/snapshot/delete.py   |   11 ---
 repos/snapshot/file_flag.py|   11 ---
 repos/snapshot/flag_check.py   |   11 ---
 repos/snapshot/internal_create.py  |   11 ---
 

[libvirt] [PATCH test-API 1/2] Add root path of test-API into sys.path list

2012-03-29 Thread Guannan Ren
*libvirt-test-api.py before running testcases, we check whether
 the absolute root path of the testsuit is in sys.path. If not,
 add it.
---
 libvirt-test-api.py |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libvirt-test-api.py b/libvirt-test-api.py
index 8d7d811..f399672 100644
--- a/libvirt-test-api.py
+++ b/libvirt-test-api.py
@@ -50,6 +50,13 @@ def usage():
\n python libvirt-test-api.py -f TEST.XML \
 -r TESTRUNID TESTID ...
 
+def append_path():
+Append root path of package
+pwd = os.getcwd()
+if pwd in sys.path:
+pass
+else:
+sys.path.append(pwd)
 
 class LibvirtTestAPI(object):
  The class provides methods to run a new test and manage
@@ -331,6 +338,9 @@ if __name__ == __main__:
 libvirt_test_api.rerun(testrunid, testid_list)
 sys.exit(0)
 
+# Add root path of libvirt-test-API into sys.path
+append_path()
+
 libvirt_test_api = LibvirtTestAPI(casefile, logxml, loglevel, bugstxt)
 if libvirt_test_api.run():
 sys.exit(1)
-- 
1.7.7.5

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


[libvirt] Java API for libvirit

2012-03-29 Thread Yaniv Hadad

Hello,
Recently I found it useful to use your product for cross platform
Hyperviscous in target to investigate guests and hosts os\state\version..
details .
I am develop under Web-sphere environment.
For saying the truth I didn't find any Java API for this target
May you help me with this goal ??
What is your suggestion ?

Many Thanks

Yaniv.



   
  (Embedded image moved to file:
   
  pic63134.jpg) 
   

   

   

   

   

   

   

   

   
Yaniv Hadad ,   
   
(Embedded image moved to file: 
pic57918.jpg)+972 4 
8296594 (Embedded image moved to file:  
   
pic19510.jpg)+972 50-40-78-908  
   

   

   

   

   





attachment: pic63134.jpgattachment: pic57918.jpgattachment: pic19510.jpg--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH test-API 1/2] Add root path of test-API into sys.path list

2012-03-29 Thread Osier Yang

On 2012年03月29日 19:38, Guannan Ren wrote:

 *libvirt-test-api.py before running testcases, we check whether
  the absolute root path of the testsuit is in sys.path. If not,
  add it.


ACK with reorgnize the sentence like:

libvirt-test-api.py: Check whether the absolute path of testsuit is
in sys.path, add it if not.

As the original sentence sounds like we already do like that.


---
  libvirt-test-api.py |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libvirt-test-api.py b/libvirt-test-api.py
index 8d7d811..f399672 100644
--- a/libvirt-test-api.py
+++ b/libvirt-test-api.py
@@ -50,6 +50,13 @@ def usage():
 \n python libvirt-test-api.py -f TEST.XML \
  -r TESTRUNID TESTID ...

+def append_path():
+Append root path of package
+pwd = os.getcwd()
+if pwd in sys.path:
+pass
+else:
+sys.path.append(pwd)

  class LibvirtTestAPI(object):
   The class provides methods to run a new test and manage
@@ -331,6 +338,9 @@ if __name__ == __main__:
  libvirt_test_api.rerun(testrunid, testid_list)
  sys.exit(0)

+# Add root path of libvirt-test-API into sys.path
+append_path()
+
  libvirt_test_api = LibvirtTestAPI(casefile, logxml, loglevel, bugstxt)
  if libvirt_test_api.run():
  sys.exit(1)


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

[libvirt] [test-API] RFC: Stabilization of libvirt-test-API

2012-03-29 Thread Martin Kletzander
Hi everyone,

following our minutes, I'd like to start a discussion on what should be
done with libvirt-test-API so we can say it's stable and usable.

I would like to stress out that everything mentioned here is just an
opinion and I don't mean to talk down to someone as it may have seemed
earlier.

I think we should get some ideas from everyone, mostly QE as they will
be (are) the ones using this the most (if I understood correctly), and
then I'll be happy to help getting the code to the agreed status. I was
thinking about this from the wrong way probably and changing the angle
from what I look at it (and knowing there is some deadline) makes me
think of few levels of changes, which when introduced, could speed up
the test development and code understandability.

So here are the things I would like to do definitely (the optional
things follow later on):
 - fix hard-coded options into real options (e.g. commit 65449e)
 - fix some env_* and util* code (functions duplicated with different
behavior)
 - fix or remove harmful and pointless code (at this point, when
creating domain on remote machine, be prepared for the test to fail with
any other user then root and with root, have backup of both local and
remote '/root/.ssh' directories as the contents will be erased!)
 - fix method names for the {connect,domain,etc.}API (get_host_name vs.
lookupByUUID etc.)

The optional things:
 - get rid of classes in lib and make just few utility functions
covering *only* the methods that do something else than call the same
method in underlying class from the libvirt module.
 - get rid of the new exception (I don't see any other difference than
in the name, which can make a difference in except: clause, but it's
converted everywhere)
 - be able to share variables between tests (connection object and
anything else)
 - introduce new config file for tests (.ini format, can be parsed by
ConfigParser, same as env.cfg, define variables used throughout the test
specifications
 - update the documentation
 - use some python code style (PEP-8?), make use of True/False, None
 - eliminate duplicated (and x-plicated) code (append_path in all the
files, etc.)

I have all of these figured out, so I'm willing to discuss all of them,
but in most cases changing it in the current code seems very
time-consumable to me.

Please, feel free to comment on any of these, add yours, discuss, shout
at me, etc. =)

Regards,
Martin

P.S.: I don't see any point in sending my patches until some of these
points are resolved as that could mean rewriting more code.

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


Re: [libvirt] [PATCH test-API 1/2] Add root path of test-API into sys.path list

2012-03-29 Thread Guannan Ren

On 03/29/2012 07:59 PM, Osier Yang wrote:

On 2012年03月29日 19:38, Guannan Ren wrote:

 *libvirt-test-api.py before running testcases, we check whether
  the absolute root path of the testsuit is in sys.path. If not,
  add it.


ACK with reorgnize the sentence like:

libvirt-test-api.py: Check whether the absolute path of testsuit is
in sys.path, add it if not.

As the original sentence sounds like we already do like that.



Thanks, pushed with this fixed

 Guannan Ren

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

Re: [libvirt] [PATCH test-API 2/2] testcases: remove code of adding modules search path in testcases

2012-03-29 Thread Guannan Ren

On 03/29/2012 07:55 PM, Osier Yang wrote:

On 2012年03月29日 19:38, Guannan Ren wrote:

 *remove the invoking for append_path() in all of testcases
---
  repos/domain/attach_disk.py|   11 ---
  repos/domain/attach_interface.py   |   11 ---
  repos/domain/autostart.py  |   11 ---
  repos/domain/balloon_memory.py |   11 ---
  repos/domain/blkstats.py   |5 -
  repos/domain/cpu_affinity.py   |   11 ---
  repos/domain/cpu_topology.py   |   11 ---
  repos/domain/create.py |   11 ---
  repos/domain/define.py |   11 ---
  repos/domain/destroy.py|   11 ---
  repos/domain/detach_disk.py|   11 ---
  repos/domain/detach_interface.py   |   11 ---
  repos/domain/domain_blkinfo.py |   11 ---
  repos/domain/domain_id.py  |   11 ---
  repos/domain/domain_list.py|   13 
-

  repos/domain/domain_name.py|   11 ---
  repos/domain/domain_uuid.py|   11 ---
  repos/domain/dump.py   |   11 ---
  repos/domain/eventhandler.py   |   11 ---
  repos/domain/hostname.py   |   11 ---
  repos/domain/ifstats.py|   11 ---
  repos/domain/install_image.py  |   12 
  repos/domain/install_linux_cdrom.py|   12 
  repos/domain/install_linux_check.py|   12 
  repos/domain/install_linux_net.py  |   12 
  repos/domain/install_windows_cdrom.py  |   12 
  repos/domain/migrate.py|   11 ---
  repos/domain/ownership_test.py |   15 
+++

  repos/domain/reboot.py |   11 ---
  repos/domain/restore.py|   11 ---
  repos/domain/resume.py |   14 
+-

  repos/domain/save.py   |   11 ---
  repos/domain/sched_params.py   |5 -
  repos/domain/shutdown.py   |   13 
+
  repos/domain/start.py  |   13 
+
  repos/domain/suspend.py|   14 
+-

  repos/domain/undefine.py   |   11 ---
  repos/domain/update_devflag.py |   12 
  repos/interface/create.py  |   11 ---
  repos/interface/define.py  |   11 ---
  repos/interface/destroy.py |   11 ---
  repos/interface/iface_list.py  |   11 ---
  repos/interface/iface_mac.py   |   11 ---
  repos/interface/iface_name.py  |   11 ---
  repos/interface/undefine.py|   12 
  repos/libvirtd/qemu_hang.py|9 -
  repos/libvirtd/restart.py  |9 -
  repos/libvirtd/upstart.py  |9 -
  repos/network/autostart.py |   12 
  repos/network/create.py|   11 ---
  repos/network/define.py|   12 
  repos/network/destroy.py   |   11 ---
  repos/network/network_list.py  |   11 ---
  repos/network/network_name.py  |   11 ---
  repos/network/network_uuid.py  |   11 ---
  repos/network/start.py |   11 ---
  repos/network/undefine.py  |   11 ---
  repos/nodedevice/detach.py |   11 ---
  repos/nodedevice/reattach.py   |   12 
  repos/nodedevice/reset.py  |   11 ---
  repos/npiv/create_virtual_hba.py   |   12 
  .../multiple_thread_block_on_domain_create.py  |   12 
  repos/remoteAccess/tcp_setup.py|   11 ---
  repos/remoteAccess/tls_setup.py|   11 ---
  repos/remoteAccess/unix_perm_sasl.py   |   14 
+-

  repos/sVirt/domain_nfs_start.py|   11 +--
  repos/snapshot/delete.py   |   11 

Re: [libvirt] [test-API PATCH] log_output: Fix whitespace in log output XSL

2012-03-29 Thread Guannan Ren

On 03/29/2012 08:26 PM, Martin Kletzander wrote:

On 03/29/2012 02:04 PM, Peter Krempa wrote:

The XSL file that converts the log xml into a html file contains some
strange whitespace characters that output in the HTML as squares.

This patch fixes the whitespace and reformats the indetation to two
spaces as used in libvirt XML files.

*log.css: -make test name field wider
*log.xsl: -fix whitespace and indentation
   -remove '@' from test headers
---
  log.css |2 +-
  log.xsl |  341 +++
  2 files changed, 170 insertions(+), 173 deletions(-)


ACK, looks way better this way.

Martin

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


 Thanks and pushed.

 Guannan Ren

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


Re: [libvirt] [PATCH 2/4] Fix format specifiers in test cases on Win32

2012-03-29 Thread Eric Blake
On 03/29/2012 03:53 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 Some of the test suites use fprintf with format specifiers
 that are not supported on Win32 and are not fixed by gnulib.
 
 The mingw32 compiler also has trouble detecting ssize_t
 correctly, complaining that 'ssize_t' does not match
 'signed size_t' (which it expects for %zd). Force the
 cast to size_t to avoid this problem

Nothing wrong with your libvirt patch, but I can't help wonder if this
is a bug in the gnulib replacement headers, where mingw lacks ssize_t
but gnulib defines it to the wrong type in comparison to size_t (that
is, since mingw64 has sizeof(size_t)==4, it is not obvious whether
size_t is 'unsigned long' or 'unsigned int', and if gnulib picked 'int'
for ssize_t but size_t is 'unsigned long', that would explain the
compiler warnings.  Gnulib may need to be tweaked to help work around
this mingw situation.

-- 
Eric Blake   ebl...@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] Java API for libvirit

2012-03-29 Thread Eric Blake
On 03/29/2012 05:49 AM, Yaniv Hadad wrote:
 
 Hello,
 Recently I found it useful to use your product for cross platform
 Hyperviscous in target to investigate guests and hosts os\state\version..
 details .
 I am develop under Web-sphere environment.
 For saying the truth I didn't find any Java API for this target

The libvirt-java bindings can be found here.  Patches are welcome; these
bindings have not had active maintenance in a while.

http://libvirt.org/java.html

   
  
   (Embedded image moved to file:  
  
   pic63134.jpg)   
  

HTML mail is frowned upon on this list.

-- 
Eric Blake   ebl...@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/4] Fix format specifiers in test cases on Win32

2012-03-29 Thread Daniel P. Berrange
On Thu, Mar 29, 2012 at 06:45:03AM -0600, Eric Blake wrote:
 On 03/29/2012 03:53 AM, Daniel P. Berrange wrote:
  From: Daniel P. Berrange berra...@redhat.com
  
  Some of the test suites use fprintf with format specifiers
  that are not supported on Win32 and are not fixed by gnulib.
  
  The mingw32 compiler also has trouble detecting ssize_t
  correctly, complaining that 'ssize_t' does not match
  'signed size_t' (which it expects for %zd). Force the
  cast to size_t to avoid this problem
 
 Nothing wrong with your libvirt patch, but I can't help wonder if this
 is a bug in the gnulib replacement headers, where mingw lacks ssize_t
 but gnulib defines it to the wrong type in comparison to size_t (that
 is, since mingw64 has sizeof(size_t)==4, it is not obvious whether
 size_t is 'unsigned long' or 'unsigned int', and if gnulib picked 'int'
 for ssize_t but size_t is 'unsigned long', that would explain the
 compiler warnings.  Gnulib may need to be tweaked to help work around
 this mingw situation.

Ah, if it turns out to be a gnulib bug, then that'd be
preferrable to fix.


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] [test-API] RFC: Stabilization of libvirt-test-API

2012-03-29 Thread Peter Krempa

On 03/29/2012 02:14 PM, Martin Kletzander wrote:

Hi everyone,

following our minutes, I'd like to start a discussion on what should be
done with libvirt-test-API so we can say it's stable and usable.

I would like to stress out that everything mentioned here is just an
opinion and I don't mean to talk down to someone as it may have seemed
earlier.

I think we should get some ideas from everyone, mostly QE as they will
be (are) the ones using this the most (if I understood correctly), and
then I'll be happy to help getting the code to the agreed status. I was
thinking about this from the wrong way probably and changing the angle
from what I look at it (and knowing there is some deadline) makes me
think of few levels of changes, which when introduced, could speed up
the test development and code understandability.

So here are the things I would like to do definitely (the optional
things follow later on):
  - fix hard-coded options into real options (e.g. commit 65449e)



  - fix some env_* and util* code (functions duplicated with different
behavior)
  - fix or remove harmful and pointless code (at this point, when
creating domain on remote machine, be prepared for the test to fail with
any other user then root and with root, have backup of both local and
remote '/root/.ssh' directories as the contents will be erased!)
  - fix method names for the {connect,domain,etc.}API (get_host_name vs.
lookupByUUID etc.)

The optional things:
  - get rid of classes in lib and make just few utility functions
covering *only* the methods that do something else than call the same
method in underlying class from the libvirt module.
Apart from actualy enabling all functionality provided by the libvirt 
python api this would actually increase the object orientation of the 
code. The current api breaks the idea of objects in some places: eg. 
looks up a guest by name, uses the domain object to call one API and 
discards it instead of re-using it for further calls that have to look 
the domain up again.



  - get rid of the new exception (I don't see any other difference than
in the name, which can make a difference in except: clause, but it's
converted everywhere)
Other useful thing would be to improve exception handling to free the 
test writer from handling exception that actualy signal that an error 
has occured and free him from having to catch the exception and print 
the error message in a nice way (not to have to read a backtrace ).
(On the other hand, handling exceptions will be needed if an error 
actually should happen as a result of the test)



  - be able to share variables between tests (connection object and
anything else)
This would enable to write really simple test cases that would not 
require to create a separate hypervisor connection and to the complete 
test separately, but you could combine these simple test cases into complex



  - introduce new config file for tests (.ini format, can be parsed by
ConfigParser, same as env.cfg, define variables used throughout the test
specifications



  - update the documentation
This might speed up new deployments of the test suite as some filenames 
and other details have changed so the users have to figure them out by 
themselves.



  - use some python code style (PEP-8?), make use of True/False, None
  - eliminate duplicated (and x-plicated) code (append_path in all the
files, etc.)

Agreed.



I have all of these figured out, so I'm willing to discuss all of them,
but in most cases changing it in the current code seems very
time-consumable to me.
Writing a test now requires some redundant work to be done. A common 
test case (written in python) requires that the writer creates a 
hypervisor connection, gets the domain object and then does all the 
testing. This could be minimized, when these common tasks would have 
utility tests (eg a test that just connects to the hypervisor and 
returns the object) and then you'd just combine them in the test case file.


Please, feel free to comment on any of these, add yours, discuss, shout
at me, etc. =)

Regards,
Martin



Peter

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


[libvirt] [PATCH] libvirt: Fix build err

2012-03-29 Thread ailvpeng25
From: Zhou Peng ailvpen...@gmail.com

virNetDevMacVLanRestartWithVPortProfile is omitted in src/libvirt_private.syms,
which causes link err.
---
 src/libvirt_private.syms |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c50940b..97fec2f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1288,6 +1288,7 @@ virNetDevMacVLanCreate;
 virNetDevMacVLanDelete;
 virNetDevMacVLanCreateWithVPortProfile;
 virNetDevMacVLanDeleteWithVPortProfile;
+virNetDevMacVLanRestartWithVPortProfile;
 
 
 # virnetdevopenvswitch.h
-- 
1.7.7.6

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


[libvirt] Syntax check rules broken if 'exclude' is not defined

2012-03-29 Thread Daniel P. Berrange
I noticed that many (most) of the libvirt syntax-check rules were not
generating any results, despite me introducing obvious violations.

From my debugging the problem appears to be caused by this commit:

  commit 727075d03c670affa68f71313979781f5ba9bbfc
  Author: Eric Blake ebl...@redhat.com
  Date:   Thu Mar 1 14:51:31 2012 -0700

maint.mk: add per-line exclusions to prohibitions


If I revert the following hunk from maint.mk


@@ -258,6 +268,7 @@ define _sc_search_regexp
if test -n $$files; then  \
  if test -n $$prohibit; then \
grep $$with_grep_options $(_ignore_case) -nE $$prohibit $$files \
+ | grep -vE $${exclude-^$$}  \
   { msg=$$halt $(_sc_say_and_exit) } || :; \
  else  \
grep $$with_grep_options $(_ignore_case) -LE $$require $$files \


then the syntax-check rules work again. It seems that this grep is
broken, if a test leaves  $exclude undefined, causing it to filter
out all results.

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] [test-API] RFC: Stabilization of libvirt-test-API

2012-03-29 Thread Osier Yang

On 2012年03月29日 20:14, Martin Kletzander wrote:

Hi everyone,

following our minutes, I'd like to start a discussion on what should be
done with libvirt-test-API so we can say it's stable and usable.

I would like to stress out that everything mentioned here is just an
opinion and I don't mean to talk down to someone as it may have seemed
earlier.

I think we should get some ideas from everyone, mostly QE as they will
be (are) the ones using this the most (if I understood correctly), and
then I'll be happy to help getting the code to the agreed status. I was
thinking about this from the wrong way probably and changing the angle
from what I look at it (and knowing there is some deadline) makes me
think of few levels of changes, which when introduced, could speed up
the test development and code understandability.

So here are the things I would like to do definitely (the optional
things follow later on):
  - fix hard-coded options into real options (e.g. commit 65449e)


Absolutely we should either change/destroy it or generalize it
as global config.


  - fix some env_* and util* code (functions duplicated with different
behavior)


This should be caused by mutilple persons worked on that, but lacked
reviewing.


  - fix or remove harmful and pointless code (at this point, when
creating domain on remote machine, be prepared for the test to fail with
any other user then root and with root, have backup of both local and
remote '/root/.ssh' directories as the contents will be erased!)


So this means test-API only supports qemu:///system testing now,
needs to be improved for qemu:///session too.

Also I'd guess there are cases which only considers the QEMU/KVM
driver testing. If so, we need to either generalize it or seperate
it (in case of it are too specific to generalize), perhaps seperate
directories for different drivers. But this should be the future
plan, what we should do currently is try to generalize the tests
as much as we could.


  - fix method names for the {connect,domain,etc.}API (get_host_name vs.
lookupByUUID etc.)


Yes, we need the consistent function/variable name, also consistent
coding (including the comments on top of scripts) style.



The optional things:
  - get rid of classes in lib and make just few utility functions
covering *only* the methods that do something else than call the same
method in underlying class from the libvirt module.


Agreed, it looks to me many of the lib functions just simple pass
parameter to the underlying libvirt-python API, that's just meaningless/
useless.


  - get rid of the new exception (I don't see any other difference than
in the name, which can make a difference in except: clause, but it's
converted everywhere)


Agreed. Just like the classes method in lib, it's feet of snake, ;)



  - be able to share variables between tests (connection object and
anything else)


Not sure what's your exact meaning, could you explain more?


  - introduce new config file for tests (.ini format, can be parsed by
ConfigParser, same as env.cfg, define variables used throughout the test
specifications


Do you mean destroy current config parsing codes? if so, we need
to rewrite (or much modification) codes of generator too. Any
critical disadvantage you see in the current parsing/generator
codes? I'd think the pricinple of current parsing (no generator)
is right, though it might have bugs or disadvantages, we can
improve/extend it.


  - update the documentation


Current documentation is in publican format, honestly I'm not fan of
it, it might be good if used for an enterprise product, but for a
community project, I never see what uses it. So I will vote if you
mean destroy it and write just simple text docs.


  - use some python code style (PEP-8?), make use of True/False, None


pylint should be able to take care of it.


  - eliminate duplicated (and x-plicated) code (append_path in all the
files, etc.)


Guannan already starts to do it, :-)


I didn't go through the codes carefully yet, so no much thoughts
yet, but what I could think of currently is:

   * Take use of JEOS, I'd guess for most of the testing, we won't
do much complicate works inside the guest, so JEOS will be enough.

   * Add default configuration for generalize testing functions,
such as for domain installation, we'd want to use it many places,
and only need to specify specific configuration when testing the
domain installation itself, for the tests which just wants to
create a domain, we will just want a usable domain, I.e. lazy
guys won't want to specify the parameters again and again.

Will comment if I have further thought when went through the
codes.

Regards,
Osier

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

Re: [libvirt] [test-API] RFC: Stabilization of libvirt-test-API

2012-03-29 Thread Guannan Ren

On 03/29/2012 08:14 PM, Martin Kletzander wrote:


  - fix hard-coded options into real options (e.g. commit 65449e)
  - fix some env_* and util* code (functions duplicated with different
behavior)
  - fix or remove harmful and pointless code (at this point, when
creating domain on remote machine, be prepared for the test to fail with
any other user then root and with root, have backup of both local and
remote '/root/.ssh' directories as the contents will be erased!)
  - fix method names for the {connect,domain,etc.}API (get_host_name vs.
lookupByUUID etc.)

The optional things:
  - get rid of classes in lib and make just few utility functions
covering *only* the methods that do something else than call the same
method in underlying class from the libvirt module.
  - get rid of the new exception (I don't see any other difference than
in the name, which can make a difference in except: clause, but it's
converted everywhere)


the above should be easy to fix to cleanup.
I can do it.


  - be able to share variables between tests (connection object and
anything else)


 This belongs to new feature, we better consider it later.


  - introduce new config file for tests (.ini format, can be parsed by
ConfigParser, same as env.cfg, define variables used throughout the test
specifications


   Please list out some critical cause, why?


  - update the documentation


  I can do it.


  - use some python code style (PEP-8?), make use of True/False, None


 we used pylint to review it, It is fine.(maybe could be better)


  - eliminate duplicated (and x-plicated) code (append_path in all the
files, etc.)


  easy to do.

  Guannan Ren

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


Re: [libvirt] Java API for libvirit

2012-03-29 Thread Eric Blake
[please keep the list in the loop, avoid html mail, and avoid top-posting]

On 03/29/2012 08:04 AM, Yaniv Hadad wrote:
 Hi Eric.
 Did you use it already ??

No, I have not personally used the Java bindings.  Which is why keeping
the list in the loop is a wise idea; you're more likely to reach someone
that has.

 What do you mean have not had active maintenance in a while ?

The last commit to libvirt-java.git was in Feb 2011, so it's lagging
libvirt.git by a few releases.

 Which scope of information may I get ?

Ultimately, if someone were to contribute patches to bring the bindings
up-to-date, then you could use Java to access everything that libvirt
provides to other language bindings, such as C, python, and perl.

-- 
Eric Blake   ebl...@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] libvirt: Fix build err

2012-03-29 Thread Michal Privoznik
On 29.03.2012 14:55, ailvpen...@gmail.com wrote:
 From: Zhou Peng ailvpen...@gmail.com
 
 virNetDevMacVLanRestartWithVPortProfile is omitted in 
 src/libvirt_private.syms,
 which causes link err.
 ---
  src/libvirt_private.syms |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
 index c50940b..97fec2f 100644
 --- a/src/libvirt_private.syms
 +++ b/src/libvirt_private.syms
 @@ -1288,6 +1288,7 @@ virNetDevMacVLanCreate;
  virNetDevMacVLanDelete;
  virNetDevMacVLanCreateWithVPortProfile;
  virNetDevMacVLanDeleteWithVPortProfile;
 +virNetDevMacVLanRestartWithVPortProfile;
  
  
  # virnetdevopenvswitch.h

I've tweaked the commit message a bit and pushed. Thanks!

Michal

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


Re: [libvirt] [PATCH] Consistent style for usage of sizeof operator

2012-03-29 Thread Eric Blake
On 03/29/2012 09:51 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 The code is splattered with a mix of
 
   sizeof foo
   sizeof (foo)
   sizeof(foo)
 
 Standardize on sizeof(foo) and add a syntax check rule to
 enforce it

We might also want to document our policy on 'return 0' and 'sizeof(v)'
in HACKING.

 ---
  cfg.mk   |4 +

 +++ b/cfg.mk
 @@ -813,3 +813,7 @@ exclude_file_name_regexp--sc_trailing_blank = 
 \.(fig|gif|ico|png)$$
  
  exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
 +
 +exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
 +
 +exclude_file_name_regexp--sc_const_long_option = tools/virt-host-validate.c
 diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c

Where's the new rule that actually adds the syntax check?

The rest of the patch looks mechanical, but we have to get the cfg.mk
part right.  I'm also still looking into the report of why cfg.mk
doesn't seem to be working in relation to the latest per-line exceptions
added to gnulib's syntax-check framework.

-- 
Eric Blake   ebl...@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] Consistent style for usage of sizeof operator

2012-03-29 Thread Daniel P. Berrange
On Thu, Mar 29, 2012 at 10:02:00AM -0600, Eric Blake wrote:
 On 03/29/2012 09:51 AM, Daniel P. Berrange wrote:
  From: Daniel P. Berrange berra...@redhat.com
  
  The code is splattered with a mix of
  
sizeof foo
sizeof (foo)
sizeof(foo)
  
  Standardize on sizeof(foo) and add a syntax check rule to
  enforce it
 
 We might also want to document our policy on 'return 0' and 'sizeof(v)'
 in HACKING.
 
  ---
   cfg.mk   |4 +
 
  +++ b/cfg.mk
  @@ -813,3 +813,7 @@ exclude_file_name_regexp--sc_trailing_blank = 
  \.(fig|gif|ico|png)$$
   
   exclude_file_name_regexp--sc_unmarked_diagnostics = \
 ^(docs/apibuild.py|tests/virt-aa-helper-test)$$
  +
  +exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
  +
  +exclude_file_name_regexp--sc_const_long_option = tools/virt-host-validate.c
  diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
 
 Where's the new rule that actually adds the syntax check?

In my source tree but not committed ! Opps.

The change was:

diff --git a/cfg.mk b/cfg.mk
index c3de533..ade8690 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -422,6 +422,12 @@ sc_correct_id_types:
halt=use pid_t for pid, uid_t for uid, gid_t for gid  \
  $(_sc_search_regexp)
 
+# Forbid sizeof foo or sizeof (foo), require sizeof(foo)
+sc_size_of_brackets:
+   @prohibit='sizeof\s'\
+   halt='use sizeof(foo), not sizeof (foo) or sizeof foo'  \
+ $(_sc_search_regexp)
+
 # Ensure that no C source file, docs, or rng schema uses TABs for
 # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
 # files in gnulib, since they're imported.
@@ -807,3 +813,5 @@ exclude_file_name_regexp--sc_trailing_blank = 
\.(fig|gif|ico|png)$$
 
 exclude_file_name_regexp--sc_unmarked_diagnostics = \
   ^(docs/apibuild.py|tests/virt-aa-helper-test)$$
+
+exclude_file_name_regexp--sc_size_of_brackets = cfg.mk


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] [PATCHv2] qemu: support live change of the bridge used by a guest network device

2012-03-29 Thread Laine Stump
From: Hendrik Schwartke hend...@os-t.de

Previously the only attribute of a network device that could be
modified by virUpdateDeviceFlags() (virsh update-device) was the
link state; attempts to change any other attribute would log an error
and fail. (One notable exception to this was changing the bridge used
by an interface of type='bridge' - that wasn't flagged as an error,
but still did nothing.)

This patch adds recognition of a change in bridge device name, and
supports reconnecting the guest's interface to the new device.
---

This had too many modifications from the original patch for me to push
without sending in for a 3rd party review. Here are the changes from
Hendrik's original patch:

Things I noted in my original review:

1) remove unnecessary util/ from #includes

2) change qemuDomainChangeNetBridge from global to static, since it's
   only used in the one file.

3) Don't free olddev-data.bridge.brname after failure to add the tap
   to the new bridge, since the caller will free all of olddev anyway.

Things I didn't notice until after I reviewed and ACKed (but
fortunately before I pushed):

4) When adding the tap to the new bridge, use olddev-ifname instead
   of newdev-ifname - the one in newdef is evilly cleared out by the
   parser, and ifname isn't allowed to change anyway, so using
   olddev-ifname is proper.

5) Add a case for VIR_DOMAIN_NET_TYPE_BRIDGE to the switch that checks
   for changes to disallowed items for each type of interface. Even
   before adding the new functionality, absence of this case had meant
   that attempts to change link state of a type='bridge' interface
   would have failed (so I was right that this patch fixes an existing
   bug, but was wrong about exactly what the bug was.)

I have run make check and done functional checking on this code - it
does properly change the bridge of an existing guest interface without
needing to detach it.

 src/qemu/qemu_hotplug.c |   54 +++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 38163ba..66837c4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -40,6 +40,8 @@
 #include qemu_cgroup.h
 #include locking/domain_lock.h
 #include network/bridge_driver.h
+#include virnetdev.h
+#include virnetdevbridge.h
 #include virnetdevtap.h
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1191,6 +1193,40 @@ static virDomainNetDefPtr 
qemuDomainFindNet(virDomainObjPtr vm,
 return NULL;
 }
 
+static
+int qemuDomainChangeNetBridge(virDomainNetDefPtr olddev,
+  virDomainNetDefPtr newdev)
+{
+const char *oldbridge = olddev-data.bridge.brname;
+const char *newbridge = newdev-data.bridge.brname;
+
+VIR_DEBUG(Change bridge for interface %s: %s - %s,
+  olddev-ifname, oldbridge, newbridge);
+
+if (virNetDevExists(newbridge) != 1) {
+qemuReportError(VIR_ERR_OPERATION_FAILED,
+_(bridge %s doesn't exist), newbridge);
+return -1;
+}
+
+if (oldbridge 
+virNetDevBridgeRemovePort(oldbridge, olddev-ifname)  0) {
+return -1;
+}
+if (virNetDevBridgeAddPort(newbridge, olddev-ifname)  0) {
+if (virNetDevBridgeAddPort(oldbridge, olddev-ifname)  0) {
+qemuReportError(VIR_ERR_OPERATION_FAILED,
+_(unable to recover former state by adding port
+  to bridge %s), oldbridge);
+}
+return -1;
+}
+VIR_FREE(olddev-data.bridge.brname);
+olddev-data.bridge.brname = newdev-data.bridge.brname;
+newdev-data.bridge.brname = NULL;
+return 0;
+}
+
 int qemuDomainChangeNetLinkState(struct qemud_driver *driver,
  virDomainObjPtr vm,
  virDomainNetDefPtr dev,
@@ -1279,6 +1315,16 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
 
 break;
 
+case VIR_DOMAIN_NET_TYPE_BRIDGE:
+   /* allow changing brname, but not portprofile */
+   if (!virNetDevVPortProfileEqual(olddev-data.bridge.virtPortProfile,
+   dev-data.bridge.virtPortProfile)) {
+   qemuReportError(VIR_ERR_NO_SUPPORT,
+   _(cannot modify bridge network device 
configuration));
+   return -1;
+   }
+   break;
+
 case VIR_DOMAIN_NET_TYPE_INTERNAL:
 if (STRNEQ_NULLABLE(olddev-data.internal.name, 
dev-data.internal.name)) {
 qemuReportError(VIR_ERR_NO_SUPPORT,
@@ -1321,6 +1367,14 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
 return -1;
 }
 
+if (olddev-type == VIR_DOMAIN_NET_TYPE_BRIDGE
+ dev-type == VIR_DOMAIN_NET_TYPE_BRIDGE
+ STRNEQ_NULLABLE(olddev-data.bridge.brname,
+   dev-data.bridge.brname)) {
+if ((ret = qemuDomainChangeNetBridge(olddev, dev))  0)
+return ret;
+}
+
   

Re: [libvirt] serial console/events example script

2012-03-29 Thread Dave Allan
On Wed, Feb 15, 2012 at 09:11:32PM -0500, Dave Allan wrote:
 Hi all,
 
 A while back I wrote the attached code to demonstrate how to use
 events and serial console to create a serial console that stays up
 even when the VM is down.  Is it worth adding to the examples?  It
 might need some work, as I am not terribly strong with Python.
 
 Dave

I was just going through some old mail and realized that I don't think
this ever got a response.  Anybody have any thoughts on it?

Dave

 #!/usr/bin/python -u
 import sys, os, logging, libvirt, tty, termios, atexit
 
 def reset_term():
 termios.tcsetattr(0, termios.TCSADRAIN, attrs)
 
 def error_handler(unused, error):
 # The console stream errors on VM shutdown; we don't care
 if (error[0] == libvirt.VIR_ERR_RPC and
 error[1] == libvirt.VIR_FROM_STREAMS):
 return
 logging.warn(error)
 
 class Console(object):
 def __init__(self, uri, uuid):
 self.uri = uri
 self.uuid = uuid
 self.connection = libvirt.open(uri)
 self.domain = self.connection.lookupByUUIDString(uuid)
 self.state = self.domain.state(0)
 self.connection.domainEventRegister(lifecycle_callback, self)
 self.stream = None
 self.run_console = True
 logging.info(%s initial state %d, reason %d,
  self.uuid, self.state[0], self.state[1])
 
 def check_console(console):
 if (console.state[0] == libvirt.VIR_DOMAIN_RUNNING or
 console.state[0] == libvirt.VIR_DOMAIN_PAUSED):
 if console.stream == None:
 console.stream = 
 console.connection.newStream(libvirt.VIR_STREAM_NONBLOCK)
 console.domain.openConsole(None, console.stream, 0)
 
 console.stream.eventAddCallback(libvirt.VIR_STREAM_EVENT_READABLE, 
 stream_callback, console)
 else:
 if console.stream:
 console.stream.eventRemoveCallback()
 console.stream = None
 
 return console.run_console
 
 def stdin_callback(watch, fd, events, console):
 readbuf = os.read(fd, 1024)
 if readbuf.startswith():
 console.run_console = False
 return
 if console.stream:
 console.stream.send(readbuf)
 
 def stream_callback(stream, events, console):
 try:
 received_data = console.stream.recv(1024)
 except:
 return
 os.write(0, received_data)
 
 def lifecycle_callback (connection, domain, event, detail, console):
 console.state = console.domain.state(0)
 logging.info(%s transitioned to state %d, reason %d,
  console.uuid, console.state[0], console.state[1])
 
 # main
 if len(sys.argv) != 3:
 print Usage:, sys.argv[0], URI UUID
 print for example:, sys.argv[0], 'qemu:///system' 
 '32ad945f-7e78-c33a-e96d-39f25e025d81'
 sys.exit(1)
 
 uri = sys.argv[1]
 uuid = sys.argv[2]
 
 print Escape character is ^]
 logging.basicConfig(filename='msg.log', level=logging.DEBUG)
 logging.info(URI: %s, uri)
 logging.info(UUID: %s, uuid)
 
 libvirt.virEventRegisterDefaultImpl()
 libvirt.registerErrorHandler(error_handler, None)
 
 atexit.register(reset_term)
 attrs = termios.tcgetattr(0)
 tty.setraw(0)
 
 console = Console(uri, uuid)
 console.stdin_watch = libvirt.virEventAddHandle(0, 
 libvirt.VIR_EVENT_HANDLE_READABLE, stdin_callback, console)
 
 while check_console(console):
 libvirt.virEventRunDefaultImpl()


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


Re: [libvirt] [PATCH] Set default name for SPICE agent channel

2012-03-29 Thread Laine Stump
On 03/29/2012 05:52 AM, Christophe Fergeau wrote:
 On Wed, Mar 28, 2012 at 03:20:45PM -0400, Laine Stump wrote:
 I know I'm a bit late to the party (I missed your mail before), but
 would it have been possible to do the default processing in the caller
 rather than in the parsing function itself?
 I cannot disagree since I was not sure at all that this was the right place
 for setting defaults, I should have mentioned this explicitly when sending
 the patch.. Who is the caller exactly in this case?



I'm not previously familiar with this attribute, but it looks like the
only place it's used is in qemuBuildVirtioSerialPortDevStr, where it
does the following:

1) if it's set, and doesn't == com.redhat.spice.0 it logs an error and
fails

2) if it's set, the option ,name=com.redhat.spice.0 is added to the
device string.

So it looks like you could get the same effect by changing that last bit
to either add the contents of dev-target.name, or if that's NULL,
com.redhat.spice.0.

In this particular case I don't know if it's going to make any
difference in practice; I'm just always wary of parser code that
modifies the output such that it doesn't mirror the input. (One way of
thinking about it is that if you were to set everything in an object,
then do a Format/Parse roundtrip, the results would be different. That's
going to end up being the case anyway because there's already so much
existing parse code that commits this sin (my opinion), but I think it's
good to reduce the amount of this type behavior as much as possible.

Does anyone with more experience with the libvirt spice code have any
opinion on whether it makes any difference if we add in the default in
the parsing function or just when we build the commandline? danpb?

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


Re: [libvirt] [PATCHv2] qemu: support live change of the bridge used by a guest network device

2012-03-29 Thread Daniel P. Berrange
On Thu, Mar 29, 2012 at 04:38:50PM -0400, Laine Stump wrote:
 From: Hendrik Schwartke hend...@os-t.de
 
 Previously the only attribute of a network device that could be
 modified by virUpdateDeviceFlags() (virsh update-device) was the
 link state; attempts to change any other attribute would log an error
 and fail. (One notable exception to this was changing the bridge used
 by an interface of type='bridge' - that wasn't flagged as an error,
 but still did nothing.)
 
 This patch adds recognition of a change in bridge device name, and
 supports reconnecting the guest's interface to the new device.
 ---
 
 This had too many modifications from the original patch for me to push
 without sending in for a 3rd party review. Here are the changes from
 Hendrik's original patch:
 
 Things I noted in my original review:
 
 1) remove unnecessary util/ from #includes
 
 2) change qemuDomainChangeNetBridge from global to static, since it's
only used in the one file.
 
 3) Don't free olddev-data.bridge.brname after failure to add the tap
to the new bridge, since the caller will free all of olddev anyway.
 
 Things I didn't notice until after I reviewed and ACKed (but
 fortunately before I pushed):
 
 4) When adding the tap to the new bridge, use olddev-ifname instead
of newdev-ifname - the one in newdef is evilly cleared out by the
parser, and ifname isn't allowed to change anyway, so using
olddev-ifname is proper.
 
 5) Add a case for VIR_DOMAIN_NET_TYPE_BRIDGE to the switch that checks
for changes to disallowed items for each type of interface. Even
before adding the new functionality, absence of this case had meant
that attempts to change link state of a type='bridge' interface
would have failed (so I was right that this patch fixes an existing
bug, but was wrong about exactly what the bug was.)
 
 I have run make check and done functional checking on this code - it
 does properly change the bridge of an existing guest interface without
 needing to detach it.
 
  src/qemu/qemu_hotplug.c |   54 
 +++
  1 files changed, 54 insertions(+), 0 deletions(-)
 
 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
 index 38163ba..66837c4 100644
 --- a/src/qemu/qemu_hotplug.c
 +++ b/src/qemu/qemu_hotplug.c
 @@ -40,6 +40,8 @@
  #include qemu_cgroup.h
  #include locking/domain_lock.h
  #include network/bridge_driver.h
 +#include virnetdev.h
 +#include virnetdevbridge.h
  #include virnetdevtap.h
  
  #define VIR_FROM_THIS VIR_FROM_QEMU
 @@ -1191,6 +1193,40 @@ static virDomainNetDefPtr 
 qemuDomainFindNet(virDomainObjPtr vm,
  return NULL;
  }
  
 +static
 +int qemuDomainChangeNetBridge(virDomainNetDefPtr olddev,
 +  virDomainNetDefPtr newdev)
 +{
 +const char *oldbridge = olddev-data.bridge.brname;
 +const char *newbridge = newdev-data.bridge.brname;
 +
 +VIR_DEBUG(Change bridge for interface %s: %s - %s,
 +  olddev-ifname, oldbridge, newbridge);
 +
 +if (virNetDevExists(newbridge) != 1) {
 +qemuReportError(VIR_ERR_OPERATION_FAILED,
 +_(bridge %s doesn't exist), newbridge);
 +return -1;
 +}
 +
 +if (oldbridge 
 +virNetDevBridgeRemovePort(oldbridge, olddev-ifname)  0) {
 +return -1;
 +}
 +if (virNetDevBridgeAddPort(newbridge, olddev-ifname)  0) {
 +if (virNetDevBridgeAddPort(oldbridge, olddev-ifname)  0) {
 +qemuReportError(VIR_ERR_OPERATION_FAILED,
 +_(unable to recover former state by adding port
 +  to bridge %s), oldbridge);
 +}
 +return -1;
 +}

I think you need to emit 2 audit notifications here, one for the bridge
being removed and one for the bridge being added.

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] serial console/events example script

2012-03-29 Thread Daniel P. Berrange
On Thu, Mar 29, 2012 at 04:55:39PM -0400, Dave Allan wrote:
 On Wed, Feb 15, 2012 at 09:11:32PM -0500, Dave Allan wrote:
  Hi all,
  
  A while back I wrote the attached code to demonstrate how to use
  events and serial console to create a serial console that stays up
  even when the VM is down.  Is it worth adding to the examples?  It
  might need some work, as I am not terribly strong with Python.
  
  Dave
 
 I was just going through some old mail and realized that I don't think
 this ever got a response.  Anybody have any thoughts on it?

Add it to the examples/ directory in GIT I say.

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] Syntax check rules broken if 'exclude' is not defined

2012-03-29 Thread Eric Blake
On 03/29/2012 07:17 AM, Daniel P. Berrange wrote:
 I noticed that many (most) of the libvirt syntax-check rules were not
 generating any results, despite me introducing obvious violations.
 
From my debugging the problem appears to be caused by this commit:
 
   commit 727075d03c670affa68f71313979781f5ba9bbfc
   Author: Eric Blake ebl...@redhat.com
   Date:   Thu Mar 1 14:51:31 2012 -0700
 
 maint.mk: add per-line exclusions to prohibitions
 
 
 If I revert the following hunk from maint.mk
 
 
 @@ -258,6 +268,7 @@ define _sc_search_regexp
 if test -n $$files; then  \
   if test -n $$prohibit; then \
 grep $$with_grep_options $(_ignore_case) -nE $$prohibit $$files \
 + | grep -vE $${exclude-^$$}  \
{ msg=$$halt $(_sc_say_and_exit) } || :; \
   else  \
 grep $$with_grep_options $(_ignore_case) -LE $$require $$files \
 
 
 then the syntax-check rules work again. It seems that this grep is
 broken, if a test leaves  $exclude undefined, causing it to filter
 out all results.

I think I figured out why, but I'm still working out how to fix it.

cfg.mk is included _before_ maint.mk.  Therefore, $_sc_search_regexp) is
expanded in cfg.mk prior to the place where maint.mk provides a default
definition for $(exclude), so we are getting the wrong thing expanded,
which breaks the syntax check rule in cfg.mk.

I'll get something working, hopefully later today.

-- 
Eric Blake   ebl...@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] build: avoid 'devname' for BSD

2012-03-29 Thread Eric Blake
Commit 21b5daa1 was the last time we cleaned this up.

* tools/virt-host-validate-common.c (virHostValidateDevice):
Rename local variable.
---

Pushing under the build-breaker rule.
I considered adding a syntax-check rule to catch this, but we use
'devname' in enough other places where the name pollution was not
happening as to make writing a rule difficult.

 tools/virt-host-validate-common.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/virt-host-validate-common.c 
b/tools/virt-host-validate-common.c
index bd118be..066343c 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -113,13 +113,13 @@ void virHostMsgFail(virHostValidateLevel level,


 int virHostValidateDevice(const char *hvname,
-  const char *devname,
+  const char *dev_name,
   virHostValidateLevel level,
   const char *hint)
 {
-virHostMsgCheck(hvname, for device %s, devname);
+virHostMsgCheck(hvname, for device %s, dev_name);

-if (access(devname, R_OK|W_OK)  0) {
+if (access(dev_name, R_OK|W_OK)  0) {
 virHostMsgFail(level, hint);
 return -1;
 }
-- 
1.7.7.6

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


[libvirt] [PATCH] build: silence recent syntax check violations

2012-03-29 Thread Eric Blake
An upstream gnulib bug meant that some of our syntax checks
weren't being run.  Fix up our offenders before we upgrade to
a newer gnulib.

* src/util/virnetdevtap.c (virNetDevTapCreate): Use flags.
* tests/lxcxml2xmltest.c (mymain): Strip useless ().
---

The gnulib bug was here:
https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00194.html

I tested this by temporarily using the fixed gnulib maint.mk.

Pushing under the trivial rule.  I can't call it a build breaker,
because it won't break the build without a gnulib update.

I'm reluctant to update the .gnulib submodule this late in the
game without some review, as we've had bad luck with a submodule
update after the rc1 build in previous releases, so I'm saving
that for another day.  Besides, I'm waiting for a review of a
patch that fixes ssize_t for mingw, and it isn't worth a gnulib
update without that fix.

 src/util/virnetdevtap.c |7 +--
 tests/lxcxml2xmltest.c  |4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 0b3ac46..717b6ac 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -129,12 +129,14 @@ virNetDevProbeVnetHdr(int tapfd)
  */
 int virNetDevTapCreate(char **ifname,
int *tapfd,
-   unsigned int flags ATTRIBUTE_UNUSED)
+   unsigned int flags)
 {
 int fd;
 struct ifreq ifr;
 int ret = -1;

+virCheckFlags(VIR_NETDEV_TAP_CREATE_VNET_HDR, -1);
+
 if ((fd = open(/dev/net/tun, O_RDWR))  0) {
 virReportSystemError(errno, %s,
  _(Unable to open /dev/net/tun, is tun module 
loaded?));
@@ -237,8 +239,9 @@ cleanup:
 #else /* ! TUNSETIFF */
 int virNetDevTapCreate(char **ifname ATTRIBUTE_UNUSED,
int *tapfd ATTRIBUTE_UNUSED,
-   unsigned int flags ATTRIBUTE_UNUSED)
+   unsigned int flags)
 {
+virCheckFlags(0, -1);
 virReportSystemError(ENOSYS, %s,
  _(Unable to create TAP devices on this platform));
 return -1;
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 558bd01..6a87939 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -99,7 +99,7 @@ mymain(void)
 int ret = 0;

 if ((caps = testLXCCapsInit()) == NULL)
-return (EXIT_FAILURE);
+return EXIT_FAILURE;

 # define DO_TEST_FULL(name, is_different, inactive) \
 do {\
@@ -124,7 +124,7 @@ mymain(void)

 virCapabilitiesFree(caps);

-return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
+return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }

 VIRT_TEST_MAIN(mymain)
-- 
1.7.7.6

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