1. 26 3月, 2010 5 次提交
    • D
      Refactor domain events to handle multiple event types · 747c5363
      Daniel P. Berrange 提交于
      The internal domain events APIs are designed to handle the lifecycle
      events. This needs to be refactored to allow arbitrary new event
      types to be handled.
      
       * The signature of virDomainEventDispatchFunc changes to use
         virConnectDomainEventGenericCallback instead of the lifecycle
         event specific virConnectDomainEventCallback
       * Every registered callback gains a unique ID to allow its
         removal based on ID, instead of function pointer
       * Every registered callback gains an 'eventID' to allow callbacks
         for different types of events to be distinguished
       * virDomainEventDispatch is adapted to filter out callbacks
         whose eventID does not match the eventID of the event being
         dispatched
       * virDomainEventDispatch is adapted to filter based on the
         domain name and uuid, if this filter is set for a callback.
       * virDomainEvent type/detail fields are moved into a union to
         allow different data fields for other types of events to be
         added later
      
      * src/conf/domain_event.h, src/conf/domain_event.c: Refactor
        to allow handling of different types of events
      * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
        src/remote/remote_driver.c, src/test/test_driver.c,
        src/xen/xen_driver.c: Change dispatch function signature
        to use virConnectDomainEventGenericCallback
      747c5363
    • D
      Make internal domain events struct definitions private · ea7dc337
      Daniel P. Berrange 提交于
      The virtual box driver was directly accesing the domain events
      structs instead of using the APIs provided. To prevent this kind
      of abuse, make the struct definitions private, forcing use of the
      internal APIs. This requires adding one extra internal API.
      
      * src/conf/domain_event.h, src/conf/domain_event.c: Move
        virDomainEventCallback and virDomainEvent structs into
        the source file instead of header
      * src/vbox/vbox_tmpl.c: Use official APIs for dispatching domain
        events instead of accessing structs directly.
      ea7dc337
    • D
      Introduce a new public API for domain events · 44457238
      Daniel P. Berrange 提交于
      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
      44457238
    • E
      maint: update syntax-check rule to also catch test's -o operator · 271945a1
      Eric Blake 提交于
      * cfg.mk (sc_prohibit_test_minus_a): Rename...
      (sc_prohibit_test_minus_ao): ...and flag '-o', too.
      271945a1
    • J
      tests: teach syntax-check that virDomainDefFree has free-like semantics · 15613359
      Jim Meyering 提交于
      * cfg.mk (useless_free_options): Add virDomainDefFree to the list
      of free-like functions.
      * src/test/test_driver.c (testDomainCreateXML): Remove useless-if-
      before-virDomainDefFree.
      * src/conf/domain_conf.c (virDomainAssignDef): Likewise
      15613359
  2. 25 3月, 2010 4 次提交
  3. 24 3月, 2010 6 次提交
    • P
      python example: poll(-0.001) does not sleep forever · 1cfbfaa6
      Philipp Hahn 提交于
      The conversion from seconds to milliseconds should only be done for
      actual delays >= 0, not for the magic -1 value used for infinite
      timeouts.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      1cfbfaa6
    • J
      build: suppress distracting build output · 84eb6eff
      Jim Meyering 提交于
      * src/Makefile.am (augeas-check): New target, just to give the existing
      rule a name.  At the same time, prefix the commands with $(AM_V_GEN),
      to avoid unexpected build output with V=0 which is the default.
      84eb6eff
    • J
      maint: add syntax-check rule to prohibit use of test's -a operator · 95c8ddd2
      Jim Meyering 提交于
      * cfg.mk (sc_prohibit_test_minus_a): New rule.
      95c8ddd2
    • J
      build: don't use "test cond1 -a cond2" in configure: it's not portable · 7998714d
      Jim Meyering 提交于
      * configure.ac: Use "test cond1 && test cond2" instead.
      7998714d
    • J
      tests: shell script portability and clean-up · ca7db6cb
      Jim Meyering 提交于
      * tests/test-lib.sh: "echo -n" is not portable.  Use printf instead.
      Remove unnecessary uses of "eval-in-subshell" (subshell is sufficient).
      Remove uses of tests' -a operator; it is not portable.
      Instead, use "test cond && test cond2".
      * tests/schematestutils.sh: Replace use of test's -a.
      ca7db6cb
    • M
      tests: Don't add extra padding if counter mod 40 is 0 · 8a7783c1
      Matthias Bolte 提交于
      This change only affects the output of tests that have an exact
      multiple of 40 test cases. For example the domainschematest currently:
      
      TEST: domainschematest
            ........................................ 40
            ........................................ 80
            ........................................ 120
            ........................................ 160
            ........................................                                         200 OK
      PASS: domainschematest
      
      It outputs additional 40 spaces on the last line.
      
      The domainschematest output is fixed by the change in test-lib.sh. The
      change in testutils.c fixes this for tests written in C. Currently no
      C test has an exact multiple of 40 test cases, but I checked it and
      the same problem exists there.
      
      This patch stops that in both cases.
      8a7783c1
  4. 23 3月, 2010 21 次提交
  5. 22 3月, 2010 3 次提交
  6. 20 3月, 2010 1 次提交