]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoopenvz: Convert virExec usage to virCommand
Cole Robinson [Fri, 6 May 2011 20:21:58 +0000 (16:21 -0400)]
openvz: Convert virExec usage to virCommand

v2:
    Use virCommand's autocleanup

v3:
    Don't free 'names' on success

13 years agostorage: iscsi: Convert virExec to virCommand
Cole Robinson [Fri, 6 May 2011 20:00:23 +0000 (16:00 -0400)]
storage: iscsi: Convert virExec to virCommand

v2:
    Use virCommand auto-cleanup

13 years agoFix error reporting in stream creation code
Matthias Bolte [Sat, 14 May 2011 15:46:00 +0000 (17:46 +0200)]
Fix error reporting in stream creation code

virStreamNew needs to dispatch the error that virGetStream reports
on failure.

remoteCreateClientStream can fail due to virStreamNew or due to
VIR_ALLOC. Report OOM error for VIR_ALLOC failure to report errors
in all error cases.

Remove OOM error reporting from remoteCreateClientStream callers.

13 years agoremote generator, client: Add more special case handling
Matthias Bolte [Sat, 14 May 2011 13:56:03 +0000 (15:56 +0200)]
remote generator, client: Add more special case handling

For virDomainDestroy and virDrvSupportsFeature.

13 years agoremote generator, client: Handle functions that return an optional string
Matthias Bolte [Sat, 14 May 2011 13:35:27 +0000 (15:35 +0200)]
remote generator, client: Handle functions that return an optional string

13 years agoesx: Simplify some esxVI_Boolean to bool
Matthias Bolte [Sun, 1 May 2011 19:57:45 +0000 (21:57 +0200)]
esx: Simplify some esxVI_Boolean to bool

13 years agoesx: Convert autoAnswer from esxVI_Boolean to a simple bool
Matthias Bolte [Sun, 1 May 2011 19:57:44 +0000 (21:57 +0200)]
esx: Convert autoAnswer from esxVI_Boolean to a simple bool

Just true/false is good enough for it. Also use it directly from the
parsed URI instead of caching it in esxPrivate.

13 years agoesx: Fix race condition in esxVI_EnsureSession
Matthias Bolte [Sun, 1 May 2011 19:57:43 +0000 (21:57 +0200)]
esx: Fix race condition in esxVI_EnsureSession

When the session has expired then multiple threads can race while
reestablishing it.

This race condition is not that critical as it requires a special usage
pattern to be triggered. It can only happen when an application doesn't
do API calls for quite some time (the session expires after 30 min
inactivity) and then multiple threads doing simultaneous API calls and
end up doing simultaneous calls to esxVI_EnsureSession.

13 years agovirsh: Correctly initialize libvirt
Jiri Denemark [Mon, 9 May 2011 11:57:09 +0000 (13:57 +0200)]
virsh: Correctly initialize libvirt

virsh didn't call virInitialize(), which (among other things)
initializes virLastErr thread local variable. As a result of that, virsh
could just segfault in virEventRegisterDefaultImpl() since that is the
first call that touches (resets) virLastErr.

I have no idea what lucky coincidence made this bug visible but I was
able to reproduce it in 100% cases but only in one specific environment
which included building in sandbox.

13 years agoesx: Whitespace cleanup in the generator
Matthias Bolte [Sun, 1 May 2011 19:57:42 +0000 (21:57 +0200)]
esx: Whitespace cleanup in the generator

Break long lines and change spacing of keyword arguments to match
Python style standards better.

No functional change included.

13 years agoFix leak of mime type string in screenshot dispatcher
Daniel P. Berrange [Mon, 16 May 2011 17:29:19 +0000 (18:29 +0100)]
Fix leak of mime type string in screenshot dispatcher

* daemon/remote.c: Free mime string

13 years agoRemove obsolete remoteDispatchOOMError method
Daniel P. Berrange [Mon, 16 May 2011 17:27:53 +0000 (18:27 +0100)]
Remove obsolete remoteDispatchOOMError method

No new code should be using remoteDispatchOOMError()

* daemon/dispatch.c, daemon/dispatch.h: Remove remoteDispatchOOMError

13 years agoesx: Change some alignments in the input file
Matthias Bolte [Sun, 1 May 2011 09:52:33 +0000 (11:52 +0200)]
esx: Change some alignments in the input file

No functional change included.

13 years agoesx: Change generated method parameter autobinding
Matthias Bolte [Sun, 1 May 2011 09:51:19 +0000 (11:51 +0200)]
esx: Change generated method parameter autobinding

Instead of specifying the type of the managed object directly specify
the ServiceContent member name. This way the mapping dictionary can be
removed.

13 years agoFix remote dispatcher for screenshot command
Daniel P. Berrange [Mon, 16 May 2011 17:12:17 +0000 (18:12 +0100)]
Fix remote dispatcher for screenshot command

* daemon/remote.c: Update screenshot dispatcher to follow
  standard practice

13 years agovirsh: Report an error when virGetUserDirectory fails
Matthias Bolte [Sun, 15 May 2011 05:31:42 +0000 (07:31 +0200)]
virsh: Report an error when virGetUserDirectory fails

Otherwise virsh shows the interactive greeting and then silently exists
instead of entering interactive mode.

13 years agomaint: mark more perl scripts executable
Eric Blake [Mon, 16 May 2011 16:12:21 +0000 (10:12 -0600)]
maint: mark more perl scripts executable

* src/remote/rpcgen_fix.pl: Add executable bit.
* tests/oomtrace.pl: Likewise.

