Re: [Libvir] Repository for work-in-progress storage patches

2008-01-14 Thread Mark McLoughlin
On Sat, 2008-01-12 at 21:59 +, Daniel P. Berrange wrote:
 I work using a mercurial patch queue, which is basically a mercurial native
 version of quilt.
 
 The master HG repository is an automated sync of CVS - HG:
 
http://hg.berrange.com/libraries/libvirt--devel
 
 The patch queue which applies ontop of this repo is:
 
http://hg.berrange.com/libraries/libvirt--storage
 
 
 To use this you would try the following
 
  1. Make sure the 'mg' extension is enabled in $HOME/.hgrc. You should have:

People could just use this patch queue directly on top of a CVS
checkout using quilt if .hgignore was committed to CVS ...

Cheers,
Mark.

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


Re: [Libvir] RFC: Add a short doc with libvirt coding style guidelines

2008-01-14 Thread Mark McLoughlin
Hey,
There's a few more obvious things missing, I think - e.g. should new
code use lower_case_with_underscores naming style or mixedCase ?

On Sun, 2008-01-13 at 17:39 +, Daniel P. Berrange wrote:
   2. Do not use conditionals in front of 'free'.
 
  eg Instead of
 
if (foo) free(foo)
 
  Use
 
free(foo)

That's only safe with glibc, right ?

Cheers,
Mark.

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


Re: [Libvir] Repository for work-in-progress storage patches

2008-01-14 Thread Jim Meyering
Mark McLoughlin [EMAIL PROTECTED] wrote:
 On Sat, 2008-01-12 at 21:59 +, Daniel P. Berrange wrote:
 I work using a mercurial patch queue, which is basically a mercurial native
 version of quilt.

 The master HG repository is an automated sync of CVS - HG:

http://hg.berrange.com/libraries/libvirt--devel

 The patch queue which applies ontop of this repo is:

http://hg.berrange.com/libraries/libvirt--storage


 To use this you would try the following

  1. Make sure the 'mg' extension is enabled in $HOME/.hgrc. You should have:

   People could just use this patch queue directly on top of a CVS
 checkout using quilt if .hgignore was committed to CVS ...

Hi Mark,

I'll bet you have one handy.
Is there any objection to committing it, now?

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


Re: [Libvir] Repository for work-in-progress storage patches

2008-01-14 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
  2. Clone both repos in one go:

 hg qclone -p http://hg.berrange.com/libraries/libvirt--storage \
  http://hg.berrange.com/libraries/libvirt--devel

Hi Dan,
Thanks for setting that up.

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


Re: [Libvir] RFC: Add a short doc with libvirt coding style guidelines

2008-01-14 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
 Thoughts.. ?

Thanks for writing that up.
I like them all -- of course :-)

Libvirt Hacking Guidelines
--
   1. Apply sizeof to the return variable, not the type.
   2. Do not use conditionals in front of 'free'.
   3. Include config.h in all source files
   4. Indent in 4 space units, without tabs
   5. Ensure any user visible strings are marked for translation

Here are a few proposed additions:
(IMHO, each that we agree on should be automatically checked)

  * avoid global-scoped variables
  * avoid trailing blanks and blank lines at end of file
  * avoid SPACE-TAB (i.e., ) esp. in indentation, but even in
  other contexts, like globs and regular expressions: i.e., prefer to
  use the TAB-SPACE sequence, grep '[]$' ..., to the SPACE-TAB one.
  Of course, it's even better if you can use the syntax where the TAB
  is actually visible: /[\t ]$/.
  * use const-correct types (I don't know how to check this automatically)

With these, it is easier (or possible) to reject invalid inputs:

  * avoid atof, atoi, atol, etc.
  * if you use strto*, be very careful, or consider the xstrto* wrappers
  * avoid parsing with sscanf

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


Re: [Libvir] Repository for work-in-progress storage patches

2008-01-14 Thread Mark McLoughlin

On Mon, 2008-01-14 at 09:39 +0100, Jim Meyering wrote:
 Mark McLoughlin [EMAIL PROTECTED] wrote:
  On Sat, 2008-01-12 at 21:59 +, Daniel P. Berrange wrote:
  I work using a mercurial patch queue, which is basically a mercurial native
  version of quilt.
 
  The master HG repository is an automated sync of CVS - HG:
 
 http://hg.berrange.com/libraries/libvirt--devel
 
  The patch queue which applies ontop of this repo is:
 
 http://hg.berrange.com/libraries/libvirt--storage
 
 
  To use this you would try the following
 
   1. Make sure the 'mg' extension is enabled in $HOME/.hgrc. You should 
  have:
 
  People could just use this patch queue directly on top of a CVS
  checkout using quilt if .hgignore was committed to CVS ...
 
 Hi Mark,
 
 I'll bet you have one handy.

Yep :-)

  http://hg.berrange.com/libraries/libvirt--devel?f=7dba49fef963;file=.hgignore

My point was only that Dan's mq patches assume the existance
of .hgignore, which isn't in CVS, so you can't use the patch queue with
quilt and CVS.

Cheers,
Mark.

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


[Libvir] [PATCH] Update from gnulib.

2008-01-14 Thread Jim Meyering
I ran ./bootstrap against a just-updated gnulib directory, so these
changes now sync into libvirt all of the changes from gnulib since
the last time:

Update from gnulib.

FYI, nearly all of these changes are also in the latest coreutils
beta/test release, so if there are problems, I should hear about
it soon.

If you'd like to see justification for a particular change,
you'll probably find it in a combination of these:

  gnulib's ChangeLog file
  a unit test change or addition,
  a message on the bug-gnulib mailing list.

Signed-off-by: Jim Meyering [EMAIL PROTECTED]
---
 gnulib/lib/Makefile.am |   11 +++
 gnulib/lib/float.in.h  |2 +-
 gnulib/lib/fseeko.c|3 ++
 gnulib/lib/printf-parse.c  |   40 -
 gnulib/lib/stdint.in.h |   10 +-
 gnulib/lib/stdio.in.h  |4 +-
 gnulib/lib/stdlib.in.h |   25 +++-
 gnulib/lib/string.in.h |   70 +++-
 gnulib/lib/unistd.in.h |5 ++-
 gnulib/lib/vasnprintf.h|4 +-
 gnulib/m4/alloca.m4|8 +
 gnulib/m4/float_h.m4   |4 +-
 gnulib/m4/gnulib-comp.m4   |   14 +
 gnulib/m4/stdlib_h.m4  |7 -
 gnulib/m4/string_h.m4  |9 +-
 gnulib/m4/unistd_h.m4  |1 +
 gnulib/tests/Makefile.am   |3 +-
 gnulib/tests/test-fseeko.c |   26 +++-
 18 files changed, 209 insertions(+), 37 deletions(-)

diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
index a94ed2d..e7a6edf 100644
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -420,13 +420,18 @@ stdlib.h: stdlib.in.h
  -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
  -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
  -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+ -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
  -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
  -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
  -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
  -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
  -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+ -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
+ -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
  -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
  -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+ -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
  -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
   $(srcdir)/stdlib.in.h; \
}  [EMAIL PROTECTED]
@@ -482,9 +487,11 @@ string.h: string.in.h
  -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
  -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
  -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+ -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
  -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
  -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
  -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
+ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
  -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
  -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
  -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -500,6 +507,9 @@ string.h: string.in.h
  -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
  -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
  -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
+ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
+ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
  -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
  -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
   $(srcdir)/string.in.h; \
@@ -677,6 +687,7 @@ unistd.h: unistd.in.h
  -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
  -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
  -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
  -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
  -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
   $(srcdir)/unistd.in.h; \
diff --git a/gnulib/lib/float.in.h b/gnulib/lib/float.in.h
index 7cf0791..1984fd7 100644
--- a/gnulib/lib/float.in.h
+++ b/gnulib/lib/float.in.h
@@ -24,7 +24,7 @@
 #define _GL_FLOAT_H
 
 /* 'long double' properties.  */
-#if defined __i386__  defined __BEOS__
+#if defined __i386__  (defined __BEOS__ || defined __OpenBSD__)
 /* Number of mantissa units, in base FLT_RADIX.  */
 # 

Re: [Libvir] RFC: PATCH 0/5: asynchronous background jobs

2008-01-14 Thread Richard W.M. Jones

Daniel P. Berrange wrote:

There are a number of existing APIs which can benefit from
this, hence I decided to work on this separately from the
main storage APIs. The APIs which can make use of this are
virDomainCreateLinux, virDomainCreate, virNetworkCreate,
virNetworkCreateXML, virDomainSave, virDomainRestore, and
virDomainDumpCore. For all of these we add a second variant
postfixed with 'Job' in the name, returning a virJobPtr object


Another way to do this is to overload the domain etc. objects and make 
them into suspensions.  The advantages being (a) no new API is needed 
and (b) some code benefits from overlapping computation even without 
being changed.  See also my reply here:


http://www.redhat.com/archives/libvir-list/2007-July/msg00257.html

OTOH, suspensions require interesting code changes inside libvirt, 
although not necessarily requiring threads - there are several possible 
implementations.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] RFC: PATCH 2/5: public driver API for async jobs

2008-01-14 Thread Richard W.M. Jones

Daniel P. Berrange wrote:

This patch adds the public API for the virJobPtr object, and the
internal driver support code. The new public APIs are:

 - int virJobGetInfo(virJobPtr job, virJobInfoPtr info);

   This gets elapsed time, estimate completion time, completion
   progress percentage, and completion status - success, failed,
   cancelled.

 - virDomainPtr  virJobGetDomain(virJobPtr job);

   If the job was a domain creation attempt, this gets the
   resulting domain object

 - virNetworkPtr virJobGetNetwork(virJobPtr job);

   If the job was a network creation attempt, this gets the
   resulting network object

 - virErrorPtr   virJobGetNetwork(virJobPtr job);

   If the job failed, this gets the associated error

 - int virJobCancel(virJobPtr job);

   Request that the job be cancelled. This is not an immediate
   operation. It merely sets a flag, which background jobs will
   check periodically. So a job may still complete even if it
   was cancelled. It should be responded to within a few seconds
   though.

 - int virJobDestroy(virJobPtr job);

   Once a job has finished running (success, failed, or cancelled)
   this may be called to release all resources associated with
   the job.


As mentioned before, the following variants on existing APis are
added:

 - virDomainCreateLinuxJob
 - virDomainCreateJob
 - virNetworkCreateJob
 - virNetworkCreateXMLJob
 - virDomainSaveJob
 - virDomainRestoreJob
 - virDomainDumpCoreJob

All are no-ops by default, unless the underlying driver supports
async jobs.


Finally, the job.c and job.h files provides a set of internal
routines to authors for the purpose of managing virJobPtr objects.
There is a default impl of the virJobDriver APIs which should be
suitable for all existing the remote driver. The async jobs are
basically run in a background pthread.

This psuedo code illustrates how the 'test' driver might use
these to implement an asynchronous variant of the 'save' method.
It basically stores the parameters in a struct, and then calls
the virJobCreate() method.

privdata = malloc(sizeof(*privdata));
if (privdata == NULL)
return (NULL);
memset(privdata, 0, sizeof(*privdata));

privdata-type = TEST_JOB_DOMAIN_SAVE;
privdata-data.save.domidx = domidx;
privdata-data.save.path = strdup(path);

job = virJobCreate(domain-conn,
   domain-conn-driver-jobDriver,
   testDomainSaveWorker,
   NULL,
   privdata,
   VIR_JOB_BOUNDED);


The actual work is done in the 'testDomainSaveWorker' method
which is passed in to virJobCreate. The job.h file contains
APIs for it to call to update progress information and detect
cancellation:

  static void testDomainSaveWorker(virJobPtr job, void *data)
  {
  testJobPtr privdata = data;
  /* A 50 second ETA for saving */
  virJobInitialize(job, 50);

  do {
  ... do a unit of work...

  ... Check for cancellation ...
  if (virJobFinishCancel(job))
  return;

  ... update progress, indicating 1 second
  of work complete, remove 1 second from
  the ETA, and add 2% of completion state...
  virJobUpdateRel(job, 1, -1, 2);
  } while (...not done...);

  ... Inform world we're all done ...
  virJobFinishSuccess(job);
  }

The virJobInitialize, virJobFinishCancel, virJobFinishSuccess
and virJobUpdateRel methods all take care to lock the virJobPtr
object to ensure thread safety.


This API looks sensible.

I haven't checked the code in detail - I'll follow your Storage API 
repository instead.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] RFC: PATCH 3/5: verbose job progress in virsh

2008-01-14 Thread Richard W.M. Jones

Daniel P. Berrange wrote:

This patch updates virsh to make use of any APIs with
new *Job variants. This means the 'create', 'start',
'save', 'restore', 'dump', 'net-create' and 'net-start'
methods all now take a '--verbose' option. If this
option is given, it will invoke the *Job variant of
the API and print out increment progress information.

