libvirt-python/ericb.git
11 years agoUse python discovered through env instead of hardcoding a pathlibvirt-0.8.7-10.el6libvirt-0.8.7-11.el6libvirt-0.8.7-5.el6libvirt-0.8.7-6.el6libvirt-0.8.7-7.el6libvirt-0.8.7-8.el6libvirt-0.8.7-9.el6v0.8.6v0.8.7
Matthias Bolte [Sat, 13 Nov 2010 15:34:57 +0000 (13 16:34 +0100)]
Use python discovered through env instead of hardcoding a path

This is more flexible regarding the location of the python binary
but doesn't allow to pass the -u flag. The -i flag can be passed
from inside the script using the PYTHONINSPECT env variable.

This fixes a problem with the esx_vi_generator.py on FreeBSD.

11 years agoFix several minor problems introduced by the memtune seriesv0.8.5
Matthias Bolte [Tue, 12 Oct 2010 19:24:11 +0000 (12 21:24 +0200)]
Fix several minor problems introduced by the memtune series

Add proper documentation to the new VIR_DOMAIN_MEMORY_* macros in
libvirt.h.in to placate apibuild.py.

Mark args as unused in for libvirt_virDomain{Get,Set}MemoryParameters
in the Python bindings and add both to the libvirtMethods array.

Update remote_protocol-structs to placate make syntax-check.

Undo unintended modifications in vboxDomainGetInfo.

Update the function table of the VirtualBox and XenAPI drivers.

11 years agoAdding structure and defines for virDomainSet/GetMemoryParameters
Nikunj A. Dadhania [Tue, 12 Oct 2010 13:43:27 +0000 (12 15:43 +0200)]
Adding structure and defines for virDomainSet/GetMemoryParameters

This patch adds a structure virMemoryParameter, it contains the name of
the
parameter and the type of the parameter along with a union.

dv:
+ rename enums to VIR_DOMAIN_MEMORY_PARAM_*
+ remove some extraneous tabs

v4:
+ Add unsigned int flags to the public api for future extensions

v3:
+ Protoype for virDomainGetMemoryParameters and dummy python binding.

v2:
+ Includes dummy python bindings for the library to build cleanly.
+ Define string constants like "hard_limit", etc.
+ re-order this patch.

11 years agopython: drop unnecessary conn assignment
Dan Kenigsberg [Mon, 27 Sep 2010 08:58:28 +0000 (27 10:58 +0200)]
python: drop unnecessary conn assignment

Since 554d82a200289938d5639a782a9f12e3e2e968f0, conn is unused. Let's
drop it - but keep the signature of the constructor for backward
compatibility.

12 years agoFix SEGV on exit after domainEventDeregister()v0.8.3v0.8.4
Philipp Hahn [Tue, 13 Jul 2010 08:54:26 +0000 (13 10:54 +0200)]
Fix SEGV on exit after domainEventDeregister()

When the last callback is removed using domainEventDeregister(), the
events dispatcher is deregistered from the C-library, but
domainEventsCallbacks is still an empty list.
On shutdown __del__() deregisters the dispatacher again, which SEGVs

# You need the event-loop implementation from the Python examples;
# give the file a name which is importable by Python.
ln examples/domain-events/events-python/event-test.py eloop.py
python -c 'from eloop import *
import sys

def dump(*args): print " ".join(map(str, args))

virEventLoopPureStart()
c = libvirt.open("xen:///")
c.domainEventRegister(dump, None)
c.domainEventDeregister(dump)
sys.exit(0)'

domainEventDeregister() needs to delete domainEventCallbacks so subsequent
calls to __del__() and domainEventRegister() choose the right code paths.
Setting it to None is not enough, since calling domainEventRegiser() again
would trigger an TypeError.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agopython: Fix IOErrorReasonCallback bindings
Cole Robinson [Tue, 13 Jul 2010 22:07:19 +0000 (13 18:07 -0400)]
python: Fix IOErrorReasonCallback bindings

A copy and paste error was causing us to dispatch the incorrect
routine. Spotted by Dan Kenigsberg.

12 years agoEnsure we return the callback ID in python events binding
Daniel P. Berrange [Thu, 8 Jul 2010 10:30:47 +0000 (8 11:30 +0100)]
Ensure we return the callback ID in python events binding

A missing return statement in the python binding meant that
the callers could not get the callback ID, and thus not be
able to unregister event callbacks

* python/libvirt-override-virConnect.py: Add missing return
  statement

12 years agoAdd missing parameter in python Disk IO error callbackRHEL-5.6git-init-libvirtlibvirt-0.8.2-1.el5libvirt-0.8.2-10.el5libvirt-0.8.2-11.el5libvirt-0.8.2-12.el5libvirt-0.8.2-13.el5libvirt-0.8.2-14.el5libvirt-0.8.2-15.el5libvirt-0.8.2-15.el5_6.1libvirt-0.8.2-15.el5_6.3libvirt-0.8.2-15.el5_6.4libvirt-0.8.2-15.el5_6.5libvirt-0.8.2-16.el5libvirt-0.8.2-17.el5libvirt-0.8.2-18.el5libvirt-0.8.2-19.el5libvirt-0.8.2-2.el5libvirt-0.8.2-20.el5libvirt-0.8.2-21.el5libvirt-0.8.2-22.el5libvirt-0.8.2-23.el5libvirt-0.8.2-24.el5libvirt-0.8.2-25.el5libvirt-0.8.2-26.el5libvirt-0.8.2-27.el5libvirt-0.8.2-28.el5libvirt-0.8.2-29.el5libvirt-0.8.2-29.el5_9.1libvirt-0.8.2-3.el5libvirt-0.8.2-4.el5libvirt-0.8.2-6.el5libvirt-0.8.2-7.el5libvirt-0.8.2-8.el5libvirt-0.8.2-9.el5v0.8.2
Daniel P. Berrange [Wed, 23 Jun 2010 14:05:52 +0000 (23 15:05 +0100)]
Add missing parameter in python Disk IO error callback

The IO error callback was forgetting to pass the action
parameter, causing a stack trace when IO errors arrive

* python/libvirt-override-virConnect.py: Add missing action
  parameter in IO error callback

12 years agoFix description of virStorageVolGetInfo()
Philipp Hahn [Tue, 15 Jun 2010 09:44:13 +0000 (15 11:44 +0200)]
Fix description of virStorageVolGetInfo()

Probably a copy-paste-bug in python/libvirt-override-api.xml:
virStorageVolGetInfo() extracts information about a "storage volume",
not the "storage pool" as virStoragePoolGetInfo() does.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agomaint: simplify some ignore files
Eric Blake [Wed, 9 Jun 2010 19:52:36 +0000 (9 13:52 -0600)]
maint: simplify some ignore files

* .hgignore: Delete, no longer used.
* examples/python/.gitignore: Delete, covered globally.
* include/.gitignore: Likewise.
* python/tests/.gitignore: Likewise.
* docs/schemas/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.
* tests/sexpr2xmldata/.gitignore: Likewise.
* tests/confdata/.gitignore: Likewise.
* tests/xencapsdata/.gitignore: Likewise.
* tests/xmconfigdata/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.

12 years agoFix up the python bindings for snapshotting.
Chris Lalancette [Wed, 19 May 2010 13:02:30 +0000 (19 09:02 -0400)]
Fix up the python bindings for snapshotting.