13 years agomaint: mark perl script executable
Eric Blake [Mon, 16 May 2011 16:09:36 +0000 (10:09 -0600)]
maint: mark perl script executable

* docs/hvsupport.pl: Add execute bit.

13 years agomaint: ignore generated file
Eric Blake [Mon, 16 May 2011 15:33:56 +0000 (09:33 -0600)]
maint: ignore generated file

* .gitignore: Ignore recently added file.

13 years agoAdd missing initialization to 'ret' in qemu migration
Daniel P. Berrange [Mon, 16 May 2011 15:10:35 +0000 (16:10 +0100)]
Add missing initialization to 'ret' in qemu migration

* src/qemu/qemu_migration.c: Add missing 'ret' initializer
  in qemuMigrationCookieXMLParseStr

13 years agoDisable virCommandExec on Win32
Daniel P. Berrange [Thu, 12 May 2011 09:33:31 +0000 (10:33 +0100)]
Disable virCommandExec on Win32

Mingw execve() has a broken signature. Disable this
function until gnulib fixes the signature, since we
don't really need this on Win32 anyway.

* src/util/command.c: Disable virCommandExec on Win32

13 years agoImprove error message when XDR marshalling fails
Daniel P. Berrange [Thu, 21 Apr 2011 15:58:41 +0000 (16:58 +0100)]
Improve error message when XDR marshalling fails

When failing to marshall an XDR message, include the
full program/version/status/proc/type info, to allow
easier debugging & diagnosis of the problem.

* src/remote/remote_driver.c: Improve error when marshalling
  fails

13 years agoRun tunnelled migration IO in separate thread
Daniel P. Berrange [Mon, 9 May 2011 15:52:42 +0000 (16:52 +0100)]
Run tunnelled migration IO in separate thread

By running the doTunnelSendAll code in a separate thread, the
main thread can do qemuMigrationWaitForCompletion as with
normal migration. This in turn ensures that job signals work
correctly and that progress monitoring can be done

* src/qemu/qemu_migration.c: Run tunnelled migration in
  separate thread

13 years agoDon't overwrite error when stream send fails
Daniel P. Berrange [Thu, 21 Apr 2011 16:24:39 +0000 (17:24 +0100)]
Don't overwrite error when stream send fails

virStreamSend already sets an error message, so don't
overwrite it

* src/qemu/qemu_migration.c: Remove bogus error report

13 years agoClose all sockets before cancelling QEMU migration
Daniel P. Berrange [Thu, 21 Apr 2011 16:23:13 +0000 (17:23 +0100)]
Close all sockets before cancelling QEMU migration

Cancelling the QEMU migration may cause QEMU to flush pending
data on the migration socket. This may in turn block QEMU if
nothing reads from the other end of the socket. Closing the
socket before cancelling QEMU migration avoids this possible
deadlock.

* src/qemu/qemu_migration.c: Close sockets before cancelling
  migration on failure

13 years agoEnsure we always read a full buffer in tunnelled migration
Daniel P. Berrange [Thu, 21 Apr 2011 16:13:56 +0000 (17:13 +0100)]
Ensure we always read a full buffer in tunnelled migration

The 'nbytes' variable was not re-initialized to the
buffer size on each iteration of the tunnelled migration
loop. While saferead() will ensure a full read, except
on EOF, it is clearer to use the real buffer size

* src/qemu/qemu_migration.c: Always read full buffer of data

13 years agoMake tunnelled migration honour resource restriction
Daniel P. Berrange [Wed, 20 Apr 2011 16:56:35 +0000 (17:56 +0100)]
Make tunnelled migration honour resource restriction

The doTunnelMigrate method forgot to set the bandwidth
resource restriction

* src/qemu/qemu_migration.c: Set resource restriction

13 years agoRefactor migration completion loop to allow code reuse
Daniel P. Berrange [Wed, 20 Apr 2011 16:33:27 +0000 (17:33 +0100)]
Refactor migration completion loop to allow code reuse

The qemuMigrationWaitForCompletion method contains a loop which
repeatedly queries QEMU to check migration progress, and also
processes job signals (pause, setspeed, setbandwidth, cancel).

The tunnelled migration loop does not currently support this
functionality, but should. Refactor the code to allow it to
be used with tunnelled migration.

13 years agoImplement migration v3 protocol in QEMU driver
Daniel P. Berrange [Thu, 3 Feb 2011 11:09:28 +0000 (11:09 +0000)]
Implement migration v3 protocol in QEMU driver

Implement the v3 migration protocol, which has two extra
steps, 'begin' on the source host and 'confirm' on the
source host. All other methods also gain both input and
output cookies to allow bi-directional data passing at
all stages.

The QEMU peer2peer migration method gains another impl
to provide the v3 migration. This finally allows migration
cookies to work with tunnelled migration, which is required
for Spice seamless migration & the lock manager transfer

* src/qemu/qemu_driver.c: Wire up migrate v3 APIs
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
  begin & confirm methods, and peer2peer impl of v3

13 years agoMerge tunnel & non-tunnel migration impl into one
Daniel P. Berrange [Wed, 20 Apr 2011 12:48:58 +0000 (13:48 +0100)]
Merge tunnel & non-tunnel migration impl into one

Merge the doNonTunnelMigrate2 and doTunnelMigrate2 methods
into one doPeer2PeerMigrate2 method, since they are substantially
the same. With the introduction of v3 migration, this will be
even more important, to avoid massive code duplication.

* src/qemu/qemu_migration.c: Merge tunnel & non-tunnel migration