eg, As an example of a job which has a bounded time,

   $ ./virsh --connect test:///default save --verbose test foo
   save [=   18%  ] Duration: 9 s, ETA: 41 s
   error: Cancelled domain save operation

eg, As an example which is unbounded

   $ ./virsh --connect test:///default save --verbose test foo
   save [ =   ] Duration: 9 s
   error: Cancelled domain save operation

In the latter case, the '=' will bounce back  forth while
the job is running.

Both cases illustrate how the 'Ctrl-C' / SIGINT handler is
hooked up such that 'virJobCancel' is run. Pressing Ctrl-C
twice in quick succession will still immediately exit the
program - useful if cancellation fails for some reason.


Looks sensible.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] RFC: PATCH 4/5: make test driver thread safe

2008-01-14 Thread Richard W.M. Jones

Daniel P. Berrange wrote:

The current test driver keeps all its state in memory and is
not thread safe. Since background jobs will need to access
state from a thread periodically we need to make the test
driver thread safe. This is done with 2 levels of locking

 - A global driver lock.
 - A per-connection lock

Before taking the per-connection lock, the global driver lock
must be acquired. The driver lock can be released the moment
the connection lock is acquired. The connection lock must be
held for the duration of all driver methods which are accessing
the 'struct testConn' or 'struct testDom' or 'struct testNet'
data.

To keep this reasonably unobtrusive, the GET_CONNECT, and
GET_DOMAIN / GET_NETWORK macros have been altered to do the
neccessary lock acquisition. The RELEASE_DOMAIN and RELEASE_NETWORL
macros are new, and must be used prior to returning from any
driver method so that mutex are released.

This is a fairly coarse level of locking, but effective enough
for the test driver which is not performance critical - merely
safety critical.

This model should apply reasonably safely to the QEMU driver
too, though we may wish to make it finer grained.


Sensible.  Maybe add some artifically slow functions to the test driver 
as well so that we can test job control?


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] RFC: PATCH 5/5: async job for test driver save API

2008-01-14 Thread Richard W.M. Jones

Daniel P. Berrange wrote:

This patch implements the virDomainSaveJob method for the
test driver as a proof of concept. First of all it adds a
inJob flag to the testDom and testNet objects. This is to
make sure that operations which may change an objects run
state are rejected, if a background job is active.

Then it merely implements the virDomainSaveJob method as
per the previous description. Actually it doesn't really
do any save operation, this impl just illustrates the way
progress updates propagate back to the caller, and the use
of cancellation.


Right, well there we go :-)

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[Libvir] [PATCH] examples.xml: Regenerate, now that *.c file names are sorted

2008-01-14 Thread Jim Meyering
I ran make distcheck and noticed these changes
in generated-and-version-controlled files:

* docs/examples/examples.xml: Regenerate, now that *.c file
names are sorted.

Signed-off-by: Jim Meyering [EMAIL PROTECTED]
---
 docs/examples/.cvsignore   |2 +-
 docs/examples/examples.xml |   50 ++--
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/docs/examples/.cvsignore b/docs/examples/.cvsignore
index aa743cb..5f0e251 100644
--- a/docs/examples/.cvsignore
+++ b/docs/examples/.cvsignore
@@ -3,5 +3,5 @@ Makefile.in
 Makefile
 .deps
 .libs
-suspend
 info1
+suspend
diff --git a/docs/examples/examples.xml b/docs/examples/examples.xml
index af7d4b9..5e54567 100644
--- a/docs/examples/examples.xml
+++ b/docs/examples/examples.xml
@@ -1,4 +1,23 @@
 examples
+  example filename='info1.c'
+synopsisExtract informations about Xen domain 0/synopsis
+purposeDemonstrate the basic use of the library to connect to the 
hypervisor and extract domain informations./purpose
+usageinfo1/usage
+testinfo1/test
+authorDaniel Veillard/author
+copysee Copyright for the status of this software. /copy
+sectionInformations/section
+includes
+/includes
+uses
+  function line='43' file='libvirt' name='virDomainGetInfo'/
+  function line='53' file='libvirt' name='virDomainFree'/
+  function line='36' file='libvirt' name='virDomainLookupByID'/
+  function line='55' file='libvirt' name='virConnectClose'/
+  struct line='25' file='libvirt' name='virDomainInfo'/
+  function line='29' file='libvirt' name='virConnectOpenReadOnly'/
+/uses
+  /example
   example filename='suspend.c'
 synopsisSuspend a domain and then resume its execution/synopsis
 purposeDemonstrate the basic use of the library to suspend and resume a 
domain. If no id is given on the command line this script will suspend and 
resume the first domain found which is not Domain 0./purpose
@@ -21,52 +40,33 @@
   function line='100' file='libvirt' name='virConnectOpenReadOnly'/
 /uses
   /example
-  example filename='info1.c'
-synopsisExtract informations about Xen domain 0/synopsis
-purposeDemonstrate the basic use of the library to connect to the 
hypervisor and extract domain informations./purpose
-usageinfo1/usage
-testinfo1/test
-authorDaniel Veillard/author
-copysee Copyright for the status of this software. /copy
-sectionInformations/section
-includes
-/includes
-uses
-  function line='43' file='libvirt' name='virDomainGetInfo'/
-  function line='53' file='libvirt' name='virDomainFree'/
-  function line='36' file='libvirt' name='virDomainLookupByID'/
-  function line='55' file='libvirt' name='virConnectClose'/
-  struct line='25' file='libvirt' name='virDomainInfo'/
-  function line='29' file='libvirt' name='virConnectOpenReadOnly'/
-/uses
-  /example
   symbols
 symbol name='virConnectClose'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virConnectListDomains'
   ref filename='suspend.c'/
 /symbol
 symbol name='virConnectOpenReadOnly'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virDomainFree'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virDomainGetInfo'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virDomainInfo'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virDomainLookupByID'
-  ref filename='suspend.c'/
   ref filename='info1.c'/
+  ref filename='suspend.c'/
 /symbol
 symbol name='virDomainResume'
   ref filename='suspend.c'/
--
1.5.4.rc1.11.gd2f82

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


Re: [Libvir] RFC: PATCH 0/5: asynchronous background jobs

2008-01-14 Thread Richard W.M. Jones

Daniel Veillard wrote:

  Sounds to me that the creation of a Job should increate a reference
counter for conn, which will be decreased when the Job object is destroyed.
This shouldmap well with Python bindings too.


Good point - I'm sure it should do.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] PATCH: make debug builds quiet by default

