1. 17 9月, 2012 2 次提交
    • O
      list: Expose virConnectListAllNodeDevices to Python binding · a3676b6c
      Osier Yang 提交于
      The implementation is done manually as the generator does not support
      wrapping lists of C pointers into Python objects.
      
      python/libvirt-override-api.xml: Document
      
      python/libvirt-override-virConnect.py:
        * Implementation for listAllNodeDevices.
      
      python/libvirt-override.c: Implementation for the wrapper.
      a3676b6c
    • O
      list: Define new API virConnectListAllNodeDevices · c6a3be5d
      Osier Yang 提交于
      This is to list the node device objects, supports to filter the results
      by capability types.
      
      include/libvirt/libvirt.h.in: Declare enum virConnectListAllNodeDeviceFlags
                                    and virConnectListAllNodeDevices.
      python/generator.py: Skip auto-generating
      src/driver.h: (virDrvConnectListAllNodeDevices)
      src/libvirt.c: Implement the public API
      src/libvirt_public.syms: Export the symbol to public
      c6a3be5d
  2. 12 9月, 2012 3 次提交
    • O
      list: Expose virConnectListAllInterfaces to Python binding · ec448fbf
      Osier Yang 提交于
      The implementation is done manually as the generator does not support
      wrapping lists of C pointers into Python objects.
      
      python/libvirt-override-api.xml: Document
      
      python/libvirt-override-virConnect.py:
        * New file, includes implementation of listAllInterfaces.
      
      python/libvirt-override.c: Implementation for the wrapper.
      ec448fbf
    • O
      list: Define new API virConnectListAllInterfaces · f4af202f
      Osier Yang 提交于
      This is to list the interface objects, supported filtering flags
      are: active|inactive.
      
      include/libvirt/libvirt.h.in: Declare enum virConnectListAllInterfaceFlags
                                    and virConnectListAllInterfaces.
      python/generator.py: Skip auto-generating
      src/driver.h: (virDrvConnectListAllInterfaces)
      src/libvirt.c: Implement the public API
      src/libvirt_public.syms: Export the symbol to public
      f4af202f
    • F
      python: Initialize new_params in virDomainSetSchedulerParameters · 984a73c0
      Federico Simoncelli 提交于
      The new_params variable must be initialized in case the
      virDomainGetSchedulerParameters call fails and we hit the cleanup
      section before actually allocating the new parameters.
      Signed-off-by: NFederico Simoncelli <fsimonce@redhat.com>
      984a73c0
  3. 11 9月, 2012 5 次提交
  4. 10 9月, 2012 2 次提交
    • O
      list: Expose virStoragePoolListAllVolumes to Python binding · fa2e35a3
      Osier Yang 提交于
      The implementation is done manually as the generator does not support
      wrapping lists of C pointers into Python objects.
      
      python/libvirt-override-api.xml: Document
      
      python/libvirt-override-virStoragePool.py:
        * New file, includes implementation of listAllVolumes.
      
      python/libvirt-override.c: Implementation for the wrapper.
      fa2e35a3
    • O
      list: Define new API virStoragePoolListAllVolumes · a42eac60
      Osier Yang 提交于
      Simply returns the storage volume objects. No supported filter
      flags.
      
      include/libvirt/libvirt.h.in: Declare the API
      python/generator.py: Skip the function for generating. virStoragePool.py
                           will be added in later patch.
      src/driver.h: virDrvStoragePoolListVolumesFlags
      src/libvirt.c: Implementation for the API.
      src/libvirt_public.syms: Export the symbol to public
      a42eac60
  5. 07 9月, 2012 1 次提交
    • J
      Fix PMSuspend and PMWakeup events · afab4824
      Jiri Denemark 提交于
      The unused reason parameter of PM{Suspend,Wakeup} event callbacks was
      completely ignored in lot of places and those events were not actually
      working at all.
      afab4824
  6. 06 9月, 2012 2 次提交
    • O
      python: Expose virStorageListAllStoragePools to python binding · 92785780
      Osier Yang 提交于
      The implementation is done manually as the generator does not support
      wrapping lists of C pointers into Python objects.
      
      python/libvirt-override-api.xml: Document
      python/libvirt-override-virConnect.py: Add listAllStoragePools
      python/libvirt-override.c: Implementation for the wrapper.
      92785780
    • O
      list: Define new API virStorageListAllStoragePools · 075c754a
      Osier Yang 提交于
      This introduces a new API to list the storage pool objects,
      4 groups of flags are provided to filter the returned pools:
      
        * Active or not
      
        * Autostarting or not
      
        * Persistent or not
      
        * And the pool type.
      
      include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags;
                                    Declare the API.
      python/generator.py: Skip the generating
      src/driver.h: (virDrvConnectListAllStoragePools)
      src/libvirt.c: Implementation for the API.
      src/libvirt_public.syms: Export the symbol.
      075c754a
  7. 01 9月, 2012 1 次提交
    • E
      python: don't mask libvirt errors · 63bfc598
      Eric Blake 提交于
      A user reported this crash when using python bindings:
      
        File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger
          hook.trigger(event)
        File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger
          self.handlers[event]()
        File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump
          for block in Memory(self.ctx):
        File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next
          libvirt.VIR_MEMORY_PHYSICAL)
        File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek
          ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags)
      SystemError: error return without exception set
      
      In the python bindings, returning NULL makes python think an
      exception was thrown, while returning the None object lets the
      wrappers know that a libvirt error exists.
      
      Reported by Nox DaFox, fix suggested by Dan Berrange.
      
      * python/libvirt-override.c (libvirt_virDomainBlockPeek)
      (libvirt_virDomainMemoryPeek): Return python's None object, so
      wrapper knows to check libvirt error.
      63bfc598
  8. 23 8月, 2012 2 次提交
  9. 21 8月, 2012 1 次提交
  10. 30 7月, 2012 1 次提交
  11. 14 7月, 2012 1 次提交
    • D
      Define public API for receiving guest memory balloon events · 7ed6d7dd
      Daniel P. Berrange 提交于
      When the guest changes its memory balloon applications may want
      to know what the new value is, without having to periodically
      poll on XML / domain info. Introduce a "balloon change" event
      to let apps see this
      
      * include/libvirt/libvirt.h.in: Define the
        virConnectDomainEventBalloonChangeCallback callback
        and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant
      * python/libvirt-override-virConnect.py,
        python/libvirt-override.c: Wire up helpers for new event
      * daemon/remote.c: Helper for serializing balloon event
      * examples/domain-events/events-c/event-test.c,
        examples/domain-events/events-python/event-test.py: Add
        example of balloon event usage
      * src/conf/domain_event.c, src/conf/domain_event.h: Handling
        of balloon events
      * src/remote/remote_driver.c: Add handler of balloon events
      * src/remote/remote_protocol.x: Define wire protocol for
        balloon events
      * src/remote_protocol-structs: Likewise.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7ed6d7dd
  12. 20 6月, 2012 2 次提交
    • E
      list: provide python bindings for snapshots · f73d99c2
      Eric Blake 提交于
      This adds support for the new virDomainListAllSnapshots (a domain
      function) and virDomainSnapshotListAllChildren (a snapshot function)
      to the libvirt-python bindings.  The implementation is done manually
      as the generator does not support wrapping lists of C pointers into
      python objects.
      
      * python/libvirt-override.c (libvirt_virDomainListAllSnapshots)
      (libvirt_virDomainSnapshotListAllChildren): New functions.
      * python/libvirt-override-api.xml: Document them.
      * python/libvirt-override-virDomain.py (listAllSnapshots): New
      file.
      * python/libvirt-override-virDomainSnapshot.py (listAllChildren):
      Likewise.
      * python/Makefile.am (CLASSES_EXTRA): Ship them.
      f73d99c2
    • E
      list: add virDomainListAllSnapshots API · 37bb0447
      Eric Blake 提交于
      There was an inherent race between virDomainSnapshotNum() and
      virDomainSnapshotListNames(), where an additional snapshot could
      be created in the meantime, or where a snapshot could be deleted
      before converting the name back to a virDomainSnapshotPtr.  It
      was also an awkward name: the function operates on domains, not
      domain snapshots.  virDomainSnapshotListChildrenNames() suffered
      from the same inherent race, although its naming was nicer.
      
      This patch makes things nicer by grabbing a snapshot list
      atomically, in the format most useful to the user.
      
      * include/libvirt/libvirt.h.in (virDomainListAllSnapshots)
      (virDomainSnapshotListAllChildren): New declarations.
      * src/libvirt.c (virDomainSnapshotListNames)
      (virDomainSnapshotListChildrenNames): Add cross-references.
      (virDomainListAllSnapshots, virDomainSnapshotListAllChildren):
      New functions.
      * src/libvirt_public.syms (LIBVIRT_0.9.13): Export them.
      * src/driver.h (virDrvDomainListAllSnapshots)
      (virDrvDomainSnapshotListAllChildren): New callbacks.
      * python/generator.py (skip_function): Prepare for later
      hand-written versions.
      37bb0447
  13. 19 6月, 2012 2 次提交
    • P
      python: add API exports for virConnectListAllDomains() · bd34cc8c
      Peter Krempa 提交于
      This patch adds export of the new API function
      virConnectListAllDomains() to the libvirt-python bindings. The
      virConnect object now has method "listAllDomains" that takes only the
      flags parameter and returns a python list of virDomain object
      corresponding to virDomainPtrs returned by the underlying api.
      
      The implementation is done manually as the generator does not support
      wrapping list of virDomainPtrs into virDomain objects.
      bd34cc8c
    • P
      lib: Add public api to enable atomic listing of guest · 747f64ee
      Peter Krempa 提交于
      This patch adds a new public api that lists domains. The new approach is
      different from those used before. There are key points to this:
      
      1) The list is acquired atomically and contains both active and inactive
      domains (guests). This eliminates the need to call two different list
      APIs, where the state might change in between the calls.
      
      2) The returned list consists of virDomainPtrs instead of names or ID's
      that have to be converted to virDomainPtrs anyways using separate calls
      for each one of them. This is more convenient and saves hypervisor calls.
      
      3) The returned list is auto-allocated. This saves a lot of hassle for
      the users.
      
      4) Built in support for filtering. The API call supports various
      filtering flags that modify the output list according to user needs.
      
      Available filter groups:
          Domain status:
          VIR_CONNECT_LIST_DOMAINS_ACTIVE, VIR_CONNECT_LIST_DOMAINS_INACTIVE
      
          Domain persistence:
          VIR_CONNECT_LIST_DOMAINS_PERSISTENT,
          VIR_CONNECT_LIST_DOMAINS_TRANSIENT
      
          Domain state:
          VIR_CONNECT_LIST_DOMAINS_RUNNING, VIR_CONNECT_LIST_DOMAINS_PAUSED,
          VIR_CONNECT_LIST_DOMAINS_SHUTOFF, VIR_CONNECT_LIST_DOMAINS_OTHER
      
          Existence of managed save image:
          VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE,
          VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE
      
          Auto-start option:
          VIR_CONNECT_LIST_DOMAINS_AUTOSTART,
          VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART
      
          Existence of snapshot:
          VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT,
          VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT
      
      5) The python binding returns a list of domain objects that is very neat
      to work with.
      
      The only problem with this approach is no support from code generators
      so both RPC code and python bindings had to be written manually.
      
      *include/libvirt/libvirt.h.in: - add API prototype
                                     - clean up whitespace mistakes nearby
      *python/generator.py: - inhibit generation of the bindings for the new
                              api
      *src/driver.h: - add driver prototype
                     - clean up some whitespace mistakes nearby
      *src/libvirt.c: - add public implementation
      *src/libvirt_public.syms: - export the new symbol
      747f64ee
  14. 12 6月, 2012 2 次提交
    • E
      python: fix snapshot listing bugs · a0de5d78
      Eric Blake 提交于
      Python exceptions are different than libvirt errors, and we had
      some corner case bugs on OOM situations.
      
      * python/libvirt-override.c (libvirt_virDomainSnapshotListNames)
      (libvirt_virDomainSnapshotListChildrenNames): Use correct error
      returns, avoid segv on OOM, and avoid memory leaks on error.
      a0de5d78
    • E
      python: use simpler methods · 8566618f
      Eric Blake 提交于
      * python/libvirt-override.c (libvirt_virDomainGetVcpus)
      (libvirt_virDomainGetVcpuPinInfo): Use Py_XDECREF instead of
      open-coding it.
      8566618f
  15. 04 5月, 2012 1 次提交
    • O
      Coverity: Fix the forward_null error in Python binding codes · b80f4db9
      Osier Yang 提交于
      Related coverity log:
      
      Error: FORWARD_NULL:
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355:
      assign_zero: Assigning: "params" = 0.
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458:
      var_deref_model: Passing null variable "params" to function
      "getPyVirTypedParameter", which dereferences it. (The dereference is assumed on
      the basis of the 'nonnull' parameter attribute.)
      b80f4db9
  16. 28 4月, 2012 1 次提交
  17. 10 4月, 2012 1 次提交
    • S
      Fix compilation error on 32bit · 4e9bb1df
      Stefan Berger 提交于
      Below code failed to compile on a 32 bit machine with error
      
      typewrappers.c: In function 'libvirt_intUnwrap':
      typewrappers.c:135:5: error: logical 'and' of mutually exclusive tests is always false [-Werror=logical-op]
      cc1: all warnings being treated as errors
      
      The patch fixes this error.
      4e9bb1df
  18. 31 3月, 2012 1 次提交
    • E
      python: improve conversion validation · 4a86c2bb
      Eric Blake 提交于
      Laszlo Ersek pointed out that in trying to convert a long to an
      unsigned int, we used:
      
      long long_val = ...;
      if ((unsigned int)long_val == long_val)
      
      According to C99 integer promotion rules, the if statement is
      equivalent to:
      
      (unsigned long)(unsigned int)long_val == (unsigned long)long_val
      
      since you get an unsigned comparison if at least one side is
      unsigned, using the largest rank of the two sides; but on 32-bit
      platforms, where unsigned long and unsigned int are the same size,
      this comparison is always true and ends up converting negative
      long_val into posigive unsigned int values, rather than rejecting
      the negative value as we had originally intended (python longs
      are unbounded size, and we don't want to do silent modulo
      arithmetic when converting to C code).
      
      Fix this by using direct comparisons, rather than casting.
      
      * python/typewrappers.c (libvirt_intUnwrap, libvirt_uintUnwrap)
      (libvirt_ulongUnwrap, libvirt_ulonglongUnwrap): Fix conversion
      checks.
      4a86c2bb
  19. 28 3月, 2012 2 次提交
    • G
      python: make python APIs use these helper functions · 1aeb3d9e
      Guannan Ren 提交于
          *setPyVirTypedParameter
          *libvirt_virDomainGetCPUStats
      1aeb3d9e
    • G
      python: Add new helper functions for python to C integral conversion · 384ebd3f
      Guannan Ren 提交于
          int libvirt_intUnwrap(PyObject *obj, int *val);
          int libvirt_uintUnwrap(PyObject *obj, unsigned int *val);
          int libvirt_longUnwrap(PyObject *obj, long *val);
          int libvirt_ulongUnwrap(PyObject *obj, unsigned long *val);
          int libvirt_longlongUnwrap(PyObject *obj, long long *val);
          int libvirt_ulonglongUnwrap(PyObject *obj, unsigned long long *val);
          int libvirt_doubleUnwrap(PyObject *obj, double *val);
          int libvirt_boolUnwrap(PyObject *obj, bool *val);
      384ebd3f
  20. 27 3月, 2012 1 次提交
    • M
      Cleanup for a return statement in source files · 9943276f
      Martin Kletzander 提交于
      Return statements with parameter enclosed in parentheses were modified
      and parentheses were removed. The whole change was scripted, here is how:
      
      List of files was obtained using this command:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$'
      
      Found files were modified with this command:
      sed -i -e                                                                 \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      
      Then checked for nonsense.
      
      The whole command looks like this:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      9943276f
  21. 23 3月, 2012 3 次提交
    • O
      Add support for the suspend event · 487c0633
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      SUSPEND:
      
          VIR_DOMAIN_EVENT_ID_PMSUSPEND
      
      The event doesn't take any data, but considering there might
      be reason for wakeup in future, the callback definition is:
      
      typedef void
      (*virConnectDomainEventSuspendCallback)(virConnectPtr conn,
                                              virDomainPtr dom,
                                              int reason,
                                              void *opaque);
      
      "reason" is unused currently, always passes "0".
      487c0633
    • O
      Add support for the wakeup event · 57ddcc23
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      WAKEUP:
      
          VIR_DOMAIN_EVENT_ID_PMWAKEUP
      
      The event doesn't take any data, but considering there might
      be reason for wakeup in future, the callback definition is:
      
      typedef void
      (*virConnectDomainEventWakeupCallback)(virConnectPtr conn,
                                             virDomainPtr dom,
                                             int reason,
                                             void *opaque);
      
      "reason" is unused currently, always passes "0".
      57ddcc23
    • O
      Add support for event tray moved of removable disks · a26a1969
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      DEVICE_TRAY_MOVED, which occurs when the tray of a removable
      disk is moved (i.e opened or closed):
      
          VIR_DOMAIN_EVENT_ID_TRAY_CHANGE
      
      The event's data includes the device alias and the reason
      for tray status' changing, which indicates why the tray
      status was changed. Thus the callback definition for the event
      is:
      
      enum {
          VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0,
          VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE,
      
      \#ifdef VIR_ENUM_SENTINELS
          VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST
      \#endif
      } virDomainEventTrayChangeReason;
      
      typedef void
      (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn,
                                                 virDomainPtr dom,
                                                 const char *devAlias,
                                                 int reason,
                                                 void *opaque);
      a26a1969
  22. 22 3月, 2012 2 次提交
  23. 21 3月, 2012 1 次提交