13 years agoFix VM teardown if prepare returns invalid URI in v2 migration
Daniel P. Berrange [Wed, 20 Apr 2011 12:48:11 +0000 (13:48 +0100)]
Fix VM teardown if prepare returns invalid URI in v2 migration

The v2 migration protocol was accidentally missing out the
finish step, when prepare succeeded, but returned an invalid
URI

* src/libvirt.c: Teardown VM if prepare returns invalid URI

13 years agoRefactor tunnelled migration methods
Daniel P. Berrange [Wed, 20 Apr 2011 12:12:43 +0000 (13:12 +0100)]
Refactor tunnelled migration methods

To facilitate the introduction of the v3 migration protocol,
the doTunnelMigrate method is refactored into two pieces. One
piece is intended to mirror the flow of virDomainMigrateVersion2,
while the other is the helper for setting up sockets and processing
the data.

Previously socket setup would be done before the 'prepare' step,
so errors could be dealt with immediately, avoiding need to shut
off the destination QEMU. In the new split, socket setup is done
after the 'prepare' step. This is not a serious problem, since
the control flow already requires calling 'finish' to tear down
the destination QEMU upon several errors.

* src/qemu/qemu_migration.c:

13 years agoWire up SPICE client relocation with QEMU migration
Daniel P. Berrange [Thu, 17 Feb 2011 13:39:36 +0000 (13:39 +0000)]
Wire up SPICE client relocation with QEMU migration

Use the graphics information from the QEMU migration cookie to
issue a 'client_migrate_info' monitor command to QEMU. This causes
the SPICE client to automatically reconnect to the target host
when migration completes

* src/qemu/qemu_migration.c: Set data for SPICE client relocation
  before starting migration on src
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  new qemuMonitorGraphicsRelocate() command

13 years agoPass graphics setup from dst back to src via migration cookies
Daniel P. Berrange [Thu, 17 Feb 2011 13:17:59 +0000 (13:17 +0000)]
Pass graphics setup from dst back to src via migration cookies

Extend the QEMU migration cookie structure to allow information
about the destination host graphics setup to be passed by to
the source host. This will enable seamless migration of any
connected graphics clients

* src/qemu/qemu_migration.c: Add graphics info to migration
  cookies
* daemon/libvirtd.c: Always initialize gnutls to enable
  x509 cert parsing in QEMU

13 years agoIntroduce migration cookies to QEMU driver
Daniel P. Berrange [Mon, 24 Jan 2011 18:06:16 +0000 (18:06 +0000)]
Introduce migration cookies to QEMU driver

The migration protocol has support for a 'cookie' parameter which
is an opaque array of bytes as far as libvirt is concerned. Drivers
may use this for passing around arbitrary extra data they might
need during migration. The QEMU driver needs to do a few things:

 - Pass hostname/uuid to allow strict protection against localhost
   migration attempts
 - Pass SPICE/VNC server port from the target back to the source to
   allow seamless relocation of client sessions
 - Pass lock driver state from source to destination

This patch introduces the basic glue for handling cookies
but only includes the host/guest UUID & name.

* src/libvirt_private.syms: Export virXMLParseStrHelper
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Parsing
  and formatting of migration cookies
* src/qemu/qemu_driver.c: Pass in cookie parameters where possible
* src/remote/remote_protocol.h, src/remote/remote_protocol.x: Change
  cookie max length to 16384 bytes

13 years agoFix locking with qemuMigrationPrepareTunnel method
Daniel P. Berrange [Mon, 16 May 2011 14:17:15 +0000 (15:17 +0100)]
Fix locking with qemuMigrationPrepareTunnel method

The qemuMigrationPrepareTunnel method should not unlock the
qemu driver, since that is the caller's job.

* src/qemu/qemu_migration.c: Fix qemuMigrationPrepareTunnel
  unlocking of QEMU driver

13 years agoRemote driver implementation of new migration API
Daniel P. Berrange [Tue, 1 Feb 2011 14:23:40 +0000 (14:23 +0000)]
Remote driver implementation of new migration API

* src/remote/remote_protocol.x: Define wire protocol for migration
  protocol v3
* daemon/remote.c: Server side dispatch
* src/remote/remote_driver.c: Client side serialization
* src/remote/remote_protocol.c, src/remote/remote_protocol.h,
  daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h:
  Re-generate files
* src/remote_protocol-structs: Declare new ABIs

13 years agoIntroduce yet another migration version in API.
Daniel P. Berrange [Tue, 2 Nov 2010 12:43:44 +0000 (12:43 +0000)]
Introduce yet another migration version in API.

Migration just seems to go from bad to worse. We already had to
introduce a second migration protocol when adding the QEMU driver,
since the one from Xen was insufficiently flexible to cope with
passing the data the QEMU driver required.

It turns out that this protocol still has some flaws that we
need to address. The current sequence is

 *  Src: DumpXML
          - Generate XML to pass to dst

 *  Dst: Prepare
          - Get ready to accept incoming VM
          - Generate optional cookie to pass to src

 *  Src: Perform
          - Start migration and wait for send completion
          - Kill off VM if successful, resume if failed

 *  Dst: Finish
          - Wait for recv completion and check status
          - Kill off VM if unsuccessful

The problems with this are:

 - Since the first step is a generic 'DumpXML' call, we can't
   add in other migration specific data. eg, we can't include
   any VM lease data from lock manager plugins
 - Since the first step is a generic 'DumpXML' call, we can't
   emit any 'migration begin' event on the source, or have
   any hook that runs right at the start of the process
 - Since there is no final step on the source, if the Finish
   method fails to receive all migration data & has to kill
   the VM, then there's no way to resume the original VM
   on the source