This involved a few fixes.  To start with,
an virDomainSnapshot object is really tied to a
domain, not a connection, so we have to generate
a slightly different object so that we can get
at self._dom for the object.

Next, we had to "dummy" up an override piece of
XML with a bogus argument that the function doesn't
actually take.  That's so that the generator places
virDomainRevertToSnapshot underneath the correct
class (namely, the virDomain class).

Finally, we had to hand-implement the
virDomainRevertToSnapshot implementation, ignoring the
bogus pointer we are being passed.

With all of this in place, I was able to successfully
take a snapshot and revert to it using only the
Python bindings.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
12 years agopython: don't ignore virInitialize failure in module initialization
Jim Meyering [Tue, 18 May 2010 11:46:27 +0000 (18 13:46 +0200)]
python: don't ignore virInitialize failure in module initialization

* python/libvirt-override.c (initlibvirtmod): Upon virInitialize
failure, skip the Py_InitModule call.

12 years agoAdd support for another explicit IO error eventv0.8.1
Daniel P. Berrange [Thu, 18 Mar 2010 19:37:44 +0000 (18 19:37 +0000)]
Add support for another explicit IO error event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON

This event is the same as the previous VIR_DOMAIN_ID_IO_ERROR
event, but also includes a string describing the cause of
the event.

Thus there is a new callback definition for this event type

typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn,
                                                           virDomainPtr dom,
                                                           const char *srcPath,
                                                           const char *devAlias,
                                                           int action,
                                                           const char *reason,
                                                           void *opaque);

This is currently wired up to the QEMU block IO error events

* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
  IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
  from QEMU monitor

12 years agoImplement python binding for virDomainGetBlockInfo
Daniel P. Berrange [Wed, 28 Apr 2010 12:42:13 +0000 (28 13:42 +0100)]
Implement python binding for virDomainGetBlockInfo

This binds the virDomainGetBlockInfo API to python's blockInfo
method on the domain object

>>> c = libvirt.openReadOnly('qemu:///session')
>>> d = c.lookupByName('demo')
>>> f = d.blockInfo("/dev/loop0", 0)
>>> print f
[1048576000L, 104857600L, 104857600L]

* python/libvirt-override-api.xml: Define override signature
* python/generator.py: Skip C impl generator for virDomainGetBlockInfo
* python/libvirt-override.c: Manual impl of virDomainGetBlockInfo

12 years agonwfilter: python bindings for nwfilter
Stefan Berger [Thu, 29 Apr 2010 10:46:01 +0000 (29 06:46 -0400)]
nwfilter: python bindings for nwfilter

I have primarily followed the pattern of the 'secret' driver to provide
support for the missing python bindings for the network filter API.

12 years agoDon't ship generated python/libvirt.? files.
Philipp Hahn [Thu, 15 Apr 2010 10:49:33 +0000 (15 12:49 +0200)]
Don't ship generated python/libvirt.? files.

libvirt.c and libvirt.h are auto-generated files. Mentioning their names
in *_SOURCES includes them in the distribution. During an out-of-tree
build these shipped files are included instead of the auto-generated
version, potentially breaking the build (as it happend in 0.8.0, because
the shipped libvirt.h was missing the declaration for
'libvirt_virDomainUpdateDeviceFlags')

Use the nodist_*_SOURCES automake variable instead.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agoFixup python binding for virDomainSnapshot APIs
Daniel P. Berrange [Tue, 20 Apr 2010 09:49:27 +0000 (20 11:49 +0200)]
Fixup python binding for virDomainSnapshot APIs

The generator code was totally wrong for the virDomainSnapshot
APIs, not generating the wrapper class, and giving methods the
wrong names

* generator.py: Set metadata for virDomainSnapshot type & APIs
* libvirt-override-api.xml, libvirt-override.c: Hand-code the
  virDomainSnapshotListNames glue layer

12 years agoMore event callback fixesv0.8.0
Daniel P. Berrange [Thu, 8 Apr 2010 15:01:00 +0000 (8 16:01 +0100)]
More event callback fixes

In a couple of cases typos meant we were firing the wrong type
of event. In the python code my previous commit accidentally
missed some chunks of the code.

* python/libvirt-override-virConnect.py: Add missing python glue
  accidentally left out of previous commit
* src/conf/domain_event.c, src/qemu/qemu_monitor_json.c: Fix typos
  in event name / method name to invoke

12 years agoFix up python bindings for new event callbacks
Daniel P. Berrange [Fri, 26 Mar 2010 13:22:06 +0000 (26 13:22 +0000)]
Fix up python bindings for new event callbacks

The generator was disabled for the new event callbacks, since they
need to be hand written. This patch  adds the C and python glue to
expose the new APIs in the python binding. The python example
program is extended to demonstrate of the code

* python/libvirt-override.c: Registration and dispatch of events
   at the C layer
* python/libvirt-override-virConnect.py: Python glue for events
* examples/domain-events/events-python/event-test.py: Demo use
  of new event callbacks

12 years agoSnapshot API framework.
Chris Lalancette [Wed, 31 Mar 2010 20:33:13 +0000 (31 16:33 -0400)]
Snapshot API framework.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
12 years agoCore driver implementation with ebtables support
Stefan Berger [Thu, 25 Mar 2010 17:46:09 +0000 (25 13:46 -0400)]
Core driver implementation with ebtables support

This patch implements the core driver and provides
- management functionality for managing the filter XMLs
- compiling the internal filter representation into ebtables rules
- applying ebtables rules on a network (tap,macvtap) interface
- tearing down ebtables rules that were applied on behalf of an
interface
- updating of filters while VMs are running and causing the firewalls to
be rebuilt
- other bits and pieces

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
12 years agoAdd domain events for graphics network clients
Daniel P. Berrange [Fri, 19 Mar 2010 13:27:45 +0000 (19 13:27 +0000)]
Add domain events for graphics network clients

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_GRAPHICS

The same event can be emitted in 3 scenarios

  typedef enum {
      VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0,
      VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE,
      VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT,
  } virDomainEventGraphicsPhase;

Connect/disconnect are triggered at socket accept/close.
The initialize phase is immediately after the protocol
setup and authentication has completed. ie when the
client is authorized and about to start interacting with
the graphical desktop

This event comes with *a lot* of potential information

 - IP address, port & address family of client
 - IP address, port & address family of server
 - Authentication scheme (arbitrary string)
 - Authenticated subject identity. A subject may have
   multiple identities with some authentication schemes.
   For example, vencrypt+sasl results in a x509dname
   and saslUsername identities.

This results in a very complicated callback :-(

   typedef enum {
      VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4,
      VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6,
   } virDomainEventGraphicsAddressType;

   struct _virDomainEventGraphicsAddress {
       int family;
       const char *node;
       const char *service;
   };
   typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress;
   typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr;

   struct _virDomainEventGraphicsSubject {
      int nidentity;
      struct {
          const char *type;
          const char *name;
      } *identities;
   };
   typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject;
   typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr;

   typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn,
                                                         virDomainPtr dom,
                                                         int phase,
                                                         virDomainEventGraphicsAddressPtr local,
                                                         virDomainEventGraphicsAddressPtr remote,
                                                         const char *authScheme,
                                                         virDomainEventGraphicsSubjectPtr subject,
                                                         void *opaque);