2008-01-14 Thread Richard W.M. Jones

Daniel Veillard wrote:

On Wed, Jan 09, 2008 at 05:13:47AM +, Daniel P. Berrange wrote:

During development I like to have the --enable-debug flag enabled all the
time because its very handy at times. I don't want it spewing to stderr
all the time though, just because I turned on the compile option. So this
patch adds an env variable 'LIBVIRT_DEBUG' which controls whether it is
chatty or not. So with this patch you can use --enable-debug all the time,
and just run

   LIBVIRT_DEBUG=1 ./src/virsh 

to turn it on for a particular test, or likewise for the daemon

  LIBVIRT_DEBUG=1 ./qemud/libvirtd


  Hum, in other projects I have found that always compiling debug support in
but activating it using a command line flag or a environment variable to be
very useful, this helps people debug stuff by themselve or improve the
quality of the reports. Shouldn't we just do that ? it's not like anthing 
in libvirt is really timing critical or size matters that much, I can't

see a real drawback to making --enable-debug the default, if it requires
explicit activation.


+1 to DV's suggestion.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch 7/9] Add support for lokkit

2008-01-14 Thread Richard W.M. Jones

+AC_ARG_ENABLE(iptables-lokkit,

Just a minor nit here: My reading of the autoconf info page is that this 
should be a --with argument, not an --enable argument.


[...]
 Optional Features:
   ...
   --enable-barinclude bar

 Optional Packages:
   ...
   --with-foo  use foo

[...]
14.2 Working With External Software
===

Some packages require, or can optionally use, other software packages
that are already installed.  The user can give `configure' command line
options to specify which such external software to use.  The options
have one of these forms:

 --with-PACKAGE[=ARG]
 --without-PACKAGE

[...]
14.3 Choosing Package Options
=

If a software package has optional compile-time features, the user can
give `configure' command line options to specify whether to compile
them.  The options have one of these forms:

 --enable-FEATURE[=ARG]
 --disable-FEATURE

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch 1/1] Reduce the number of times lokkit is run

2008-01-14 Thread Richard W.M. Jones

Mark McLoughlin wrote:

plain text document attachment (libvirt-iptables-save-rules.patch)
With --enable-iptables-lokkit, the rules are saved to disk
and lokkit --custom-rules is run each time a single rule is
added or removed.

This patch moves this code into a new iptablesSaveRules()
function so that we can do it for all rules at once.

Signed-off-by: Mark McLoughlin [EMAIL PROTECTED]


This all looks good, and anyway I notice it has been committed during my 
brief sojourn in Windows-land.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] Error compiling libvirt 0.4.0 on debian etch

2008-01-14 Thread Richard W.M. Jones

Solli Honorio wrote:
Hi, when I'm trying to compile the libvirt 0.4.0 on Debian etch I'm 
getting the error below, I have no problem with version 0.3.3.


I've look at line 578 of /usr/include/xen/xen.h and this error don't 
make sense for me. Does any anyone had this problem on debian etch too ? 
Maybe someone can help-me with this error ?


Thanks for attention,

Solli Honorio

error

In file included from /usr/include/xen/dom0_ops.h:31,
 from xen_unified.c:29:
/usr/include/xen/xen.h:578: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'char'
/usr/include/xen/xen.h:579: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'short'
/usr/include/xen/xen.h:580: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'int'
/usr/include/xen/xen.h:581: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'long'