This patch attempts to introduce a version 3 that uses the
improved 5 step sequence

 *  Src: Begin
          - Generate XML to pass to dst
          - Generate optional cookie to pass to dst

 *  Dst: Prepare
          - Get ready to accept incoming VM
          - Generate optional cookie to pass to src

 *  Src: Perform
          - Start migration and wait for send completion
          - Generate optional cookie to pass to dst

 *  Dst: Finish
          - Wait for recv completion and check status
          - Kill off VM if failed, resume if success
          - Generate optional cookie to pass to src

 *  Src: Confirm
          - Kill off VM if success, resume if failed

The API is designed to allow both input and output cookies
in all methods where applicable. This lets us pass around
arbitrary extra driver specific data between src & dst during
migration. Combined with the extra 'Begin' method this lets
us pass lease information from source to dst at the start of
migration

Moving the killing of the source VM out of Perform and
into Confirm, means we can now recover if the dst host
can't successfully Finish receiving migration data.

13 years agoAutomatically generate the hvsupport.html.in file from source files
Daniel P. Berrange [Fri, 13 May 2011 10:00:56 +0000 (11:00 +0100)]
Automatically generate the hvsupport.html.in file from source files

The hvsupport.html.in file is forever out of date. By annotating
the driver struct tables in each driver with version information,
we can auto-generate the hvsupport.html.in file. Annotating the
drivers will be mandatory for new patches, ensuring hvsupport.html.in
is never out of date again.

* docs/hvsupport.html.in: Delete
* hvsupport.pl: Script to generate hvsupport.html.in
* Makefile.am: Autogenerate hvsupport.html.in

13 years agoAdd many version number annotations to drivers
Daniel P. Berrange [Fri, 13 May 2011 13:35:01 +0000 (14:35 +0100)]
Add many version number annotations to drivers

Add many version number annotations to the internal driver
tables, to allow hvsupport.html to display more accurate
information

13 years agoConvert all driver struct intializers to C99 style
Daniel P. Berrange [Fri, 13 May 2011 10:16:31 +0000 (11:16 +0100)]
Convert all driver struct intializers to C99 style

Change all the driver struct initializers to use the
C99 style, leaving out unused fields. This will make
it possible to add new APIs without changing every
driver. eg change:

    qemudDomainResume, /* domainResume */
    qemudDomainShutdown, /* domainShutdown */
    NULL, /* domainReboot */
    qemudDomainDestroy, /* domainDestroy */

to

    .domainResume = qemudDomainResume,
    .domainShutdown = qemudDomainShutdown,
    .domainDestroy = qemudDomainDestroy,

And get rid of any existing C99 style initializersr which
set NULL, eg change

     .listPools          = vboxStorageListPools,
     .numOfDefinedPools  = NULL,
     .listDefinedPools   = NULL,
     .findPoolSources    = NULL,
     .poolLookupByName   = vboxStoragePoolLookupByName,

to

     .listPools          = vboxStorageListPools,
     .poolLookupByName   = vboxStoragePoolLookupByName,

13 years agoTweak driver naming for consistency with public API
Daniel P. Berrange [Wed, 11 May 2011 17:01:23 +0000 (18:01 +0100)]
Tweak driver naming for consistency with public API

Fix some driver names:

  s/virDrvCPUCompare/virDrvCompareCPU/
  s/virDrvCPUBaseline/virDrvBaselineCPU/
  s/virDrvQemuDomainMonitorCommand/virDrvDomainQemuMonitorCommand/
  s/virDrvSecretNumOfSecrets/virDrvNumOfSecrets/
  s/virDrvSecretListSecrets/virDrvListSecrets/

And some driver struct field names:

  s/getFreeMemory/nodeGetFreeMemory/

13 years agoqemu: Update domain state when reconnecting monitor
Jiri Denemark [Thu, 5 May 2011 11:50:25 +0000 (13:50 +0200)]
qemu: Update domain state when reconnecting monitor

A qemu domain can get paused when libvirtd is stopped (e.g., because of
I/O error) so we should check its current state when reconnecting to it.

13 years agoImplement domain state reason
Jiri Denemark [Wed, 4 May 2011 09:07:01 +0000 (11:07 +0200)]
Implement domain state reason

Only in drivers which use virDomainObj, drivers that query hypervisor
for domain status need to be updated separately in case their hypervisor
supports this functionality.

The reason is also saved into domain state XML so if a domain is not
running (i.e., no state XML exists) the reason will be lost by libvirtd
restart. I think this is an acceptable limitation.

13 years agoImplement basic virDomainGetState in all drivers
Jiri Denemark [Mon, 2 May 2011 09:35:29 +0000 (11:35 +0200)]
Implement basic virDomainGetState in all drivers

Reason is currently always set to 0 (i.e., *_UNKNOWN).

13 years agovirsh: Prefer virDomainGetState over virDomainGetInfo
Jiri Denemark [Fri, 29 Apr 2011 08:20:49 +0000 (10:20 +0200)]
virsh: Prefer virDomainGetState over virDomainGetInfo

13 years agoWire protocol format and remote driver for virDomainGetState
Jiri Denemark [Tue, 26 Apr 2011 14:47:22 +0000 (16:47 +0200)]
Wire protocol format and remote driver for virDomainGetState

13 years agovirDomainGetState public API implementation
Jiri Denemark [Tue, 26 Apr 2011 10:26:36 +0000 (12:26 +0200)]
virDomainGetState public API implementation