The wire protocol is similarly complex

   struct remote_domain_event_graphics_address {
     int family;
     remote_nonnull_string node;
     remote_nonnull_string service;
   };

   const REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX = 20;

   struct remote_domain_event_graphics_identity {
     remote_nonnull_string type;
     remote_nonnull_string name;
   };

   struct remote_domain_event_graphics_msg {
     remote_nonnull_domain dom;
     int phase;
     remote_domain_event_graphics_address local;
     remote_domain_event_graphics_address remote;
     remote_nonnull_string authScheme;
     remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>;
   };

This is currently implemented in QEMU for the VNC graphics
protocol, but designed to be usable with SPICE graphics in
the future too.

* daemon/remote.c: Dispatch graphics events to client
* examples/domain-events/events-c/event-test.c: Watch for
  graphics events
* include/libvirt/libvirt.h.in: Define new graphics event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle graphics events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for VNC events and emit a libvirt graphics event
* src/remote/remote_driver.c: Receive and dispatch graphics
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  graphics events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for VNC_CONNECTED,
  VNC_INITIALIZED & VNC_DISCONNETED events from QEMU monitor

12 years agoAdd support for an explicit IO error event
Daniel P. Berrange [Thu, 18 Mar 2010 19:37:44 +0000 (18 19:37 +0000)]
Add support for an explicit IO error event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_IO_ERROR

This event includes the action that is about to be taken
as a result of the watchdog triggering

  typedef enum {
     VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0,
     VIR_DOMAIN_EVENT_IO_ERROR_PAUSE,
     VIR_DOMAIN_EVENT_IO_ERROR_REPORT,
  } virDomainEventIOErrorAction;

In addition it has the source path of the disk that had the
error and its unique device alias. It does not include the
target device name (/dev/sda), since this would preclude
triggering IO errors from other file backed devices (eg
serial ports connected to a file)

Thus there is a new callback definition for this event type

typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn,
                                                     virDomainPtr dom,
                                                     const char *srcPath,
                                                     const char *devAlias,
                                                     int action,
                                                     void *opaque);

This is currently wired up to the QEMU block IO error events

* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
  IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
  from QEMU monitor

12 years agoAdd support for an explicit watchdog event
Daniel P. Berrange [Thu, 18 Mar 2010 19:07:48 +0000 (18 19:07 +0000)]
Add support for an explicit watchdog event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_WATCHDOG

This event includes the action that is about to be taken
as a result of the watchdog triggering

 typedef enum {
     VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0,
     VIR_DOMAIN_EVENT_WATCHDOG_PAUSE,
     VIR_DOMAIN_EVENT_WATCHDOG_RESET,
     VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF,
     VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN,
     VIR_DOMAIN_EVENT_WATCHDOG_DEBUG,
 } virDomainEventWatchdogAction;

Thus there is a new callback definition for this event type

 typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn,
                                                       virDomainPtr dom,
                                                       int action,
                                                       void *opaque);

* daemon/remote.c: Dispatch watchdog events to client
* examples/domain-events/events-c/event-test.c: Watch for
  watchdog events
* include/libvirt/libvirt.h.in: Define new watchdg event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle watchdog events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for watchdogs and emit a libvirt watchdog event
* src/remote/remote_driver.c: Receive and dispatch watchdog
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  watchdog events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for WATCHDOG event
  from QEMU monitor

12 years agoAdd support for an explicit RTC change event
Daniel P. Berrange [Thu, 18 Mar 2010 18:28:15 +0000 (18 18:28 +0000)]
Add support for an explicit  RTC change event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_RTC_CHANGE

This event includes the new UTC offset measured in seconds.
Thus there is a new callback definition for this event type

 typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
                                                        virDomainPtr dom,
                                                        long long utcoffset,
                                                        void *opaque);

If the guest XML configuration for the <clock> is set to
offset='variable', then the XML will automatically be
updated with the new UTC offset value. This ensures that
during migration/save/restore the new offset is preserved.

* daemon/remote.c: Dispatch RTC change events to client
* examples/domain-events/events-c/event-test.c: Watch for
  RTC change events
* include/libvirt/libvirt.h.in: Define new RTC change event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle RTC change events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for RTC changes and emit a libvirt RTC change event
* src/remote/remote_driver.c: Receive and dispatch RTC change
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  RTC change events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event
  from QEMU monitor

12 years agoIntroduce a new public API for domain events
Daniel P. Berrange [Thu, 18 Mar 2010 13:01:48 +0000 (18 13:01 +0000)]
Introduce a new public API for domain events

The current API for domain events has a number of problems

 - Only allows for domain lifecycle change events
 - Does not allow the same callback to be registered multiple times
 - Does not allow filtering of events to a specific domain

This introduces a new more general purpose domain events API

  typedef enum {
     VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0,       /* virConnectDomainEventCallback */
      ...more events later..
  }

  int virConnectDomainEventRegisterAny(virConnectPtr conn,
                                       virDomainPtr dom, /* Optional, to filter */
                                       int eventID,
                                       virConnectDomainEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb);

  int virConnectDomainEventDeregisterAny(virConnectPtr conn,
                                         int callbackID);

Since different event types can received different data in the callback,
the API is defined with a generic callback. Specific events will each
have a custom signature for their callback. Thus when registering an
event it is neccessary to cast the callback to the generic signature

eg

  int myDomainEventCallback(virConnectPtr conn,
                            virDomainPtr dom,
                            int event,
                            int detail,
                            void *opaque)
  {
    ...
  }

  virConnectDomainEventRegisterAny(conn, NULL,
                                   VIR_DOMAIN_EVENT_ID_LIFECYCLE,
                                   VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback)
                                   NULL, NULL);

The VIR_DOMAIN_EVENT_CALLBACK() macro simply does a "bad" cast
to the generic signature

* include/libvirt/libvirt.h.in: Define new APIs for registering
  domain events
* src/driver.h: Internal driver entry points for new events APIs
* src/libvirt.c: Wire up public API to driver API for events APIs
* src/libvirt_public.syms: Export new APIs
* src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
  src/qemu/qemu_driver.c, src/remote/remote_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c,
  src/vbox/vbox_tmpl.c, src/xen/xen_driver.c,
  src/xenapi/xenapi_driver.c: Stub out new API entries

12 years agopython: Fix networkLookupByUUID
Philip Hahn [Wed, 17 Mar 2010 16:34:04 +0000 (17 12:34 -0400)]
python: Fix networkLookupByUUID

According to:

http://libvirt.org/html/libvirt-libvirt.html#virNetworkLookupByUUID

virNetworkLookupByUUID() expects a virConnectPtr as its first argument,
thus making it a method of the virConnect Python class.

Currently it's a method of libvirt.virNetwork.

@@ -805,13 +805,6 @@ class virNetwork:
         if ret == -1: raise libvirtError ('virNetworkGetAutostart() failed', net=self)
         return ret

-    def networkLookupByUUID(self, uuid):
-        """Try to lookup a network on the given hypervisor based on its UUID. """
-        ret = libvirtmod.virNetworkLookupByUUID(self._o, uuid)
-        if ret is None:raise libvirtError('virNetworkLookupByUUID() failed', net=self)
-        __tmp = virNetwork(self, _obj=ret)
-        return __tmp
-
 class virInterface:
     def __init__(self, conn, _obj=None):
         self._conn = conn