make[2]: *** [libvirt_la-xen_unified.lo] Error 1
make[2]: Leaving directory `/usr/src/libvirt-0.4.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/libvirt-0.4.0'
make: *** [all] Error 2
/error


Did you find out what caused this?  (My Debian machine is broken at the 
moment so I can't reproduce the error).


My suggestions:

(1) Try compiling libvirt from CVS.  It may include a fix for this.

(2) Check that src/xen_unified.c #include config.h near the top.  It 
does in the CVS version, maybe it doesn't in the 0.4.0 version?


(3) See if you can get the actual preprocessor (gcc -E) output, since 
this error is buried inside a 2-level C macro.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] change a Disk/Nic of inactive domain

2008-01-14 Thread Richard W.M. Jones

S.Sakamoto wrote:

These struct definitions *intentionally* private.

Oops, I did not notice it...

I revised a patch not to access the struct data directly.


In principle this patch looks good.  If no one else objects, I'll commit 
this, with a few of my own fixes (below).


Rich.

+(obj-stringval)  !strcmp((char*)obj-stringval, hvm))

I'm going to use STREQ macro here instead of !strcmp.

+if (ctxt)
+xmlXPathFreeContext(ctxt);

There are a few potential double-frees on the cleanup path.  Need to set 
ctxt back to NULL after freeing it.


--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] examples.xml: Regenerate, now that *.c file names are sorted

2008-01-14 Thread Richard W.M. Jones

Jim Meyering wrote:

I ran make distcheck and noticed these changes
in generated-and-version-controlled files:

* docs/examples/examples.xml: Regenerate, now that *.c file
names are sorted.


+1.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] Clean up global name space in examples and tests.

2008-01-14 Thread Richard W.M. Jones

Jim Meyering wrote:

These don't really matter, other than to remove false-positives
if/when we ever automate checks for unnecessarily-global symbols.

Clean up global name space in examples and tests.
* docs/examples/suspend.c: Declare global conn to be static.
* tests/qemuxml2argvtest.c: Declare global driver to be static.
* tests/qemuxml2xmltest.c: Likewise.


+1.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch] qemu/kvm: use_system_powerdown instead of killing the vm hard

2008-01-14 Thread Richard W.M. Jones

Guido Guenther wrote:

On Wed, Jan 09, 2008 at 03:56:52PM +, Daniel P. Berrange wrote:

Well there's a 'system_reset'  monitor command, but its unclear if
its actually working - when i run it, it stops the guest from responding
to any keyboard input and makes it take 100% CPU, but doesn't reboot :-(
If that's not suitable i think the ctrl-alt-delete thing is probably the
best we can do.

system_reset *resets* the machine (like hitting the reset switch). It
doesn't shutdown anything, probaly not what we want. Here's a patch that
does the ctrl-alt-del (on top of the previous domainsShutdown patch).
This looks much more friendly to the filesystem. There are issues in kvm
where after the reboot the ACPI tables are borked, but that's another
issue.

Index: libvirt-0.4.0/src/qemu_driver.c
===
--- libvirt-0.4.0.orig/src/qemu_driver.c2008-01-09 16:23:34.0 
+
+++ libvirt-0.4.0/src/qemu_driver.c 2008-01-09 16:24:27.0 +
@@ -1866,7 +1866,26 @@
 return -1;
 }
 return 0;
+}
+
+
+static int qemudDomainReboot(virDomainPtr dom) {
+struct qemud_driver *driver = (struct qemud_driver 
*)dom-conn-privateData;
+struct qemud_vm *vm = qemudFindVMByID(driver, dom-id);
+char* info;
 
+if (!vm) {

+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ no domain with matching id %d, dom-id);
+return -1;
+}
+
+if (qemudMonitorCommand(driver, vm, sendkey ctrl-alt-delete, info)  0) 
{
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ reboot operation failed);
+return -1;
+}
+return 0;
 }
 
 
@@ -2877,7 +2896,7 @@

 qemudDomainSuspend, /* domainSuspend */
 qemudDomainResume, /* domainResume */
 qemudDomainShutdown, /* domainShutdown */
-NULL, /* domainReboot */
+qemudDomainReboot, /* domainReboot */
 qemudDomainDestroy, /* domainDestroy */
 qemudDomainGetOSType, /* domainGetOSType */
 NULL, /* domainGetMaxMemory */


NACK - doesn't do the right thing at all on Windows.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch 7/9] Add support for lokkit

2008-01-14 Thread Mark McLoughlin
Hi Rich,

On Mon, 2008-01-14 at 12:13 +, Richard W.M. Jones wrote:

 Just a minor nit here: My reading of the autoconf info page is that
 this should be a --with argument, not an --enable argument.

I don't mind either way, but my understanding was that --with would
only be appropriate if we were doing:

  --with-lokkit=/usr/sbin/lokkit

i.e. that --with was used for specifying the location of some external
dependency, whereas --enable is used for simply enabling or disabling a
feature.

Cheers,
Mark.

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


Re: [Libvir] [PATCH] Clean up the global name space.

2008-01-14 Thread Richard W.M. Jones

Jim Meyering wrote:

After mentioning avoid global variables as a potential
addition to HACKING, I did some quick tests and spotted
a few that are easy to eliminate.  This is useful even
if we don't end up automating the check:

Clean up the global name space.
* src/qemu_conf.c: Add static and const attributes to some globals.
* src/qemu_conf.h: Update a declaration.
* src/qemu_driver.c (qemud_driver): Declare static.


+1.

These structures were originally shared between files, but lots of code 
refactoring since seems to make that obsolete.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch 7/9] Add support for lokkit

2008-01-14 Thread Richard W.M. Jones

Mark McLoughlin wrote:

Hi Rich,

On Mon, 2008-01-14 at 12:13 +, Richard W.M. Jones wrote:


Just a minor nit here: My reading of the autoconf info page is that
this should be a --with argument, not an --enable argument.


I don't mind either way, but my understanding was that --with would
only be appropriate if we were doing:

  --with-lokkit=/usr/sbin/lokkit

i.e. that --with was used for specifying the location of some external
dependency, whereas --enable is used for simply enabling or disabling a
feature.


You could be right.

/me invokes Jim Meyering ... 
https://www.redhat.com/archives/libvir-list/2008-January/msg00126.html


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] Update from gnulib.

2008-01-14 Thread Richard W.M. Jones

Jim Meyering wrote:

I ran ./bootstrap against a just-updated gnulib directory, so these
changes now sync into libvirt all of the changes from gnulib since
the last time:

Update from gnulib.

FYI, nearly all of these changes are also in the latest coreutils
beta/test release, so if there are problems, I should hear about
it soon.

If you'd like to see justification for a particular change,
you'll probably find it in a combination of these:

  gnulib's ChangeLog file
  a unit test change or addition,
  a message on the bug-gnulib mailing list.


+1.  Should integrate early as possible into libvirt so that we get most 
testing.


Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch] qemu/kvm: use_system_powerdown instead of killing the vm hard

2008-01-14 Thread Richard W.M. Jones

Guido Guenther wrote:

sendkey ctrl-alt-delete
to the monitor which might be very fragile though. Both solutions depend
on the os in the vm doing the right thing (acpi event handling in the
first case).


That's not going to work on Windows NT.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903


smime.p7s
Description: S/MIME Cryptographic Signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] RFC: PATCH 1/5: cleanup connection ref counting

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 10:35:10AM +, Richard W.M. Jones wrote:
 Daniel P. Berrange wrote:
 The referencing counting code for Connect/Domain/Network
 objects has many repeated codepaths, not all of which are
 correct. eg, the virFreeDomain method forgets to release
 networks when garbage collecting a virConnectPtr, and the
 virFreeNetwork method forgets to release domains.
 
 The reference counting in libvirt is not just ugly when interfacing with 
 a language with real GC, but also broken at the moment.
 
 The most serious example are the connect/domain/network handles included 
 in a virterror.  These are not reference counted so that the caller 
 doesn't have to free the virterror or these handles.  But on the other 
 hand it means that the handles have an indeterminate lifetime, so cannot 
 be used safely.

Ahhh you noticed that too then :-)  That's on my list of things to fix
somehow I've thought of a couple of options:

 - Increment ref count when assign a domain/network to a virError

Or

 - When ref count of domain/network drops to zero check for any virError 
   a NULL-ify the domain/network

Or

 - Or tell people not to use the domain/network objects in errors and
   don't set them at all

With the first option we might consider a special case in virConnectClose
to automatically decrement the ref count held by the error object, otherwie
we'd be in situation where a virConnectPtr would potentially never be
free'd unless user calls virErrorReset which they probably don't.

My preference is the last. IMHO its a flawed idea because its not extensible
to other objects we're adding. eg I've no way to add a Job or StoragePool
or StorageVol object to the virErrorPtr without breaking ABI each time.
IMHO we should just make use of 'str1' and 'str2' and 'int1' to store the
name, uuid and id of the associated objects, since we have all these  spare
generic fields never used ..

 So I've moved the code for garbage collecting a virConnectPtr
 object into a new virUnrefConnect() method which can be called
 from virFreeConnect, virFreeDomain and virFreeNetwork.
 
 This probably has negative implications in the language bindings.  At 
 this moment I don't care much because network objects are in practice 
 used only very rarely by real code.  This could change when we have 
 storage objects which, I guess, will be used frequently like domains.  A 
 bit too early in the morning for me to be thinking about GC and its 
 interaction with reference counting :-)

Actually it shouldn't hurt the language bindings. When I say I moved
the gargage collection code, this is merely a re-factoring of the 
internal cleanup code. So instead of having the same broken duplicted
in virFreeConnect, virFreeDomain and virFreeNetwork it is centralized
in virUnrefConnect. The public API is unchanged, just the impl.

Dan
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [patch 7/9] Add support for lokkit

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 02:00:36PM +0100, Jim Meyering wrote:
 Richard W.M. Jones [EMAIL PROTECTED] wrote:
  Mark McLoughlin wrote:
  Hi Rich,
 
  On Mon, 2008-01-14 at 12:13 +, Richard W.M. Jones wrote:
 
  Just a minor nit here: My reading of the autoconf info page is that
  this should be a --with argument, not an --enable argument.
 
 I don't mind either way, but my understanding was that --with would
  only be appropriate if we were doing:
 
--with-lokkit=/usr/sbin/lokkit
 
 i.e. that --with was used for specifying the location of some external
  dependency, whereas --enable is used for simply enabling or disabling a
  feature.
 
  You could be right.
 
  /me invokes Jim Meyering
  ... https://www.redhat.com/archives/libvir-list/2008-January/msg00126.html
 
 Hi guys,
 
 You probably know that --with-THING and --enable-THING are functionally
 equivalent, and the question is about which should appear in
 ./configure --help output.
 
 The autoconf documentation describes the distinction
 between --with-PACKAGE and --enable-FEATURE, but since lokkit
 is a package, and lokkit-support can be considered a feature of
 libvirt, it's a little ambiguous.
 
 However, since autoconf gives the examples of --with-x and
 --with-gnu-as, --with-lokkit does seem to be more in line.

Yep, I think we should use  --with-lokkit since it also fits it a little
better with the other --with-PROG args we already have - even though they
don't all take a path as their optional arg (yet).

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] Clean up the global name space.

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 12:33:56PM +, Richard W.M. Jones wrote:
 Jim Meyering wrote:
 After mentioning avoid global variables as a potential
 addition to HACKING, I did some quick tests and spotted
 a few that are easy to eliminate.  This is useful even
 if we don't end up automating the check:
 
  Clean up the global name space.
  * src/qemu_conf.c: Add static and const attributes to some 
  globals.
  * src/qemu_conf.h: Update a declaration.
  * src/qemu_driver.c (qemud_driver): Declare static.
 
 +1.
 
 These structures were originally shared between files, but lots of code 
 refactoring since seems to make that obsolete.

ACK

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] Clean up global name space in examples and tests.

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 12:33:05PM +, Richard W.M. Jones wrote:
 Jim Meyering wrote:
 These don't really matter, other than to remove false-positives
 if/when we ever automate checks for unnecessarily-global symbols.
 
  Clean up global name space in examples and tests.
  * docs/examples/suspend.c: Declare global conn to be static.
  * tests/qemuxml2argvtest.c: Declare global driver to be static.
  * tests/qemuxml2xmltest.c: Likewise.
 
 +1.

ACK

Dan
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] examples.xml: Regenerate, now that *.c file names are sorted

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 12:03:47PM +0100, Jim Meyering wrote:
 I ran make distcheck and noticed these changes
 in generated-and-version-controlled files:
 
   * docs/examples/examples.xml: Regenerate, now that *.c file
 names are sorted.

ACK.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] Update from gnulib.

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 12:35:45PM +, Richard W.M. Jones wrote:
 Jim Meyering wrote:
 I ran ./bootstrap against a just-updated gnulib directory, so these
 changes now sync into libvirt all of the changes from gnulib since
 the last time:
 
  Update from gnulib.
 
 FYI, nearly all of these changes are also in the latest coreutils
 beta/test release, so if there are problems, I should hear about
 it soon.
 
 If you'd like to see justification for a particular change,
 you'll probably find it in a combination of these:
 
   gnulib's ChangeLog file
   a unit test change or addition,
   a message on the bug-gnulib mailing list.
 
 +1.  Should integrate early as possible into libvirt so that we get most 
 testing.

ACK.

Should we have a general rule that we always do a gnulib update immediately
after we put out a libvirt release ? That gives us reasonably frequent
updates while allowing a good amount of in-tree time for testing...

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] change a Disk/Nic of inactive domain

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 12:25:44PM +, Richard W.M. Jones wrote:
 S.Sakamoto wrote:
 These struct definitions *intentionally* private.
 Oops, I did not notice it...
 
 I revised a patch not to access the struct data directly.
 
 In principle this patch looks good.  If no one else objects, I'll commit 
 this, with a few of my own fixes (below).

Yep, fine by me. 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] RFC: PATCH 0/5: asynchronous background jobs

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 10:39:25AM +, Richard W.M. Jones wrote:
 Daniel P. Berrange wrote:
 There are a number of existing APIs which can benefit from
 this, hence I decided to work on this separately from the
 main storage APIs. The APIs which can make use of this are
 virDomainCreateLinux, virDomainCreate, virNetworkCreate,
 virNetworkCreateXML, virDomainSave, virDomainRestore, and
 virDomainDumpCore. For all of these we add a second variant
 postfixed with 'Job' in the name, returning a virJobPtr object
 
 Another way to do this is to overload the domain etc. objects and make 
 them into suspensions.  The advantages being (a) no new API is needed 
 and (b) some code benefits from overlapping computation even without 
 being changed.  See also my reply here:
 
 http://www.redhat.com/archives/libvir-list/2007-July/msg00257.html
 
 OTOH, suspensions require interesting code changes inside libvirt, 
 although not necessarily requiring threads - there are several possible 
 implementations.

That's an interesting idea though i think we'd still need a fair number
of new APIs. Only a handful of existing APIs have a 'flags' param where
we could request async operation, so even if we could keep the same
return type by using a suspension we still need extra args to indicate
sync vs async. 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [patch] qemu/kvm: use_system_powerdown instead of killing the vm hard

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 02:01:40PM +0100, Guido Guenther wrote:
 On Mon, Jan 14, 2008 at 12:28:09PM +, Richard W.M. Jones wrote:
  Guido Guenther wrote:
  sendkey ctrl-alt-delete
  to the monitor which might be very fragile though. Both solutions depend
  on the os in the vm doing the right thing (acpi event handling in the
  first case).
 
  That's not going to work on Windows NT.
 No it isn't but it's making things much better for other OSes. I won't
 insist on this in any way though (this just came along with the
 system_powerdown stuff) but using system_reset is bad either. Using
 system_powerdown and then restarting the domain is probably best. 

Yes, I think we'll have todo a 'system_powerdown' and then set a 'needs
restart' flag in our internal 'strut qemu_vm' so that when the VM is
shutdown, we know that we were supposed to restart it.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] RFC: Add a short doc with libvirt coding style guidelines

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 08:40:35AM +, Mark McLoughlin wrote:
 Hey,
   There's a few more obvious things missing, I think - e.g. should new
 code use lower_case_with_underscores naming style or mixedCase ?

Really ? About 70% of our code currently uses mixed case, no underscores.
The QEMU/network driver file  mdns file are the main ones which don't.

 On Sun, 2008-01-13 at 17:39 +, Daniel P. Berrange wrote:
2. Do not use conditionals in front of 'free'.
  
   eg Instead of
  
 if (foo) free(foo)
  
   Use
  
 free(foo)
 
   That's only safe with glibc, right ?

The man page says its C89 standard and the nice folks at Wine have done
some background checks which show its safe on any modern UNIX...

http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html 


Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] RFC: Add a short doc with libvirt coding style guidelines

2008-01-14 Thread Mark McLoughlin
On Mon, 2008-01-14 at 14:11 +, Daniel P. Berrange wrote:
 On Mon, Jan 14, 2008 at 08:40:35AM +, Mark McLoughlin wrote:
  Hey,
  There's a few more obvious things missing, I think - e.g. should new
  code use lower_case_with_underscores naming style or mixedCase ?
 
 Really ? About 70% of our code currently uses mixed case, no underscores.
 The QEMU/network driver file  mdns file are the main ones which don't.

But does the 70/30 split imply that it's okay for people writing new
code for libvirt to use lower_case_with_underscores or not? I'm guessing
not, especially since all your storage stuff is mixedCase, but it'd be
worth pointing out in HACKING.

My main point was that some details on what is considered to be the
libvirt coding style (aside form indentation) might help people.

  On Sun, 2008-01-13 at 17:39 +, Daniel P. Berrange wrote:
 2. Do not use conditionals in front of 'free'.
   
eg Instead of
   
  if (foo) free(foo)
   
Use
   
  free(foo)
  
  That's only safe with glibc, right ?
 
 The man page says its C89 standard and the nice folks at Wine have done
 some background checks which show its safe on any modern UNIX...
 
 http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html 

Cool stuff, new to me.

Cheers,
Mark.

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


[Libvir] [PATCH] Keyboard layout support for QEMU/KVM

2008-01-14 Thread Daniel Hokka Zakrisson
This patch adds support for qemu's -k option, which is required to run
virt-manager with a non-US keymap. Without it, keys are remapped a number
of times, ending up with a completely unusable layout.

Even with this patch I am having problems using the AltGr key, returning a
scancode of 00. This seems to be a qemu problem though.

-- 
Daniel Hokka ZakrissonIndex: src/qemu_conf.c
===
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.26
diff -u -p -r1.26 qemu_conf.c
--- src/qemu_conf.c	14 Jan 2008 14:05:25 -	1.26
+++ src/qemu_conf.c	14 Jan 2008 17:55:33 -
@@ -218,6 +218,7 @@ void qemudFreeVMDef(struct qemud_vm_def 
 input = input-next;
 free(prev);
 }
+xmlFree(def-keymap);
 free(def);
 }
 
@@ -1245,6 +1246,7 @@ static struct qemud_vm_def *qemudParseXM
 else
 strcpy(def-vncListen, driver-vncListen);
 def-vncListen[BR_INET_ADDR_MAXLEN-1] = '\0';
+def-keymap = (char *) xmlGetProp(obj-nodesetval-nodeTab[0], BAD_CAST keymap);
 xmlFree(vncport);
 xmlFree(vnclisten);
 } else if (!strcmp((char *)prop, sdl)) {
@@ -1807,6 +1809,12 @@ int qemudBuildCommandLine(virConnectPtr 
 goto no_memory;
 if (!((*argv)[++n] = strdup(vncdisplay)))
 goto no_memory;
+if (vm-def-keymap) {
+if (!((*argv)[++n] = strdup(-k)))
+goto no_memory;
+if (!((*argv)[++n] = strdup(vm-def-keymap)))
+goto no_memory;
+}
 } else if (vm-def-graphicsType == QEMUD_GRAPHICS_NONE) {
 /* Nada - we added -nographic earlier in this function */
 } else {
@@ -2918,6 +2926,11 @@ char *qemudGenerateXML(virConnectPtr con
   def-vncListen)  0)
 goto no_memory;
 
+if (def-keymap 
+virBufferVSprintf(buf,  keymap='%s',
+  def-keymap)  0)
+goto no_memory;
+
 if (virBufferAdd(buf, /\n, -1)  0)
 goto no_memory;
 break;
Index: src/qemu_conf.h
===
RCS file: /data/cvs/libvirt/src/qemu_conf.h,v
retrieving revision 1.15
diff -u -p -r1.15 qemu_conf.h
--- src/qemu_conf.h	14 Jan 2008 14:05:25 -	1.15
+++ src/qemu_conf.h	14 Jan 2008 17:55:33 -
@@ -206,6 +206,7 @@ struct qemud_vm_def {
 int vncPort;
 int vncActivePort;
 char vncListen[BR_INET_ADDR_MAXLEN];
+char *keymap;
 
 int ndisks;
 struct qemud_vm_disk_def *disks;--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] Keyboard layout support for QEMU/KVM

2008-01-14 Thread Soren Hansen
On Mon, Jan 14, 2008 at 07:09:23PM +0100, Daniel Hokka Zakrisson wrote:
 This patch adds support for qemu's -k option, which is required to run
 virt-manager with a non-US keymap. Without it, keys are remapped a number
 of times, ending up with a completely unusable layout.
 
 Even with this patch I am having problems using the AltGr key, returning a
 scancode of 00. This seems to be a qemu problem though.

Note that a different solution to the same problem has been proposed by
Anthony Liguori.

   
http://sourceforge.net/mailarchive/forum.php?thread_name=478A6BFA.80009%40codemonkey.wsforum_name=gtk-vnc-devel

-- 
Soren Hansen
Ubuntu Server Team
http://www.ubuntu.com/


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


Re: [Libvir] [PATCH] Keyboard layout support for QEMU/KVM

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 07:09:23PM +0100, Daniel Hokka Zakrisson wrote:
 This patch adds support for qemu's -k option, which is required to run
 virt-manager with a non-US keymap. Without it, keys are remapped a number
 of times, ending up with a completely unusable layout.
 
 Even with this patch I am having problems using the AltGr key, returning a
 scancode of 00. This seems to be a qemu problem though.

ACK, this patch looks good - gives parity with key handling in the Xen
driver.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


Re: [Libvir] [PATCH] Keyboard layout support for QEMU/KVM

2008-01-14 Thread Daniel P. Berrange
On Mon, Jan 14, 2008 at 07:36:11PM +0100, Soren Hansen wrote:
 On Mon, Jan 14, 2008 at 07:09:23PM +0100, Daniel Hokka Zakrisson wrote:
  This patch adds support for qemu's -k option, which is required to run
  virt-manager with a non-US keymap. Without it, keys are remapped a number
  of times, ending up with a completely unusable layout.
  
  Even with this patch I am having problems using the AltGr key, returning a
  scancode of 00. This seems to be a qemu problem though.
 
 Note that a different solution to the same problem has been proposed by
 Anthony Liguori.
 

 http://sourceforge.net/mailarchive/forum.php?thread_name=478A6BFA.80009%40codemonkey.wsforum_name=gtk-vnc-devel

That's tangential. Daniel's patch is needed to support current real world
usage of QEMU/KVM.  Anthony's proposal is something for future impls.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


[Libvir] PATCH: Fix remote driver SSH tunnelling

2008-01-14 Thread Daniel P. Berrange
An off-by-one error in the remote driver checking for malloc() failure
in the SSH argv meant all SSH connections were always rejected. It was
always checking the trailing NULL in the argv[] 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Index: remote_internal.c
===
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.53
diff -u -r1.53 remote_internal.c
--- remote_internal.c   14 Jan 2008 04:05:23 -  1.53
+++ remote_internal.c   15 Jan 2008 00:25:18 -
@@ -670,11 +670,12 @@
 cmd_argv[j++] = strdup (sockname ? sockname : 
LIBVIRTD_PRIV_UNIX_SOCKET);
 cmd_argv[j++] = 0;
 assert (j == nr_args);
-for (j = 0; j  nr_args; j++)
+for (j = 0; j  (nr_args-1); j++) {
 if (cmd_argv[j] == NULL) {
 error (conn, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM));
 goto failed;
 }
+}
 }
 
 /*FALLTHROUGH*/
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] PATCH: Fix remote driver SSH tunnelling

2008-01-14 Thread Ryan Scott

Daniel P. Berrange wrote:

An off-by-one error in the remote driver checking for malloc() failure
in the SSH argv meant all SSH connections were always rejected. It was
always checking the trailing NULL in the argv[] 


ACK.  I just noticed the same problem.

-Ryan



Dan.




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


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


[Libvir] What do the docs/APIchunk*.html files do ?

2008-01-14 Thread Daniel P. Berrange
Whenever we change any of the embedded API docs or add new APIs we end up
with huge diffs on the docs/APIchunk*.html files. These HTML files don't
seem to be visible anywhere on the website, nor are there even any a href
links to them in other pages on the website.

Can we just kill off these APIchunk* files from the doc generator in CVS

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-   Perl modules: http://search.cpan.org/~danberr/  -=|
|=-   Projects: http://freshmeat.net/~danielpb/   -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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


[Libvir] virsh vncdisplay fix

2008-01-14 Thread John Levon

I have an old HVM guest defined in 3.0.4, and now I'm running 3.1.2 and
libvirt 0.4.0. The config looks like this:

(domain
 (image
  (hvm
   (vnc 1)
   (vncdisplay 0)
 (device
  (vfb
   (location localhost:5900)
   (vncdisplay 0)
   (uuid ...)

The libvirt code looks like this:

1757 /* Graphics device (HVM = 3.0.4, or PV = 3.0.3) vnc config */
1758 if ((hvm  xendConfigVersion  4) ||
1759 (!hvm  xendConfigVersion  3)) {
1760 tmp = sexpr_fmt_node(root, domain/image/%s/vnc, hvm ? hvm : 
linux);

So we don't see the 'vnc 1' at the top. But the code to parse device/vfb doesn't
expect this config either:

1685 tmp = sexpr_node(node, device/vfb/type);

The patch below replaces the later version check with something that
copes correctly with the upgrade case.

regards
john

2008-01-15 John Levon [EMAIL PROTECTED]

* src/xend_internal.c: fix VNC parsing of old Xen domains on
  newer Xen versions.

diff -prauN libvirt-0.4.0/src/xend_internal.c libvirt-new/src/xend_internal.c
--- libvirt-0.4.0/src/xend_internal.c   2007-12-17 15:05:27.0 -0800
+++ libvirt-new/src/xend_internal.c 2008-01-14 18:42:08.895060570 -0800
@@ -1371,6 +1371,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 unsigned char uuid[VIR_UUID_BUFLEN];
 char uuidstr[VIR_UUID_STRING_BUFLEN];
 int vif_index = 0;
+int found_graphics = 0;
 
 if (root == NULL) {
 /* ERROR */
@@ -1683,6 +1684,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 if (tmp  !strcmp(tmp, sdl)) {
 virBufferVSprintf(buf, input type='mouse' 
bus='%s'/\n, hvm ? ps2: xen);
 virBufferAdd(buf, graphics type='sdl'/\n, 27);
+found_graphics = 1;
 } else if (tmp  !strcmp(tmp, vnc)) {
 int port = xenStoreDomainGetVNCPort(conn, domid);
 const char *listenAddr = sexpr_node(node, 
device/vfb/vnclisten);
@@ -1700,6 +1702,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 if (keymap)
 virBufferVSprintf(buf,  keymap='%s', keymap);
 virBufferAdd(buf, /\n, 3);
+found_graphics = 1;
 }
 }
 }
@@ -1751,8 +1754,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 }
 
 /* Graphics device (HVM = 3.0.4, or PV = 3.0.3) vnc config */
-if ((hvm  xendConfigVersion  4) ||
-(!hvm  xendConfigVersion  3)) {
+if (!found_graphics) {
 tmp = sexpr_fmt_node(root, domain/image/%s/vnc, hvm ? hvm : 
linux);
 if (tmp != NULL) {
 if (tmp[0] == '1') {
@@ -1780,6 +1782,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 if (keymap)
 virBufferVSprintf(buf,  keymap='%s', keymap);
 virBufferAdd(buf, /\n, 3);
+found_graphics = 1;
 }
 }
 
@@ -1789,6 +1792,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
 if (tmp[0] == '1') {
 virBufferVSprintf(buf, input type='mouse' 
bus='%s'/\n, hvm ? ps2 : xen);
 virBufferAdd(buf, graphics type='sdl'/\n, 27 );
+found_graphics = 1;
 }
 }
 }

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