1. 06 9月, 2012 1 次提交
    • 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
  2. 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
  3. 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
  4. 20 6月, 2012 1 次提交
    • 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
  5. 19 6月, 2012 1 次提交
    • 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
  6. 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
  7. 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
  8. 28 3月, 2012 1 次提交
  9. 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
  10. 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
  11. 22 3月, 2012 2 次提交
  12. 21 3月, 2012 1 次提交
  13. 16 2月, 2012 1 次提交
    • A
      python: Expose virDomain{G,S}etInterfaceParameters APIs in python binding · 8b29c459
      Alex Jia 提交于
      The v4 patch corrects indentation issues.
      
      The v3 patch follows latest python binding codes and change 'size'
      type from int to Py_ssize_t.
      
      An simple example to show how to use it:
      
      #!/usr/bin/env python
      
      import libvirt
      
      conn = libvirt.open(None)
      dom = conn.lookupByName('foo')
      
      print dom.interfaceParameters('vnet0', 0)
      
      params = {'outbound.peak': 10,
                'inbound.peak': 10,
                'inbound.burst': 20,
                'inbound.average': 20,
                'outbound.average': 30,
                'outbound.burst': 30}
      
      print dom.setInterfaceParameters('vnet0', params, 0)
      print dom.interfaceParameters('vnet0', 0)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      8b29c459
  14. 11 2月, 2012 1 次提交
    • G
      python: make other APIs share common {get, set}PyVirTypedParameter · 56cec18d
      Guannan Ren 提交于
              *libvirt_virDomainBlockStatsFlags
              *libvirt_virDomainGetSchedulerParameters
              *libvirt_virDomainGetSchedulerParametersFlags
              *libvirt_virDomainSetSchedulerParameters
              *libvirt_virDomainSetSchedulerParametersFlags
              *libvirt_virDomainSetBlkioParameters
              *libvirt_virDomainGetBlkioParameters
              *libvirt_virDomainSetMemoryParameters
              *libvirt_virDomainGetMemoryParameters
              *libvirt_virDomainSetBlockIoTune
              *libvirt_virDomainGetBlockIoTune
      56cec18d
  15. 10 2月, 2012 1 次提交
  16. 09 2月, 2012 1 次提交
    • O
      python: Correct arguments number for migrateSetMaxSpeed · 4165d68a
      Osier Yang 提交于
      The API definition accepts "flags" argument, however, the
      implementation ignores it, though "flags" is unused currently,
      we should expose it instead of hard coding, the API
      implementation inside hypervisor driver is responsible to check
      if the passed "flags" is valid.
      4165d68a
  17. 04 2月, 2012 2 次提交
    • M
      Added missing memory reporting into python bindings · 5a4ed59a
      Martin Kletzander 提交于
      Two types of memory stats were not reported by python bindings. This
      patch fixes both of them.
      5a4ed59a
    • E
      python: use libvirt_util to avoid raw free · c700613b
      Eric Blake 提交于
      This patch starts the process of elevating the python binding code
      to be on the same level as the rest of libvirt when it comes to
      requiring good coding styles.  Statically linking against the
      libvirt_util library makes it much easier to write good code,
      rather than having to open-code and reinvent things locally.
      
      Done by global search and replace of s/free(/VIR_FREE(/, followed
      by hand-inspection of remaining malloc and redundant memset.
      
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation):
      Remove python from exemption.
      * python/Makefile.am (INCLUDES): Add gnulib and src/util.  Drop
      $(top_builddir)/$(subdir), as automake already guarantees that.
      (mylibs, myqemulibs): Pull in libvirt_util and gnulib.
      (libvirtmod_la_CFLAGS): Catch compiler warnings if configured to
      use -Werror.
      * python/typewrappers.c (libvirt_charPtrSizeWrap)
      (libvirt_charPtrWrap): Convert free to VIR_FREE.
      * python/generator.py (print_function_wrapper): Likewise.
      * python/libvirt-override.c: Likewise.
      c700613b
  18. 01 2月, 2012 1 次提交
  19. 29 12月, 2011 2 次提交
  20. 20 12月, 2011 1 次提交
    • A
      python: plug memory leak on libvirt_virConnectOpenAuth · 78496224
      Alex Jia 提交于
      * Detected by valgrind. Leak introduced in commit 5ab109f8.
      
      * python/libvirt-override.c: avoid memory leak on libvirt_virConnectOpenAuth.
      
      * How to reproduce?
      
        % valgrind -v --leak-check=full virt-clone --print-xml
        Note: it can hit the issue although options are incomplete.
      
      * Actual valgrind result:
      
      ==1801== 12 bytes in 1 blocks are definitely lost in loss record 25 of 3,270
      ==1801==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==1801==    by 0xCF1F60E: libvirt_virConnectOpenAuth (libvirt-override.c:1507)
      ==1801==    by 0x3AFEEDE7F3: PyEval_EvalFrameEx (ceval.c:3794)
      ==1801==    by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880)
      ==1801==    by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880)
      ==1801==    by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880)
      ==1801==    by 0x3AFEEDF99E: PyEval_EvalFrameEx (ceval.c:3880)
      ==1801==    by 0x3AFEEE0466: PyEval_EvalCodeEx (ceval.c:3044)
      ==1801==    by 0x3AFEEE0541: PyEval_EvalCode (ceval.c:545)
      ==1801==    by 0x3AFEEFB88B: run_mod (pythonrun.c:1351)
      ==1801==    by 0x3AFEEFB95F: PyRun_FileExFlags (pythonrun.c:1337)
      ==1801==    by 0x3AFEEFCE4B: PyRun_SimpleFileExFlags (pythonrun.c:941)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      78496224
  21. 15 12月, 2011 1 次提交
    • O
      python: Expose blockPeek and memoryPeek in Python binding · d758e0cb
      Osier Yang 提交于
      A simple example to show how to use it:
      
      \#! /usr/bin/python
      
      import os
      import sys
      import libvirt
      
      disk = "/var/lib/libvirt/images/test.img"
      
      conn = libvirt.open(None)
      dom = conn.lookupByName('test')
      
      mem_contents = dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_VIRTUAL);
      sys.stdout.write(mem_contents)
      
      % python test.py | hexdump
      0000000 1660 0209 0000 0000 0000 0000 0000 0000
      0000010 0000 0000 0000 0000 d3a0 01d0 0000 0000
      0000020
      d758e0cb
  22. 14 12月, 2011 1 次提交
  23. 05 12月, 2011 2 次提交
  24. 01 12月, 2011 1 次提交
  25. 25 10月, 2011 1 次提交
    • M
      startupPolicy: Emit event on disk source dropping · baf2ff7e
      Michal Privoznik 提交于
      If a disk source gets dropped because it is not accessible,
      mgmt application might want to be informed about this. Therefore
      we need to emit an event. The event presented in this patch
      is however a bit superset of what written above. The reason is simple:
      an intention to be easily expanded, e.g. on 'user ejected disk
      in guest' events. Therefore, callback gets source string and disk alias
      (which should be unique among a domain) and reason (an integer);
      baf2ff7e
  26. 11 10月, 2011 1 次提交
    • E
      snapshot: new virDomainSnapshotListChildrenNames API · f2013c9d
      Eric Blake 提交于
      The previous API addition allowed traversal up the hierarchy;
      this one makes it easier to traverse down the hierarchy.
      
      In the python bindings, virDomainSnapshotNumChildren can be
      generated, but virDomainSnapshotListChildrenNames had to copy
      from the hand-written example of virDomainSnapshotListNames.
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotNumChildren)
      (virDomainSnapshotListChildrenNames): New prototypes.
      (VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS): New flag alias.
      * src/libvirt.c (virDomainSnapshotNumChildren)
      (virDomainSnapshotListChildrenNames): New functions.
      * src/libvirt_public.syms: Export them.
      * src/driver.h (virDrvDomainSnapshotNumChildren)
      (virDrvDomainSnapshotListChildrenNames): New callbacks.
      * python/generator.py (skip_impl, nameFixup): Update lists.
      * python/libvirt-override-api.xml: Likewise.
      * python/libvirt-override.c
      (libvirt_virDomainSnapshotListChildrenNames): New wrapper function.
      f2013c9d
  27. 06 9月, 2011 1 次提交
  28. 02 9月, 2011 1 次提交
  29. 03 8月, 2011 1 次提交
  30. 28 7月, 2011 4 次提交