@@ -1689,6 +1682,13 @@ class virConnect:
         __tmp = virDomain(self,_obj=ret)
         return __tmp

+    def networkLookupByUUID(self, uuid):
+        """Try to lookup a network on the given hypervisor based on its UUID. """
+        ret = libvirtmod.virNetworkLookupByUUID(self._o, uuid)
+        if ret is None:raise libvirtError('virNetworkLookupByUUID() failed', conn=self)
+        __tmp = virNetwork(self, _obj=ret)
+        return __tmp
+

12 years agobuild: consistently indent preprocessor directives
Eric Blake [Tue, 9 Mar 2010 18:22:22 +0000 (9 19:22 +0100)]
build: consistently indent preprocessor directives

* global: patch created by running:
for f in $(git ls-files '*.[ch]') ; do
    cppi $f > $f.t && mv $f.t $f
done

12 years agoIntroduce public API for domain async job handlingv0.7.7
Daniel P. Berrange [Wed, 3 Feb 2010 11:31:45 +0000 (3 11:31 +0000)]
Introduce public API for domain async job handling

Introduce a new public API that provides a way to get progress
info on currently running jobs on a virDomainpPtr. APIs that
are initially within scope of this idea are

 virDomainMigrate
 virDomainMigrateToURI
 virDomainSave
 virDomainRestore
 virDomainCoreDump

These all take a potentially long time and benefit from monitoring.
The virDomainJobInfo struct allows for various pieces of information
to be reported

 - Percentage completion
 - Time
 - Overall data
 - Guest memory data
 - Guest disk/file data

* include/libvirt/libvirt.h.in: Add virDomainGetJobInfo
* python/generator.py, python/libvirt-override-api.xml,
  python/libvirt-override.c: Override for virDomainGetJobInfo API
* python/typewrappers.c, python/typewrappers.h: Introduce wrapper
  for unsigned long long type

12 years agopython: Actually add virConnectGetVersion to generated bindings
Cole Robinson [Wed, 17 Feb 2010 20:55:46 +0000 (17 15:55 -0500)]
python: Actually add virConnectGetVersion to generated bindings

The recent commit to implement a python version of this function
didn't drop an explicit 'ignore' check in the generator, so this
never ended up in the bindings.

12 years agolibvirt-override.c: avoid a leak upon call with invalid argument
Jim Meyering [Tue, 16 Feb 2010 07:07:38 +0000 (16 08:07 +0100)]
libvirt-override.c: avoid a leak upon call with invalid argument

* python/libvirt-override.c (libvirt_virConnectBaselineCPU): Don't leak
the xmlcpus buffer upon encountering a non-string list element.

12 years agovirConnectBaselineCPU public API
Jiri Denemark [Fri, 22 Jan 2010 13:52:41 +0000 (22 14:52 +0100)]
virConnectBaselineCPU public API

12 years agoAdd virConnectGetVersion Python APIv0.7.6
Taizo ITO [Fri, 22 Jan 2010 10:01:09 +0000 (22 11:01 +0100)]
Add virConnectGetVersion Python API

adds a new python API call for retrieving the running
hypervisor version used by a connection: virConnectGetVersion

* python/generator.py: skip virConnectGetVersion from autogenerated
* python/libvirt-override-api.xml python/libvirt-override.c: define
  direct native bindings

12 years agognulib added a new syntax-check test: use $(VAR), not @VAR@
Jim Meyering [Fri, 15 Jan 2010 10:09:01 +0000 (15 11:09 +0100)]
gnulib added a new syntax-check test: use $(VAR), not @VAR@

The latter is not officially "wrong", but *is* terribly anachronistic.
I think automake documentation or comments call that syntax obsolescent.
* cfg.mk (_makefile_at_at_check_exceptions): Exempt @SCHEMADIR@
and @SYSCONFDIR@ uses -- there are no Makefile variables for those.
* docs/Makefile.am: Use $(INSTALL), not @INSTALL@.
* examples/dominfo/Makefile.am: Similar.
* examples/domsuspend/Makefile.am: Similar.
* proxy/Makefile.am: Similar.
* python/Makefile.am: Similar.
* python/tests/Makefile.am: Similar.
* src/Makefile.am: Similar.
* tests/Makefile.am: Similar.

12 years agoDisable building of static Python module
Diego Elio Pettenò [Wed, 6 Jan 2010 16:33:41 +0000 (6 17:33 +0100)]
Disable building of static Python module

* python/Makefile.am: python modules are loaded at runtime so the static
  version is not needed, avoid building it

12 years agopython: Add python bindings for virDomainMemoryStatsv0.7.5
Adam Litke [Sun, 20 Dec 2009 12:48:37 +0000 (20 13:48 +0100)]
python: Add python bindings for virDomainMemoryStats

Enable virDomainMemoryStats in the python API.  dom.memoryStats() will return a
dictionary containing the supported statistics.  A dictionary is required
because the meaining of each quantity cannot be inferred from its index in a
list.

* python/generator.py: reenable bindings for this entry point
* python/libvirt-override-api.xml python/libvirt-override.c: the
  generator can't handle this new function, add the new binding,
  and the XML description

12 years agoAdd new API virDomainMemoryStats to header and drivers
Adam Litke [Sun, 20 Dec 2009 12:28:42 +0000 (20 13:28 +0100)]
Add new API virDomainMemoryStats to header and drivers

Set up the types for the domainMemoryStats function and insert it into the
virDriver structure definition.  Because of static initializers, update
every driver and set the new field to NULL.

* include/libvirt/libvirt.h.in: new API
* src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
  entry to the driver structure
* python/generator.py: fix compiler errors, the actual python binding is
  implemented later

12 years agoFix install location for Python bindingscpumask-v2cpumask-v3
Matthias Bolte [Fri, 11 Dec 2009 23:11:31 +0000 (12 00:11 +0100)]
Fix install location for Python bindings

Commit 66137344feb488ea87b0d92f3c03844d9a7a7786 changed the Python detection
mechanism in configure to use AM_PATH_PYTHON. This results in a changed
install location for the Python bindings, at least on Fedora 12 64bit systems.

Before this commit libvirt.py and libvirtmod.so were installed to

  /usr/lib64/python2.6/site-packages

After this commit they are installed to

  /usr/lib/python2.6/site-packages

Mixed Python packages (containing *.py and *.so files) should be installed to
the pyexecdir directory detected by AM_PATH_PYTHON.

This restores the install location from before the AM_PATH_PYTHON commit.

* configure.in: remove unnecessary pythondir export
* python/Makefile.am: switch from pythondir to pyexecdir

12 years agoUse AM_PATH_PYTHON and python-config to detect Python configuration
Matthias Bolte [Sun, 6 Dec 2009 15:05:33 +0000 (6 16:05 +0100)]
Use AM_PATH_PYTHON and python-config to detect Python configuration

Using AM_PATH_PYTHON solves the site-packages directory problem. At least
in Ubuntu with Python 2.6 and later site-packages is renamed to dist-packages
and site-packages is not part of sys.path anymore. So installing the libvirt
Python bindings to site-packages renders them unusable, because they can be
imported from there without manually including site-packages into sys.path.

AM_PATH_PYTHON detects the correct site-packages/dist-packages directory.

python-config --includes gives the correct include path for the Python header
files. The old probing code stays there as fallback mechanism.

* configure.in: use AM_PATH_PYTHON and python-config
* python/Makefile.am: remove -I because PYTHON_INCLUDES contains it now