13 years agoInternal driver API for virDomainGetState
Jiri Denemark [Fri, 22 Apr 2011 11:49:01 +0000 (13:49 +0200)]
Internal driver API for virDomainGetState

13 years agovirDomainGetState public API
Jiri Denemark [Fri, 22 Apr 2011 11:31:35 +0000 (13:31 +0200)]
virDomainGetState public API

This API is supposed to replace virDomainGetInfo when the only purpose
of calling it is getting current domain status.

13 years agophyp: avoid a crash
Eric Blake [Thu, 12 May 2011 02:00:35 +0000 (20:00 -0600)]
phyp: avoid a crash

This has been present since the introduction of phypAttachDevice
in commit 444fd07a.

* src/phyp/phyp_driver.c (phypAttachDevice): Don't dereference
NULL.

14 years agostream: avoid use-after-free
Eric Blake [Fri, 13 May 2011 19:32:00 +0000 (13:32 -0600)]
stream: avoid use-after-free

virFDStreamClose used a mutex after it was freed, and failed
to destroy that mutex on its last use.

* src/fdstream.c (virFDStreamFree): Inline into sole caller...
(virFDStreamClose): ...to avoid use-after-free and leak.
Reported by Matthias Bolte.

14 years agoesx: Refactor common code in the generator
Matthias Bolte [Sun, 1 May 2011 09:29:40 +0000 (11:29 +0200)]
esx: Refactor common code in the generator

Move common code from Property and Parameter into new Member class.

Rename the other base class to Type.

14 years agoesx: Improve dynamic cast detection in the generator
Matthias Bolte [Sun, 1 May 2011 09:08:21 +0000 (11:08 +0200)]
esx: Improve dynamic cast detection in the generator

Detect it based on usage as parameter, return type and member of other
object types.

14 years agoesx: Improve list usage detection in the generator
Matthias Bolte [Sun, 1 May 2011 09:31:55 +0000 (11:31 +0200)]
esx: Improve list usage detection in the generator

Detect it based on usage as parameter and return type too.

14 years agoesx: Remove 1000 lines of generated but unused code
Matthias Bolte [Sun, 1 May 2011 08:43:17 +0000 (10:43 +0200)]
esx: Remove 1000 lines of generated but unused code

Don't make all object and enum types (de)serializable by default.
Detect this from the input file instead.

14 years agoesx: Generate implicit _this macros
Matthias Bolte [Sun, 1 May 2011 06:05:58 +0000 (08:05 +0200)]
esx: Generate implicit _this macros

Several vSphere API methods are called on global objects like the
FileManager, the PerformanceManager or the SearchIndex. The generator
input file allows to mark such methods and the generator generates
such method in a way that automatically handles marked parameter. This
is done by some special macros. Those were manually written and this
patch moves them to the generator.

14 years agoesx: Move the Event type from the VI generator to manually written code
Matthias Bolte [Sat, 16 Apr 2011 11:54:39 +0000 (13:54 +0200)]
esx: Move the Event type from the VI generator to manually written code

Accept all types on deserialization in order to accept all Event subtypes.

This will be used for the upcoming domain event support.

14 years agotest: all test_scripts should be part of tarball when building without libvirtd
Wen Congyang [Fri, 13 May 2011 08:03:20 +0000 (16:03 +0800)]
test: all test_scripts should be part of tarball when building without libvirtd

Steps to reproduce this problem:
1. # ./autogen.sh --without-libvirtd
2. # make dist
3. # rpmbuild --nodeps --define "_sourcedir `pwd`" -ba libvirt.spec
   ...
   make  check-TESTS
   make[1]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.1/tests'
   make[1]: *** No rule to make target `test_conf.sh', needed by `check-TESTS'.  Stop.
   make[1]: Leaving directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.1/tests'
   make: *** [check-am] Error 2
   error: Bad exit status from /var/tmp/rpm-tmp.7Rb9PV (%check)

14 years agobuild: probes.d and libvirtd.stp should be part of tarball
Wen Congyang [Fri, 13 May 2011 08:02:50 +0000 (16:02 +0800)]
build: probes.d and libvirtd.stp should be part of tarball

Steps to reproduce this problem:
1. # ./autogen.sh --without-libvirtd
2. # make dist
3. # rpmbuild --nodeps --define "_sourcedir `pwd`" -ba libvirt.spec
   ...
   make[2]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.1/daemon'
   make[2]: *** No rule to make target `probes.d', needed by `probes.h'.  Stop.
   make[2]: Leaving directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.1/daemon'
   make[1]: *** [all-recursive] Error 1
   make[1]: Leaving directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.1'
   make: *** [all] Error 2
   error: Bad exit status from /var/tmp/rpm-tmp.WkAD7a (%build)

14 years agocommand: Fix compilation on FreeBSD
Matthias Bolte [Fri, 13 May 2011 04:49:07 +0000 (06:49 +0200)]
command: Fix compilation on FreeBSD

kill, SIGTERM and SIGKILL require additional header.

14 years agovirsh: Fix uninitialized variable warning
Matthias Bolte [Fri, 13 May 2011 06:27:59 +0000 (08:27 +0200)]
virsh: Fix uninitialized variable warning

Reported on FreeBSD only.

14 years agoapparmor: Fix compilation by removing remains from virCommand conversion
Matthias Bolte [Sat, 14 May 2011 04:51:32 +0000 (06:51 +0200)]
apparmor: Fix compilation by removing remains from virCommand conversion

