1. 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
  2. 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
  3. 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
  4. 22 3月, 2012 2 次提交
  5. 21 3月, 2012 2 次提交
    • A
      python: Avoid memory leaks on libvirt_virNodeGetMemoryStats · 53b45aa4
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit 17c77955.
      
      * python/libvirt-override.c (libvirt_virNodeGetMemoryStats): fix memory leaks
      and improve codes return value.
      
      For details, please see the following link:
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770944Signed-off-by: NAlex Jia <ajia@redhat.com>
      53b45aa4
    • E
      python: always include config.h first · 2791b8ab
      Eric Blake 提交于
      On RHEL 5.7, I got this compilation failure:
      
      In file included from /usr/include/python2.4/pyport.h:98,
                       from /usr/include/python2.4/Python.h:55,
                       from libvirt.c:3:
      ../gnulib/lib/time.h:468: error: expected ';', ',' or ')' before '__timer'
      
      Turns out that our '#define restrict __restrict' from config.h wasn't
      being picked up.  Gnulib _requires_ that all .c files include <config.h>
      first, otherwise the gnulib header overrides tend to misbehave.
      
      Problem introduced by patch c700613b.
      
      * python/generator.py (buildStubs): Include <config.h> first.
      2791b8ab
  6. 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
  7. 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
  8. 10 2月, 2012 1 次提交
  9. 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
  10. 08 2月, 2012 1 次提交
  11. 07 2月, 2012 1 次提交
  12. 04 2月, 2012 5 次提交
    • E
      maint: consolidate several .gitignore files · 8f00276c
      Eric Blake 提交于
      Unlike .cvsignore under CVS, git allows for ignoring nested
      names.  We weren't very consistent where new tests were
      being ignored (some in .gitignore, some in tests/.gitignore),
      and I found it easier to just consolidate everything.
      
      * .gitignore: Subsume entries from subdirectories.
      * daemon/.gitignore: Delete.
      * docs/.gitignore: Likewise.
      * docs/devhelp/.gitignore: Likewise.
      * docs/html/.gitignore: Likewise.
      * examples/dominfo/.gitignore: Likewise.
      * examples/domsuspend/.gitignore: Likewise.
      * examples/hellolibvirt/.gitignore: Likewise.
      * examples/openauth/.gitignore: Likewise.
      * examples/domain-events/events-c/.gitignore: Likewise.
      * include/libvirt/.gitignore: Likewise.
      * src/.gitignore: Likewise.
      * src/esx/.gitignore: Likewise.
      * tests/.gitignore: Likewise.
      * tools/.gitignore: Likewise.
      8f00276c
    • 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
    • E
      python: drop redundant function · 25adc8f4
      Eric Blake 提交于
      I noticed some redundant code while preparing my next patch.
      
      * python/generator.py (py_types): Fix 'const char *' mapping.
      * python/typewrappers.h (libvirt_charPtrConstWrap): Drop.
      * python/typewrappers.c (libvirt_charPtrConstWrap): Delete, since
      it is identical to libvirt_constcharPtrWrap.
      25adc8f4
    • E
      build: clean up CPPFLAGS/INCLUDES usage · cb33ee1f
      Eric Blake 提交于
      Our syntax checker missed all-lower-case variables (this will
      be fixed by the next .gnulib update).  Additionally, anywhere
      that we mix in-tree files with generated files, automake recommends
      listing builddir prior to srcdir for VPATH builds.
      
      * src/Makefile.am (*_la_CFLAGS): Favor $(top_srcdir).
      (INCLUDES): Likewise, and follow automake recommendations on
      builddir before srcdir.
      * python/Makefile.am (INCLUDES): Swap directory order.
      * tests/Makefile.am (INCLUDES): Likewise.
      * tools/Makefile.am (INCLUDES): Likewise.
      * daemon/Makefile.am (INCLUDES): Likewise.
      (libvirtd.init, libvirtd.service): Favor $().
      * examples/hellolibvirt/Makefile.am (hellolibvirt_LDADD):
      Likewise.
      * examples/openauth/Makefile.am (openauth_LDADD): Likewise.
      * examples/dominfo/Makefile.am (INCLUDES): Drop dead include.
      * examples/domsuspend/Makefile.am (INCLUDES): Likewise.
      cb33ee1f
  13. 01 2月, 2012 3 次提交
  14. 28 1月, 2012 2 次提交
    • K
      Add new public API virDomainGetCPUStats() · e1eea747
      KAMEZAWA Hiroyuki 提交于
      add new API virDomainGetCPUStats() for getting cpu accounting information
      per real cpus which is used by a domain.  The API is designed to allow
      future extensions for additional statistics.
      
      based on ideas by Lai Jiangshan and Eric Blake.
      
      * src/libvirt_public.syms: add API for LIBVIRT_0.9.10
      * src/libvirt.c: define virDomainGetCPUStats()
      * include/libvirt/libvirt.h.in: add virDomainGetCPUStats() header
      * src/driver.h: add driver API
      * python/generator.py: add python API (as not implemented)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e1eea747
    • Z
      resize: add virStorageVolResize() API · 6714fd04
      Zeeshan Ali (Khattak) 提交于
      Add a new function to allow changing of capacity of storage volumes.
      Plan out several flags, even if not all of them will be implemented
      up front.
      
      Expose the new command via 'virsh vol-resize'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6714fd04
  15. 21 1月, 2012 1 次提交
    • E
      API: make declaration of _LAST enum values conditional · 7b4e5693
      Eric Blake 提交于
      Although this is a public API break, it only affects users that
      were compiling against *_LAST values, and can be trivially
      worked around without impacting compilation against older
      headers, by the user defining VIR_ENUM_SENTINELS before using
      libvirt.h.  It is not an ABI break, since enum values do not
      appear as .so entry points.  Meanwhile, it prevents users from
      using non-stable enum values without explicitly acknowledging
      the risk of doing so.
      
      See this list discussion:
      https://www.redhat.com/archives/libvir-list/2012-January/msg00804.html
      
      * include/libvirt/libvirt.h.in: Hide all sentinels behind
      LIBVIRT_ENUM_SENTINELS, and add missing sentinels.
      * src/internal.h (VIR_DEPRECATED): Allow inclusion after
      libvirt.h.
      (LIBVIRT_ENUM_SENTINELS): Expose sentinels internally.
      * daemon/libvirtd.h: Use the sentinels.
      * src/remote/remote_protocol.x (includes): Don't expose sentinels.
      * python/generator.py (enum): Likewise.
      * tests/cputest.c (cpuTestCompResStr): Silence compiler warning.
      * tools/virsh.c (vshDomainStateReasonToString)
      (vshDomainControlStateToString): Likewise.
      7b4e5693
  16. 29 12月, 2011 3 次提交
    • H
      domiftune: Add API virDomain{S,G}etInterfaceParameters · 85f3493f
      Hu Tao 提交于
      The APIs are used to set/get domain's network interface's parameters.
      Currently supported parameters are bandwidth settings.
      
      * include/libvirt/libvirt.h.in: new API and parameters definition
      * python/generator.py: skip the Python API generation
      * src/driver.h: add new entry to the driver structure
      * src/libvirt_public.syms: export symbols
      85f3493f
    • D
      remove a static limit on max domains in python bindings · f0293edc
      Daniel Veillard 提交于
      * python/libvirt-override.c: remove the predefined array in the
        virConnectListDomainsID binding and call virConnectNumOfDomains
        to do a proper allocation
      f0293edc
    • A
      python: Fix problems of virDomain{Set, Get}BlockIoTune bindings · ae3315aa
      Alex Jia 提交于
      The parameter 'params' is useless for virDomainGetBlockIoTune API,
      and the return value type should be a virTypedParameterPtr but not
      integer. And "PyArg_ParseTuple" in functions
      libvirt_virDomain{Set,Get}BlockIoTune misses format unit for "format"
      argument.
      
      * libvirt-override-api.xml: Remove useless the parameter 'params'
      from virDomainGetBlockIoTune API, and change return value type from
      integer to virTypedParameterPtr.
      
      * python/libvirt-override.c: Add the missed format units.
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770683Signed-off-by: NAlex Jia <ajia@redhat.com>
      ae3315aa
  17. 21 12月, 2011 1 次提交
  18. 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
  19. 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
  20. 14 12月, 2011 1 次提交
  21. 05 12月, 2011 2 次提交
  22. 01 12月, 2011 1 次提交
  23. 30 11月, 2011 1 次提交
  24. 01 11月, 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