12 years agoFix threading problems in python bindings
Daniel P. Berrange [Wed, 25 Nov 2009 12:04:47 +0000 (25 12:04 +0000)]
Fix threading problems in python bindings

* libvirt-override.c: Add many missing calls to allow threading
  when entering C code, otherwise python blocks & then deadlocks
  when we have an async event to dispatch back into python code.
  Fix return value check for virDomainPinVcpu binding.

12 years agopython: Actually implement list*Interfaces bindingsv0.7.3v0.7.4
Cole Robinson [Fri, 20 Nov 2009 15:22:42 +0000 (20 16:22 +0100)]
python: Actually implement list*Interfaces bindings

* python/generator.py python/libvirt-override-api.xml
  python/libvirt-override.c: implement the bindings for
  virConnectListInterfaces() and virConnectListDefinedInterfaces()

12 years agoAdd virConnectGetLibvirtVersion API
Cole Robinson [Thu, 12 Nov 2009 15:53:26 +0000 (12 10:53 -0500)]
Add virConnectGetLibvirtVersion API

There is currently no way to determine the libvirt version of a remote
libvirtd we are connected to. This is a useful piece of data to enable
feature detection.

12 years agogive up python interpreter lock before calling cb
Dan Kenigsberg [Tue, 3 Nov 2009 17:42:16 +0000 (3 18:42 +0100)]
give up python interpreter lock before calling cb

suggested by danpb on irc, patch by danken fixed for proper C syntax

* python/libvirt-override.c: on event callback release the python
  interpreter lock and take it again when coming back so that the
  callback can reinvoke libvirt.

12 years agopython: Add a newline after custom classeslibvirt-0.7.2-1.fc13libvirt-0.7.2-2.fc13libvirt-0.7.2-3.fc13v0.7.2
Cole Robinson [Fri, 2 Oct 2009 17:05:03 +0000 (2 13:05 -0400)]
python: Add a newline after custom classes

In the generated bindings, custom classes are squashed against the following
class, which hurts readability.

12 years agopython: Fix generated virInterface method names
Cole Robinson [Wed, 23 Sep 2009 16:51:55 +0000 (23 12:51 -0400)]
python: Fix generated virInterface method names

A mistake in the generator was causing virInterface methods to be generated
with unpredicatable names ('ceUndefine', instead of just 'undefine'). This
fixes the method names to match existing convention.

Does anyone care if we are breaking API compat? My guess is that no one is
using the python interface bindings yet.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agopython: Use a pure python implementation of 'vir*GetConnect'
Cole Robinson [Wed, 23 Sep 2009 16:38:47 +0000 (23 12:38 -0400)]
python: Use a pure python implementation of 'vir*GetConnect'

The API docs explictly warn that we shouldn't use the C vir*GetConnect calls
in bindings: doing so can close the internal connection pointer and cause
things to get screwy. Implement these calls in python.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agopython: Don't generate bindings for vir*Ref
Cole Robinson [Wed, 23 Sep 2009 16:17:03 +0000 (23 12:17 -0400)]
python: Don't generate bindings for vir*Ref

They are only for use in implementing the bindings, so shouldn't be
exposed to regular API users.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agopython: Don't generate conflicting conn.createXML functions.
Cole Robinson [Wed, 23 Sep 2009 16:09:09 +0000 (23 12:09 -0400)]
python: Don't generate conflicting conn.createXML functions.

A special case in the generator wasn't doing its job, and duplicate
conn.createXML functions were being generated. The bindings diff is:

@@ -1079,14 +1079,6 @@ class virConnect:
         return __tmp

     def createXML(self, xmlDesc, flags):
