1. 15 11月, 2014 1 次提交
  2. 26 9月, 2014 1 次提交
  3. 24 9月, 2014 2 次提交
  4. 22 8月, 2014 1 次提交
  5. 20 1月, 2014 1 次提交
  6. 25 12月, 2013 1 次提交
    • M
      event-test: Unregister close callback · f7fee15a
      Michal Privoznik 提交于
      When registering a close callback, the connection refcount is increased
      as the connection object is passed to the callback and hence we must
      prevent deleting it too soon. However, when closing the connection, the
      connection object is just unrefed. So whenever a connection with a close
      callback is closed, we end up with the connection object which has
      exactly one reference. Leaving the code as-is doesn't mean the end of
      the world as we know it, but why give a bad example?
      
      ==14531== 288 bytes in 1 blocks are still reachable in loss record 695 of 762
      ==14531==    at 0x4C2BDE4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==14531==    by 0x4E9FE09: virAllocVar (viralloc.c:558)
      ==14531==    by 0x4EDBE45: virObjectNew (virobject.c:190)
      ==14531==    by 0x4F71AAC: virGetConnect (datatypes.c:116)
      ==14531==    by 0x4F78511: do_open (libvirt.c:1136)
      ==14531==    by 0x4F7B3AC: virConnectOpenAuth (libvirt.c:1481)
      ==14531==    by 0x4011D2: main (event-test.c:499)
      
      (and other leaks tied to virGetConnect())
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f7fee15a
  7. 14 12月, 2013 2 次提交
  8. 30 7月, 2013 1 次提交
    • E
      examples: fix mingw build vs. printf · 6f4458a0
      Eric Blake 提交于
      Mingw *printf is a moving target; newer mingw now provides a version
      of asprintf() that fails to understand %lld:
      
        CC       event_test-event-test.o
      ../../../../examples/domain-events/events-c/event-test.c: In function 'myDomainEventRTCChangeCallback':
      ../../../../examples/domain-events/events-c/event-test.c:270:18: error: unknown conversion type character 'l' in format [-Werror=format=]
                        virDomainGetID(dom), offset) < 0)
                        ^
      
      But since our examples already admitted that they were hacking around
      a mingw deficiency, it is easier to just use printf() directly, coupled
      with <inttypes.h> macros, for a more portable work-around.
      
      * examples/domain-events/events-c/event-test.c
      (myDomainEventRTCChangeCallback): Use PRIdMAX instead of asprintf.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6f4458a0
  9. 18 7月, 2013 1 次提交
  10. 11 7月, 2013 1 次提交
  11. 03 7月, 2013 1 次提交
  12. 21 5月, 2013 1 次提交
  13. 10 5月, 2013 2 次提交
    • J
      dom event example: Add error check to impl call · 854b91cd
      Jesse J. Cook 提交于
      Added error checking to virEventRegisterDefaultImpl call for consistency.
      854b91cd
    • J
      dom event example: init before register event impl · 90ebc54e
      Jesse J. Cook 提交于
      In the domain-events example C code virEventRegisterDefaultImpl was being
      called before virConnectOpen without first calling virInitialize. While this
      code worked, it is incorrect. Adding a call to g_string_new prior to the call
      to virEventRegisterDefaultImpl would cause the code to break. This fix will
      help avoid unintentional misue of the API.
      
      Relates to: Ret Hat Bugzilla - Bug 961155
      90ebc54e
  14. 07 11月, 2012 1 次提交
    • M
      Introduce new VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR event · adb29a88
      Michal Privoznik 提交于
      This is supposed to be thrown every time we need to pause domain
      because of API execution (e.g. qemuDomainSaveInternal) but fails
      to restore it back after. In this case, domain remains paused,
      however, none of existing reasons can fit this scenario.
      adb29a88
  15. 15 10月, 2012 1 次提交
    • M
      Add support for SUSPEND_DISK event · 7ba5defb
      Martin Kletzander 提交于
      This patch adds support for SUSPEND_DISK event; both lifecycle and
      separated.  The support is added for QEMU, machines are changed to
      PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
      to shut-off.  This and much more needs to be done in order for libvirt
      to work with transient devices, wake-ups etc.  This patch is not
      aiming for that functionality.
      7ba5defb
  16. 07 9月, 2012 2 次提交
  17. 09 8月, 2012 1 次提交
  18. 30 7月, 2012 1 次提交
  19. 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
  20. 30 3月, 2012 1 次提交
  21. 23 3月, 2012 4 次提交
    • O
      qemu: Update domain status to running while wakeup event is emitted · 7c5a0c94
      Osier Yang 提交于
      This introduces a new running reason VIR_DOMAIN_RUNNING_WAKEUP,
      and new suspend event type VIR_DOMAIN_EVENT_STARTED_WAKEUP.
      
      While a wakeup event is emitted, the domain which entered into
      VIR_DOMAIN_PMSUSPENDED will be transferred to "running"
      with reason VIR_DOMAIN_RUNNING_WAKEUP, and a new domain lifecycle
      event emitted with type VIR_DOMAIN_EVENT_STARTED_WAKEUP.
      7c5a0c94
    • 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. 06 12月, 2011 1 次提交
  23. 24 11月, 2011 2 次提交
  24. 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
  25. 03 9月, 2011 1 次提交
    • E
      snapshot: better events when starting paused · c1ff5dc6
      Eric Blake 提交于
      There are two classes of management apps that track events - one
      that only cares about on/off (and only needs to track EVENT_STARTED
      and EVENT_STOPPED), and one that cares about paused/running (also
      tracks EVENT_SUSPENDED/EVENT_RESUMED).  To keep both classes happy,
      any transition that can go from inactive to paused must emit two
      back-to-back events - one for started and one for suspended (since
      later resuming of the domain will only send RESUMED, but the first
      class isn't tracking that).
      
      This also fixes a bug where virDomainCreateWithFlags with the
      VIR_DOMAIN_START_PAUSED flag failed to start paused when restoring
      from a managed save image.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
      (VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
      (VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT): New sub-events.
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use them.
      (qemuDomainSaveImageStartVM): Likewise, and add parameter.
      (qemudDomainCreate, qemuDomainObjStart): Send suspended event when
      starting paused.
      (qemuDomainObjRestore): Add parameter.
      (qemuDomainObjStart, qemuDomainRestoreFlags): Update callers.
      * examples/domain-events/events-c/event-test.c
      (eventDetailToString): Map new detail strings.
      c1ff5dc6
  26. 29 5月, 2011 1 次提交
    • D
      Introduce a new event emitted when a virtualization failure occurs · a6135ec1
      Daniel P. Berrange 提交于
      This introduces a new domain
      
        VIR_DOMAIN_EVENT_ID_CONTROL_ERROR
      
      Which uses the existing generic callback
      
      typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn,
                                                           virDomainPtr dom,
                                                           void *opaque);
      
      This event is intended to be emitted when there is a failure in
      some part of the domain virtualization system. Whether the domain
      continues to run/exist after the failure is an implementation
      detail specific to the hypervisor.
      
      The idea is that with some types of failure, hypervisors may
      prefer to leave the domain running in a "degraded" mode of
      operation. For example, if something goes wrong with the QEMU
      monitor, it is possible to leave the guest OS running quite
      happily. The mgmt app will simply loose the ability todo various
      tasks. The mgmt app can then choose how/when to deal with the
      failure that occured.
      * daemon/remote.c: Dispatch of new event
      * examples/domain-events/events-c/event-test.c: Demo catch
        of event
      * include/libvirt/libvirt.h.in: Define event ID and callback
      * src/conf/domain_event.c, src/conf/domain_event.h: Internal
        event handling
      * src/remote/remote_driver.c: Receipt of new event from daemon
      * src/remote/remote_protocol.x: Wire protocol for new event
      * src/remote_protocol-structs: add new event for checks
      a6135ec1
  27. 12 5月, 2011 2 次提交
    • E
      build: avoid gcc preprocessor extensions · bc6bfeaa
      Eric Blake 提交于
      Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by
      C99; thankfully, we can avoid it by lumping the format argument
      into the var-args set.
      
      * src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT)
      (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick
      to C99 var-arg macro syntax.
      * examples/domain-events/events-c/event-test.c (VIR_DEBUG):
      Simplify.
      bc6bfeaa
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  28. 31 3月, 2011 1 次提交
    • D
      Fix domain events C example on Win32 · 24219542
      Daniel P. Berrange 提交于
      printf on Win32 does not necessarily support %lld and we don't
      have GNULIBs wrapper for printf(). Switch to use asprintf() for
      which we do have a gnulib wrapper with %lld support
      
      * examples/domain-events/events-c/event-test.c: Fix formatting
        of %lld on Win32
      * cfg.mk: Don't require use of virAsprintf since this is an
        example app for out of tree users to follow
      24219542
  29. 29 3月, 2011 1 次提交
    • D
      Update event loop example programs to demonstrate best practice · 0c97e70b
      Daniel P. Berrange 提交于
      The example C event loop code is a nasty hack and not compliant
      with the require API semantics. Delete this, so that developers
      don't mistakenly copy it. Instead call the new public event loop
      APIs.
      
      Update the python event loop example, so that it can optionally
      use the public event APIs, as an alternative to the pure python
      code. The pure python event code is a good working example, so
      don't delete it.
      
      Also make the python example use a read only connection to avoid
      authentication prompts
      
      * examples/domain-events/events-c/event-test.c: Replace event
        loop code with use of public APIs
      * examples/domain-events/events-python/event-test.py: Allow
        optional use of new public event APIs
      0c97e70b
  30. 21 2月, 2011 1 次提交
    • E
      maint: kill all remaining uses of old DEBUG macro · 994e7567
      Eric Blake 提交于
      Done mechanically with:
      $ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'
      
      followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
      with a single 'make syntax-check' fallout in the same file, and the
      actual deletion in src/util/logging.h.
      
      * src/util/logging.h (DEBUG, DEBUG0): Delete.
      * daemon/libvirtd.h (qemudDebug): Likewise.
      * global: Change remaining clients over to VIR_DEBUG counterpart.
      994e7567
  31. 27 4月, 2010 1 次提交