Commit aaf20355b87d3bfda7579a7f6a4a978e848635c3 was incomplete here and
missed to remove some parts.

14 years agoconfigure: Fix mpath check on non-Linux systems
Matthias Bolte [Fri, 13 May 2011 04:47:50 +0000 (06:47 +0200)]
configure: Fix mpath check on non-Linux systems

14 years agoremote: Convert SSH tunnel to virCommand
Cole Robinson [Fri, 6 May 2011 20:32:37 +0000 (16:32 -0400)]
remote: Convert SSH tunnel to virCommand

14 years agostorage: Convert qemu-img -help parsing to virCommand
Cole Robinson [Fri, 6 May 2011 19:25:52 +0000 (15:25 -0400)]
storage: Convert qemu-img -help parsing to virCommand

14 years agoapparmor: Convert virExec usage to virCommand
Cole Robinson [Fri, 6 May 2011 18:48:26 +0000 (14:48 -0400)]
apparmor: Convert virExec usage to virCommand

Untested

14 years agoutil: Combine __virExec and virExecWithHook
Cole Robinson [Fri, 6 May 2011 17:41:44 +0000 (13:41 -0400)]
util: Combine __virExec and virExecWithHook

All callers were expecting argv logging, so the split is unneeded.

v2:
    Reindent new virExecWithHook call

14 years agoremote_driver: Convert virExecDaemonize usage to virCommand
Cole Robinson [Fri, 6 May 2011 15:23:57 +0000 (11:23 -0400)]
remote_driver: Convert virExecDaemonize usage to virCommand

And drop the now unused virExecDaemonize

14 years agoremote: keep 'make check' happy
Eric Blake [Fri, 13 May 2011 17:22:52 +0000 (11:22 -0600)]
remote: keep 'make check' happy

* src/remote_protocol-structs (remote_domain_screenshot_args): Use
spelling preferred by dwarves.

14 years agolibxl: fix typos in previous patch
Eric Blake [Fri, 13 May 2011 17:21:59 +0000 (11:21 -0600)]
libxl: fix typos in previous patch

* src/libxl/libxl_driver.c (libxlDomainEventFlush, libxlShutdown)
(libxlStartup): Fix typos.

14 years agoremote: Use virDomainEventState helpers
Cole Robinson [Fri, 13 May 2011 15:00:10 +0000 (11:00 -0400)]
remote: Use virDomainEventState helpers

One functionality change here is that we no longer force enable the event
timeout for every queued event, only enable it for the first event after
the queue has been flushed. This is how other drivers have already done it,
and I haven't encountered problems in practice.

v3:
    Adjust for new virDomainEventStateNew argument

14 years agolibxl: Convert to virDomainEventState
Cole Robinson [Thu, 12 May 2011 14:47:08 +0000 (10:47 -0400)]
libxl: Convert to virDomainEventState

14 years agotest: Use virDomainEventState helpers
Cole Robinson [Thu, 12 May 2011 12:58:44 +0000 (08:58 -0400)]
test: Use virDomainEventState helpers

v3:
    Adjust for new virDomainEventStateNew argument

14 years agolxc: Use virDomainEventState helpers
Cole Robinson [Thu, 6 Jan 2011 17:42:12 +0000 (12:42 -0500)]
lxc: Use virDomainEventState helpers

v3:
    Adjust for new virDomainEventStateNew argument

14 years agoqemu: Use virDomainEventState helpers
Cole Robinson [Thu, 12 May 2011 12:54:07 +0000 (08:54 -0400)]
qemu: Use virDomainEventState helpers

v2:
    Drop libvirt_private.syms changes

v3:
    Adjust for new virDomainEventStateNew argument

14 years agodomain_event: Add common domain event queue/flush helpers
Cole Robinson [Wed, 5 Jan 2011 22:51:45 +0000 (17:51 -0500)]
domain_event: Add common domain event queue/flush helpers

The same code for queueing, flushing, and deregistering events exists
in multiple drivers, which will soon use these common functions.

v2:
    Adjust libvirt_private.syms
    isDispatching bool fixes
    NONNULL tagging

v3:
    Add requireTimer parameter to virDomainEventStateNew

14 years agodomain_event: Add virDomainEventState structure
Cole Robinson [Wed, 5 Jan 2011 22:27:40 +0000 (17:27 -0500)]
domain_event: Add virDomainEventState structure

This structure will be used to unify lots of duplicated event handling code
across the state drivers.

v2:
    Check for state == NULL in StateFree
    Add NONNULL tagging
    Use bool for isDispatching

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agoxml: Use virXMLParse* helpers everywhere
Cole Robinson [Thu, 12 May 2011 21:20:47 +0000 (17:20 -0400)]
xml: Use virXMLParse* helpers everywhere

virt-aa-helper isn't even compile tested since I don't have the setup for
it.

v2:
    virt-aa-helper fixes from Eric

14 years agodomain: Require <init> for container guests
Cole Robinson [Thu, 12 May 2011 20:12:05 +0000 (16:12 -0400)]
domain: Require <init> for container guests

Use capabilities to allow a driver to register a default <init> if none
is specified in the XML. Openvz was already open-coding this to be /sbin/init

LXC currently falls over if no init is specified, so an explicit error is
an improvement IMO.

(Side note: I don't think we can set a default value for LXC. If we use
/sbin/init but the user doesn't specify a separate root FS for their guest,
the container will rerun the host's init which can be traumatic :). For
virt-install I'm thinking of defaulting to /sbin/init if a root FS has
been specified, otherwise require the user to manually specify <init>)