-        """Create a new device on the VM host machine, for example,
-           virtual HBAs created using vport_create. """
-        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
-        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
-        __tmp = virNodeDevice(self, _obj=ret)
-        return __tmp
-
-    def createXML(self, xmlDesc, flags):
         """Launch a new guest domain, based on an XML description
           similar to the one returned by virDomainGetXMLDesc() This
           function may requires privileged access to the hypervisor.
@@ -1327,6 +1319,14 @@ class virConnect:
         __tmp = virNetwork(self, _obj=ret)
         return __tmp

+    def nodeDeviceCreateXML(self, xmlDesc, flags):
+        """Create a new device on the VM host machine, for example,
+           virtual HBAs created using vport_create. """
+        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
+        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
+        __tmp = virNodeDevice(self, _obj=ret)
+        return __tmp
+
     def nodeDeviceLookupByName(self, name):
         """Lookup a node device by its name. """
         ret = libvirtmod.virNodeDeviceLookupByName(self._o, name)

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agopython: Remove use of xmllib in generator.py
Cole Robinson [Fri, 2 Oct 2009 15:20:47 +0000 (2 11:20 -0400)]
python: Remove use of xmllib in generator.py

xmllib has been deprecated since python 2.0, and running the generator throws
a warning. Move to using xml.sax

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agopython: Remove FastParser from generator.
Cole Robinson [Fri, 2 Oct 2009 14:34:54 +0000 (2 10:34 -0400)]
python: Remove FastParser from generator.

FastParser uses sgmlop, a non-standard python module meant as a replacement
for xmllib (which is deprecated since python 2.0). Fedora doesn't even carry
this module, and the generator doesn't have high performance requirements, so
just rip the code out.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
12 years agoAdd public API definition for data stream handling
Daniel P. Berrange [Fri, 10 Jul 2009 11:18:12 +0000 (10 12:18 +0100)]
Add public API definition for data stream handling

* include/libvirt/libvirt.h.in: Public API contract for
  virStreamPtr object
* src/libvirt_public.syms: Export data stream APIs
* src/libvirt_private.syms: Export internal helper APIs
* src/libvirt.c: Data stream API driver dispatch
* src/datatypes.h, src/datatypes.c: Internal helpers for virStreamPtr
  object
* src/driver.h: Define internal driver API for streams
* .x-sc_avoid_write: Ignore src/libvirt.c because it trips
  up on comments including write()
* python/Makefile.am: Add libvirt-override-virStream.py
* python/generator.py: Add rules for virStreamPtr class
* python/typewrappers.h, python/typewrappers.c: Wrapper
  for virStreamPtr
* docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate
  with new APIs

12 years agoFix API doc extractor to stop munging comment formatting
Daniel P. Berrange [Fri, 25 Sep 2009 12:24:40 +0000 (25 13:24 +0100)]
Fix API doc extractor to stop munging comment formatting

The python method help docs are copied across from the C
funtion comments, but in the process all line breaks and
indentation was being lost. This made the resulting text
and code examples completely unreadable. Both the API
doc extractor and the python generator were destroying
whitespace & this fixes them to preserve it exactly.

* docs/apibuild.py: Preserve all whitespace when extracting
  function comments. Print function comment inside a <![CDATA[
  section to fully preserve all whitespace. Look for the
  word 'returns' to describe return values, instead of 'return'
  to avoid getting confused with code examples including the
  C 'return' statement.
* python/generator.py: Preserve all whitespace when printing
  function help docs
* src/libvirt.c: Change any return parameter indicated by
  'return' to be 'returns', to avoid confusing the API extractor
* docs/libvirt-api.xml: Re-build for fixed descriptions

12 years agoMisc syntax-check fixes
Daniel P. Berrange [Wed, 16 Sep 2009 16:26:27 +0000 (16 17:26 +0100)]
Misc syntax-check fixes

12 years agoRe-arrange python generator to make it clear what's auto-generated
Daniel P. Berrange [Wed, 16 Sep 2009 13:03:53 +0000 (16 14:03 +0100)]
Re-arrange python generator to make it clear what's auto-generated

* README: New file describing what each file is used for
* livvirt-override.c, libvirt-override.py, libvirt-override-api.xml,
  libvirt-override-virConnect.py: Manually written code overriding
  the generator
* typewrappers.c, typewrappers.h: Data type wrappers
* generator.py: Automatically pre-prend contents of libvirt-override.py
  to generated libvirt.py. Output into libvirt.py directly instead of
  libvirtclass.py. Don't generate libvirtclass.txt at all. Write C
  files into libvirt.c/.h directly
* Makefile.am: Remove rule for creating libvirt.py from libvirt-override.py
  and libvirtclass.py, since generator.py does it directly

12 years agoAdd usage type/id as a public API property of virSecretlibvirt-0.7.1-10.fc12libvirt-0.7.1-10.fc13libvirt-0.7.1-11.fc12libvirt-0.7.1-11.fc13libvirt-0.7.1-12.fc12libvirt-0.7.1-12.fc13libvirt-0.7.1-13.fc12libvirt-0.7.1-14.fc12libvirt-0.7.1-15.fc12libvirt-0.7.1-8.fc12libvirt-0.7.1-8.fc13libvirt-0.7.1-9.fc12libvirt-0.7.1-9.fc13v0.7.1
Daniel P. Berrange [Fri, 11 Sep 2009 13:06:15 +0000 (11 14:06 +0100)]
Add usage type/id as a public API property of virSecret

* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in: Add
  virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage
* python/generator.py: Mark virSecretGetUsageType, virSecretGetUsageID
  as not throwing exceptions
* qemud/remote.c: Implement dispatch for virLookupSecretByUsage
* qemud/remote_protocol.x: Add usage type & ID as attributes of
  remote_nonnull_secret. Add RPC calls for new public APIs
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
  qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
  qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.c, src/datatypes.h: Add usageType and usageID as
  properties of virSecretPtr
* src/driver.h: Add virLookupSecretByUsage driver entry point
* src/libvirt.c: Implement virSecretGetUsageType, virSecretGetUsageID
  and virLookupSecretByUsage
* src/libvirt_public.syms: Export virSecretGetUsageType, virSecretGetUsageID
  and virLookupSecretByUsage
* src/remote_internal.c: Implement virLookupSecretByUsage entry
* src/secret_conf.c, src/secret_conf.h: Remove the
  virSecretUsageType enum, now in public API. Make volume
  path mandatory when parsing XML
* src/secret_driver.c: Enforce usage uniqueness when defining secrets.
  Implement virSecretLookupByUsage api method
* src/virsh.c: Include usage for secret-list command

12 years agoFix UUID handling in secrets/storage encryption APIs
Daniel P. Berrange [Thu, 10 Sep 2009 16:44:12 +0000 (10 17:44 +0100)]
Fix UUID handling in secrets/storage encryption APIs

Convert all the secret/storage encryption APIs / wire format to
handle UUIDs in raw format instead of non-canonical printable
format. Guarentees data format correctness.

* docs/schemas/storageencryption.rng: Make UUID mandatory for a secret
  and validate fully
* docs/schemas/secret.rng: Fully validate UUID
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in, Add
  virSecretLookupByUUID and virSecretGetUUID. Make
  virSecretGetUUIDString follow normal API design pattern
* python/generator.py: Skip generation of virSecretGetUUID,
  virSecretGetUUIDString and virSecretLookupByUUID
* python/libvir.c, python/libvirt-python-api.xml: Manual impl
  of virSecretGetUUID,virSecretGetUUIDString and virSecretLookupByUUID
* qemud/remote.c: s/virSecretLookupByUUIDString/virSecretLookupByUUID/
  Fix get_nonnull_secret/make_nonnull_secret to use unsigned char
* qemud/remote_protocol.x: Fix remote_nonnull_secret to use a
  remote_uuid instead of remote_nonnull_string for UUID field.
  Rename REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING to
  REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING and make it take an
  remote_uuid  value
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
  qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
  qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.h, src/datatypes.c: Store UUID in raw format instead
  of printable. Change virGetSecret to use raw format UUID
* src/driver.h: Rename virDrvSecretLookupByUUIDString to
  virDrvSecretLookupByUUID and use raw format UUID
* src/libvirt.c: Add virSecretLookupByUUID and virSecretGetUUID
  and re-implement virSecretLookupByUUIDString and
  virSecretGetUUIDString in terms of those
* src/libvirt_public.syms: Add virSecretLookupByUUID and
  virSecretGetUUID
* src/remote_internal.c: Rename remoteSecretLookupByUUIDString
  to remoteSecretLookupByUUID. Fix typo in args for
  remoteSecretDefineXML impl. Use raw UUID format for
  get_nonnull_secret and make_nonnull_secret
* src/storage_encryption_conf.c, src/storage_encryption_conf.h:
  Storage UUID in raw format, and require it to be present in
  XML. Use UUID parser to validate.
* secret_conf.h, secret_conf.c: Generate a UUID if none is provided.
  Storage UUID in raw format.
* src/secret_driver.c: Adjust to deal with raw UUIDs. Save secrets
  in a filed with printable UUID, instead of base64 UUID.
* src/virsh.c: Adjust for changed public API contract of
  virSecretGetUUIDString.
* src/storage_Backend.c: DOn't undefine secret we just generated
  upon successful volume creation. Fix to handle raw UUIDs. Generate
  a non-clashing UUID
* src/qemu_driver.c: Change to use lookupByUUID instead of
  lookupByUUIDString

12 years agopython: let libvirt_virConnectDomainEventCallback indicate successsubmission-5
Jim Meyering [Thu, 3 Sep 2009 12:09:49 +0000 (3 14:09 +0200)]
python: let libvirt_virConnectDomainEventCallback indicate success

* python/libvir.c (libvirt_virConnectDomainEventCallback): Return 0
when successful, rather than always returning -1.
clang flagged this function for its dead-store of "ret=0".
Once "ret" was set to 0, it was never used, and
the function would always return -1.

12 years agoSecret manipulation API docs refresh & wire up python generator
Miloslav Trmač [Tue, 4 Aug 2009 18:38:21 +0000 (4 20:38 +0200)]
Secret manipulation API docs refresh & wire up python generator

Sample session:

>>> import libvirt
>>> c = libvirt.open('qemu:///session')

>>> c.listSecrets()
['12247729-47d2-a783-88ce-b329d4781cd3', 'reee', 'abc']

>>> s = c.secretDefineXML("<secret ephemeral='no' private='no'>\n<description>Something for use</description>\n<volume>/foo/bar</volume>\n</secret>\n")

>>> s.UUIDString()
'340c2dfb-811b-eda8-da9e-25ccd7bfd650'

>>> s.XMLDesc()
"<secret ephemeral='no' private='no'>\n  <uuid>340c2dfb-811b-eda8-da9e-25ccd7bfd650</uuid>\n  <description>Something for use</description>\n  <volume>/foo/bar</volume>\n</secret>\n"

>>> s.setValue('abc\0xx\xffx')
0

>>> s.value()
'abc\x00xx\xffx'

>>> s.undefine()
0

* python/generator.py: Add rules for virSecret APIs
* python/libvir.c, python/libvirt-python-api.xml: Manual impl of
  virSecretSetValue, virSecretGetValue$ and virConnectListSecrets APIs
* python/libvirt_wrap.h, python/types.c: Wrapper for virSecret objects
* docs/libvirt-api.xml, docs/libvirt-refs.xml,
  docs/html/libvirt-virterror.html, docs/html/libvirt-libvirt.html,
  docs/devhelp/libvirt-virterror.html, docs/devhelp/libvirt-libvirt.html:
  Re-generate with 'make api'

12 years agopython: Raise exceptions if virDomain*Stats fail.v0.7.0
Cole Robinson [Fri, 24 Jul 2009 15:05:27 +0000 (24 11:05 -0400)]
python: Raise exceptions if virDomain*Stats fail.

The generator couldn't tell that the stats return values were pointers.
Stick a white list in the function which tries to make this distinction.

13 years agoremove all trailing blank lines
Jim Meyering [Thu, 16 Jul 2009 06:25:36 +0000 (16 08:25 +0200)]
remove all trailing blank lines

by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.

13 years agoremove all .cvsignore files
Jim Meyering [Tue, 7 Jul 2009 10:05:18 +0000 (7 12:05 +0200)]
remove all .cvsignore files

13 years agoFix python examples to use read-write conn
Dan Kenigsberg [Mon, 6 Jul 2009 15:05:41 +0000 (6 17:05 +0200)]
Fix python examples to use read-write conn

* docs/examples/python/domstart.py python/tests/create.py:
The two example were broken as they needed full-access connection
but only opened read-only connections

13 years agoFix python domain events example & bindingLIBVIRT_0_6_4LIBVIRT_0_6_5v0.6.4v0.6.5
Daniel P. Berrange [Thu, 28 May 2009 11:02:11 +0000 (28 11:02 +0000)]
Fix python domain events example & binding

13 years agoAdd virInterface APIs to python code generator
Daniel P. Berrange [Thu, 21 May 2009 10:57:05 +0000 (21 10:57 +0000)]
Add virInterface  APIs to python code generator

13 years agoBetter error reporting if 'import libvirtmod' fails
Cole Robinson [Tue, 19 May 2009 13:03:03 +0000 (19 13:03 +0000)]
Better error reporting if 'import libvirtmod' fails

Don't squash a possibly legitimate libvirtmod error (e.g. some from
clashing libvirt.so versions) with 'Cannot import cygvirtmod'

13 years agoFix crash after calling virConnectCloseLIBVIRT_0_6_2LIBVIRT_0_6_3libvirt-0.6.2-19.fc11v0.6.2v0.6.3
Daniel P. Berrange [Wed, 1 Apr 2009 10:39:12 +0000 (1 10:39 +0000)]
Fix crash after calling virConnectClose

13 years agoFix generation of networkCreateXML and storagePoolCreateXML
Daniel P. Berrange [Wed, 1 Apr 2009 10:37:57 +0000 (1 10:37 +0000)]
Fix generation of networkCreateXML and storagePoolCreateXML

13 years agoupdate .gitignore and .hgignore filesLIBVIRT_0_6_1v0.6.1
Jim Meyering [Tue, 3 Mar 2009 11:25:00 +0000 (3 11:25 +0000)]
update .gitignore and .hgignore files

13 years agoInternal driver API for sVirt support (James Morris & Dan Walsh)
Daniel P. Berrange [Tue, 3 Mar 2009 09:14:28 +0000 (3 09:14 +0000)]
Internal driver API for sVirt support (James Morris & Dan Walsh)

13 years agoIgnore some generated autotools files in example app
Daniel P. Berrange [Mon, 2 Mar 2009 20:24:46 +0000 (2 20:24 +0000)]
Ignore some generated autotools files in example app

13 years ago* python/Makefile.am: avoid a parallel make issue #472702
Daniel Veillard [Thu, 26 Feb 2009 13:58:35 +0000 (26 13:58 +0000)]
* python/Makefile.am: avoid a parallel make issue #472702
  provided by Michael Marineau
Daniel

13 years agoFix building python bindings: Skip bindings for virSaveLastError and
Cole Robinson [Mon, 16 Feb 2009 22:44:49 +0000 (16 22:44 +0000)]
Fix building python bindings: Skip bindings for virSaveLastError and
virFreeError

13 years agoUse global thread-local error for all python error reportingLIBVIRT_0_6_0v0.6.0
Daniel P. Berrange [Tue, 20 Jan 2009 22:10:52 +0000 (20 22:10 +0000)]
Use global thread-local error for all python error reporting

13 years agoReplace __FUNCTION__ with __func__ for better portability (John Levon)
Daniel P. Berrange [Thu, 18 Dec 2008 12:25:11 +0000 (18 12:25 +0000)]
Replace __FUNCTION__ with __func__ for better portability (John Levon)

13 years agoFix gcc-ism in python build (John Levon)
Daniel P. Berrange [Thu, 18 Dec 2008 12:20:00 +0000 (18 12:20 +0000)]
Fix gcc-ism in python build (John Levon)

13 years agosyntax-check: enforce the no-cvs-keywords prohibition
Jim Meyering [Mon, 15 Dec 2008 10:24:54 +0000 (15 10:24 +0000)]
syntax-check: enforce the no-cvs-keywords prohibition

* Makefile.maint (sc_prohibit_cvs_keyword): New rule.
Suggested by Daniel Veillard.
The new test exposed two uses of $Date$.
* docs/Goals: Don't use $Date$.
* python/TODO: Likewise.

13 years agoSupport domain lifecycle events for Xen (Ben Guthro & Daniel Berrange)LIBVIRT_0_5_0LIBVIRT_0_5_1v0.5.0v0.5.1
Daniel P. Berrange [Tue, 25 Nov 2008 10:44:52 +0000 (25 10:44 +0000)]
Support domain lifecycle events for Xen (Ben Guthro & Daniel Berrange)

13 years agoFix python bindings events code (David Lively)
Daniel P. Berrange [Mon, 24 Nov 2008 19:28:12 +0000 (24 19:28 +0000)]
Fix python bindings events code (David Lively)

13 years agoPython binding for node device APIs (David Lively)
Daniel P. Berrange [Fri, 21 Nov 2008 12:41:15 +0000 (21 12:41 +0000)]
Python binding for node device APIs (David Lively)

13 years agoAdd a virFreeCallback to event loop APIs
Daniel P. Berrange [Wed, 19 Nov 2008 16:24:01 +0000 (19 16:24 +0000)]
Add a virFreeCallback to event loop APIs

13 years agoChange public API for virEventAddHandle to allow multiple registrations per FD
Daniel P. Berrange [Wed, 19 Nov 2008 16:19:36 +0000 (19 16:19 +0000)]
Change public API for virEventAddHandle to allow multiple registrations per FD

13 years agoAdd a virFreeCallback to virDomainEventRegister (from David Lively)
Daniel P. Berrange [Wed, 19 Nov 2008 15:25:24 +0000 (19 15:25 +0000)]
Add a virFreeCallback to virDomainEventRegister (from David Lively)

13 years agoAdd domain events detail information
Daniel P. Berrange [Mon, 17 Nov 2008 16:43:00 +0000 (17 16:43 +0000)]
Add domain events detail information

13 years agoFix domain events python thread safety & incorrect enum generation
Daniel P. Berrange [Mon, 17 Nov 2008 10:26:09 +0000 (17 10:26 +0000)]
Fix domain events python thread safety & incorrect enum generation

13 years ago* python/virConnect.py: needed for events from the python bindings
Daniel Veillard [Fri, 31 Oct 2008 13:56:47 +0000 (31 13:56 +0000)]
* python/virConnect.py: needed for events from the python bindings
  by Ben Guthro
daniel

13 years ago* python/Makefile.am python/generator.py python/libvir.c
Daniel Veillard [Fri, 31 Oct 2008 10:13:45 +0000 (31 10:13 +0000)]
* python/Makefile.am python/generator.py python/libvir.c
  python/libvir.py python/libvirt_wrap.h python/types.c:
  adds support for events from the python bindings, also
  improves the generator allowing to embbed per function
  definition files, patch by Ben Guthro
* examples/domain-events/events-python/event-test.py: also
  adds a programming example
Daniel

13 years agoMassive patch adding event APIs by Ben Guthro
Daniel Veillard [Thu, 23 Oct 2008 13:18:18 +0000 (23 13:18 +0000)]
Massive patch adding event APIs by Ben Guthro
* include/libvirt/libvirt.h include/libvirt/libvirt.h.in
  src/libvirt.c src/libvirt_sym.version: new libvirt event entry
  points, big patch provided by Ben Guthro
* Makefile.am configure.in src/driver.h src/event.c src/event.h
  src/internal.h src/libvirt.c src/libvirt_sym.version src/lxc_driver.c
  src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c
  src/remote_internal.c src/storage_backend_fs.c src/test.c
  qemud/event.c qemud/event.h qemud/mdns.c qemud/qemud.c
  qemud/qemud.h qemud/remote.c qemud/remote_dispatch_localvars.h
  qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h
  qemud/remote_protocol.c qemud/remote_protocol.h
  qemud/remote_protocol.x proxy/Makefile.am python/generator.py:
  Not much is left untouched by the patch adding the events support
* docs/libvirt-api.xml docs/libvirt-refs.xml
  docs/html/libvirt-libvirt.html: regenerated the docs
* examples/domain-events/events-c/Makefile.am
  examples/domain-events/events-c/event-test.c: a test example
* AUTHORS: added Ben Guthro
daniel

13 years agogenerate .gitignore files from .cvsignore ones
Jim Meyering [Fri, 17 Oct 2008 10:03:15 +0000 (17 10:03 +0000)]
generate .gitignore files from .cvsignore ones

* Makefile.maint (sync-vcs-ignore-files): New target.
Prompted by a patch from James Morris.
http://thread.gmane.org/gmane.comp.emulators.libvirt/8619/focus=8773
Add all (now-generated) .gitignore files.
* .gitignore: New file.
* build-aux/.gitignore: New file.
* docs/.gitignore: New file.
* docs/devhelp/.gitignore: New file.
* docs/examples/.gitignore: New file.
* docs/examples/python/.gitignore: New file.
* gnulib/lib/.gitignore: New file.
* gnulib/lib/arpa/.gitignore: New file.
* gnulib/lib/netinet/.gitignore: New file.
* gnulib/lib/sys/.gitignore: New file.
* gnulib/tests/.gitignore: New file.
* include/.gitignore: New file.
* include/libvirt/.gitignore: New file.
* po/.gitignore: New file.
* proxy/.gitignore: New file.
* python/.gitignore: New file.
* python/tests/.gitignore: New file.
* qemud/.gitignore: New file.
* src/.gitignore: New file.
* tests/.gitignore: New file.
* tests/confdata/.gitignore: New file.
* tests/sexpr2xmldata/.gitignore: New file.
* tests/virshdata/.gitignore: New file.
* tests/xencapsdata/.gitignore: New file.
* tests/xmconfigdata/.gitignore: New file.
* tests/xml2sexprdata/.gitignore: New file.

13 years agoXen interface order and fix python parallel build
Daniel Veillard [Wed, 1 Oct 2008 15:31:02 +0000 (1 15:31 +0000)]
Xen interface order and fix python parallel build
* src/xend_internal.c: fix ordering when parsing multiple Xen
  interfaces, patch by Jim Fehlig
* python/Makefile.am: fix parallel build
Daniel

13 years agoUse libvirt error message for python exceptionsLIBVIRT_0_4_6v0.4.6
Daniel P. Berrange [Fri, 22 Aug 2008 10:50:18 +0000 (22 10:50 +0000)]
Use libvirt error message for python exceptions

13 years agoFix connection lookup in python storage instances
Daniel Veillard [Tue, 12 Aug 2008 08:11:09 +0000 (12 08:11 +0000)]
Fix connection lookup in python storage instances
* python/generator.py: patch from Cole Robinson trying to fix
  problem of connection lookup when creating storage instances
Daniel

13 years agoSkip python bindings for virDomainBlockPeek and virDomainMemoryPeek
Daniel Veillard [Fri, 25 Jul 2008 12:37:06 +0000 (25 12:37 +0000)]
Skip python bindings for virDomainBlockPeek and virDomainMemoryPeek
* python/generator.py: skip generation for virDomainBlockPeek and
  virDomainMemoryPeek as they break the build
Daniel

14 years agoIgnore JIT'd python files
Daniel P. Berrange [Wed, 9 Jul 2008 08:17:51 +0000 (9 08:17 +0000)]
Ignore JIT'd python files

14 years ago* python/types.c: patch from Ryan Scott to remove misplaced verbosity
Daniel Veillard [Wed, 25 Jun 2008 11:42:27 +0000 (25 11:42 +0000)]
* python/types.c: patch from Ryan Scott to remove misplaced verbosity
  when compiling in debug mode.
Daniel

14 years ago* python/libvir.py python/libvirt-python-api.xml: more pythonLIBVIRT_0_4_4v0.4.4
Daniel Veillard [Wed, 11 Jun 2008 07:49:01 +0000 (11 07:49 +0000)]
* python/libvir.py python/libvirt-python-api.xml: more python
  cleanups by Cole Robinson
Daniel

14 years ago* python/generator.py python/libvir.c python/libvirt-python-api.xml:
Daniel Veillard [Tue, 10 Jun 2008 15:20:25 +0000 (10 15:20 +0000)]
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
  Apply patch from Cole Robinson fixing UUIDString for python
Daniel

14 years agoFix python code generation for storage APIs
Daniel P. Berrange [Thu, 29 May 2008 14:53:58 +0000 (29 14:53 +0000)]
Fix python code generation for storage APIs

14 years agoDon't free C object after destroy method in python
Daniel P. Berrange [Wed, 21 May 2008 20:18:20 +0000 (21 20:18 +0000)]
Don't free C object after destroy method in python

14 years agoPython header workaround
Daniel P. Berrange [Fri, 18 Apr 2008 18:31:32 +0000 (18 18:31 +0000)]
Python header workaround

14 years agoWork around Python.h name-space pollution.
Jim Meyering [Fri, 18 Apr 2008 18:07:40 +0000 (18 18:07 +0000)]
Work around Python.h name-space pollution.

* python/libvir.c (HAVE_PTHREAD_H): #undef.
Without this, we'd get a redefinition warning.