14 years agoxml: Make sure virXpathNodeSet always sets an error
Cole Robinson [Thu, 12 May 2011 19:45:22 +0000 (15:45 -0400)]
xml: Make sure virXpathNodeSet always sets an error

And update callers to actually respect the error

14 years agovbox: Implement the driver methods
Michal Privoznik [Fri, 1 Apr 2011 13:34:23 +0000 (15:34 +0200)]
vbox: Implement the driver methods

* src/vbox/vbox_tmpl.c: New vboxDomainScreenshot() function

14 years agoqemu: Implement the driver methods
Michal Privoznik [Fri, 1 Apr 2011 06:23:58 +0000 (08:23 +0200)]
qemu: Implement the driver methods

* src/qemu/qemu_driver.c: new qemuDomainScreenshot() function
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Monitor command

14 years agovirFDStream: Add option for delete file after it's opening
Michal Privoznik [Tue, 5 Apr 2011 10:27:35 +0000 (12:27 +0200)]
virFDStream: Add option for delete file after it's opening

This is needed if we want to transfer a temporary file. If the
transfer is done with iohelper, we might run into a race condition,
where we unlink() file before iohelper is executed.

* src/fdstream.c, src/fdstream.h,
  src/util/iohelper.c: Add new option
* src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
  src/storage/storage_driver.c, src/uml/uml_driver.c,
  src/xen/xen_driver.c: Expand existing function calls

14 years agoscreenshot: Implementing the remote protocol
Michal Privoznik [Mon, 4 Apr 2011 13:54:48 +0000 (15:54 +0200)]
screenshot: Implementing the remote protocol

* src/remote/remote_protocol.x: Wire protocol definition
* daemon/remote.c: Daemon part
* src/remote/remote_driver.c: Client part
* src/remote_protocol-structs: Add structures

14 years agoscreenshot: Implementing the public API
Michal Privoznik [Mon, 4 Apr 2011 12:07:43 +0000 (14:07 +0200)]
screenshot: Implementing the public API

* src/libvirt.c: new function virDomainScreenshot

14 years agoscreenshot: Defining the internal API
Michal Privoznik [Mon, 4 Apr 2011 10:35:45 +0000 (12:35 +0200)]
screenshot: Defining the internal API

* src/driver.h: Stub code for new API
* src/esx/esx_driver.c, src/libxl/libxl_driver.c,
  src/lxc/lxc_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  rc/remote/remote_driver.c, rc/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/vmware/vmware_driver.c, src/xen/xen_driver.c,
  src/xen/xen_driver.h, src/xen/xen_hypervisor.c,
  src/xen/xen_inotify.c, src/xen/xend_internal.c,
  src/xen/xm_internal.c, src/xen/xs_internal.c,
  src/xenapi/xenapi_driver.c: Add dummy entries in driver
  table for new APIs

14 years agoscreenshot: Defining the public API
Michal Privoznik [Mon, 4 Apr 2011 09:58:53 +0000 (11:58 +0200)]
screenshot: Defining the public API

Add public API for taking screenshots of current domain console.

* include/libvirt/libvirt.h.in: add virDomainScreenshot
* src/libvirt_public.syms: Export new symbol

14 years agobuild: avoid compiler warning during configure
Wen Congyang [Thu, 12 May 2011 09:55:43 +0000 (17:55 +0800)]
build: avoid compiler warning during configure

There is no need to redefine _GNU_SOURCE in tests that occur after
gl_INIT, since that macro already AC_DEFINE'd it for us.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agodocs: Fix documentation for cputune parameters
Osier Yang [Thu, 12 May 2011 10:48:23 +0000 (18:48 +0800)]
docs: Fix documentation for cputune parameters

This re-adds the example section originally written by Osier Yang,
and indicates the version in which the cputune parameters became
available in libvirt.

Signed-off-by: Igor Serebryany <igor47@moomers.org>
14 years agoremote generator: Add skipgen/autogen flags to .x files
Matthias Bolte [Wed, 11 May 2011 19:28:39 +0000 (21:28 +0200)]
remote generator: Add skipgen/autogen flags to .x files

Make procedure parsing more robust, by allowing arbitrary
amounts of whitespaces.

Also make some error messages more verbose.

14 years agonwfilter: drop unused flag argument
Eric Blake [Wed, 11 May 2011 22:30:36 +0000 (16:30 -0600)]
nwfilter: drop unused flag argument

The public API and RPC over-the-wire format have no flags argument,
so neither should the internal callback API.  This simplifies the
RPC generator.

* src/driver.h (virDrvNWFilterDefineXML): Drop argument that does
not match public API.
* src/nwfilter/nwfilter_driver.c (nwfilterDefine): Likewise.
* src/libvirt.c (virNWFilterDefineXML): Likewise.
* daemon/remote_generator.pl: Drop special case.

14 years agomaint: omit translation for all VIR_INFO
Eric Blake [Wed, 11 May 2011 15:08:44 +0000 (09:08 -0600)]
maint: omit translation for all VIR_INFO

We were 31/73 on whether to translate; since less than 50% translated
and since VIR_INFO is less than VIR_WARN which also doesn't translate,
this makes sense.

* cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
falls between WARN and DEBUG.
* daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
(qemudDispatchServer): Adjust offenders.
* daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
* src/network/bridge_driver.c (networkReloadIptablesRules)
(networkStartNetworkDaemon, networkShutdownNetworkDaemon)
(networkCreate, networkDefine, networkUndefine): Likewise.
* src/qemu/qemu_driver.c (qemudDomainDefine)
(qemudDomainUndefine): Likewise.
* src/storage/storage_driver.c (storagePoolCreate)
(storagePoolDefine, storagePoolUndefine, storagePoolStart)
(storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
(storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
* src/util/bridge.c (brProbeVnetHdr): Likewise.
* po/POTFILES.in: Drop src/util/bridge.c.

14 years agobuild: wrap macro body in one-shot do-while loop
Eric Blake [Wed, 11 May 2011 21:14:05 +0000 (15:14 -0600)]
build: wrap macro body in one-shot do-while loop

* src/libvirt.c (VIR_DOMAIN_DEBUG_1): Convert to single statement.
Suggested by Jiri Denemark.

14 years agobuild: drop need for VIR_DOMAIN_DEBUG0()
Eric Blake [Wed, 11 May 2011 20:04:00 +0000 (14:04 -0600)]
build: drop need for VIR_DOMAIN_DEBUG0()

This one's tricker than the VIR_DEBUG0() removal, but the end
result is still C99 compliant, and reasonable with enough comments.

* src/libvirt.c (VIR_ARG10, VIR_HAS_COMMA)
(VIR_DOMAIN_DEBUG_EXPAND, VIR_DOMAIN_DEBUG_PASTE): New macros.
(VIR_DOMAIN_DEBUG): Rewrite to handle one argument, moving
multi-argument guts to...
(VIR_DOMAIN_DEBUG_1): New macro.
(VIR_DOMAIN_DEBUG0): Rename to VIR_DOMAIN_DEBUG_0.

14 years agofix xdr detection and use with recent glibc
Christophe Fergeau [Tue, 10 May 2011 15:42:06 +0000 (17:42 +0200)]
fix xdr detection and use with recent glibc

glibc 2.13.90 has obsoleted its rpc implementation in favour of
the one provided by the TI-RPC library:

> * The RPC implementation in libc is obsoleted.  Old programs keep working
>   but new programs cannot be linked with the routines in libc anymore.
>   Programs in need of RPC functionality must be linked against TI-RPC.
>   The TI-RPC implemtation is IPv6 enabled and there are other benefits.
>
>   Visible changes of this change include (obviously) the inability to
>   link
>   programs using RPC functions without referencing the TI-RPC library,
>   the
>   removal of the RPC headers from the glibc headers, and the lack of
>   symbols defined in <rpc/netdb.h> when <netdb.h> is installed.
>   Implemented by Ulrich Drepper.
(from glibc NEWS)

Thus with recent glibc, we need to try linking with -ltirpc when looking
for the XDR functions. The daemon also needs to use XDR_CFLAGS to be able
to find the XDR headers stored in /usr/include/tirpc.

When using TI-RPC, there are some warnings about redundant declarations, but
the fix probably belongs in other modules:

/usr/include/tirpc/rpc/rpcent.h:68:13: warning: redundant redeclaration of
'setrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:53:13: note: previous declaration of 'setrpcent'
was here

/usr/include/tirpc/rpc/rpcent.h:69:13: warning: redundant redeclaration of
'endrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:54:13: note: previous declaration of 'endrpcent'
was here

/usr/include/tirpc/rpc/rpc.h:84:12: warning: redundant redeclaration of
'bindresvport' [-Wredundant-decls]
/usr/include/netinet/in.h:440:12: note: previous declaration of
'bindresvport' was here

14 years agobuild: avoid gcc preprocessor extensions
Eric Blake [Wed, 11 May 2011 19:24:50 +0000 (13:24 -0600)]
build: avoid gcc preprocessor extensions

Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by
C99; thankfully, we can avoid it by lumping the format argument
into the var-args set.

* src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT)
(VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick
to C99 var-arg macro syntax.
* examples/domain-events/events-c/event-test.c (VIR_DEBUG):
Simplify.

14 years agolibvirt,logging: cleanup VIR_XXX0()
Lai Jiangshan [Mon, 9 May 2011 09:24:09 +0000 (17:24 +0800)]
libvirt,logging: cleanup VIR_XXX0()

These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.

How do these coversions works? The magic is using the gcc extension of ##.
When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
avoid compile error.

example: origin after CPP
high_level_api("%d", a_int) low_level_api("%d", a_int)
high_level_api("a  string") low_level_api("a  string")

About 400 conversions.

8 special conversions:
VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
  (for security) 6 conversions

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
14 years agomaint: avoid a couple of gnulib regressions
Eric Blake [Tue, 10 May 2011 21:54:58 +0000 (15:54 -0600)]
maint: avoid a couple of gnulib regressions

Double-close regression in upstream gnulib fclose was introduced
to libvirt in commit 9d8e01a1d.

Meanwhile, adding rpcgen as a bootstrap prerequisite in commit
fb1e8d9c prevented RHEL 5 from running bootstrap.

* .gnulib: Update to latest, for fclose and bootstrap fixes.
* bootstrap: Synchronize from upstream.

14 years agonode_device: avoid null dereference on error
Eric Blake [Wed, 4 May 2011 23:03:52 +0000 (17:03 -0600)]
node_device: avoid null dereference on error

If we plow on after udev_device_get_syspath fails, we will hit a NULL
dereference.  Clang found one due to strdup later in udevSetParent,
but in fact we hit a NULL dereference sooner because of the use of
STREQ within virNodeDeviceFindBySysfsPath.

* src/conf/node_device_conf.h (virNodeDeviceFindBySysfsPath): Mark
path argument non-null.
* src/node_device/node_device_udev.c (udevSetParent): Avoid null
dereference.