1. 14 Oct, 2016 2 commits
  2. 13 Oct, 2016 3 commits
  3. 09 Oct, 2016 7 commits
  4. 30 Aug, 2016 2 commits
  5. 29 Aug, 2016 1 commit
  6. 28 Aug, 2016 1 commit
  7. 26 Aug, 2016 1 commit
  8. 19 Aug, 2016 2 commits
  9. 08 Aug, 2016 2 commits
  10. 07 Aug, 2016 4 commits
    • Vincent Bernat's avatar
      errors: don't make GetLastError() segfault when on no error condition · 54483b92
      Vincent Bernat authored
      When calling `GetLastError()` twice in a row, we get a segfault because
      `virGetLastError()` C function returns nil. We cannot return nil since
      we don't return a pointer, but we can return a special error that means
      "no error".
      54483b92
    • Vincent Bernat's avatar
      connection: add RegisterCloseCallback() method · 28f071da
      Vincent Bernat authored
      This enables to register one callback when the connection is closed
      unexpectedly. Only one callback can be registered this way. This is
      easier to handle this way.
      
      It's quite hard to test if a connection is closed since it only works
      for unexpected close (virConnectClose() won't do anything as the
      callback will keep a reference to the connection). Therefore, we rely on
      keepalive feature for that.
      28f071da
    • Vincent Bernat's avatar
      callbacks: move callback helpers to another file · e8a057f1
      Vincent Bernat authored
      We have callbacks for error handling and we will introduce more
      non-event callbacks in the future. Just move the appropriate bit into a
      separate file and document how to build a new callback.
      e8a057f1
    • Vincent Bernat's avatar
      connection: move ancillary data to a separate struct · 52ddaf1e
      Vincent Bernat authored
      To implement error callbacks (in #96), the current error callback ID was
      associated to the VirConnection structure on which the SetErrorFunc has
      been called. However, if a user receives a connection from an event,
      this connection won't have the right error callback ID.
      
      Therefore, storing additional information in the VirConnection structure
      seems a bit fragile. Either we should ensure that each connection is a
      single VirConnection structure or we should store the data elsewhere.
      
      This commit moves the data in a dedicated structure and a map is used to
      associated a virConnectPtr to the appropriate ancillary data. Therefore,
      for a connection, we have an unique C.virConnectPtr, zero or more
      VirConnection struct and one virConnectionData struct.
      
      The other solution (ensuring we have only one VirConnection struct for a
      given connection) seemed far more complex to handle as it's hard to
      avoid a copy by the user (we would have to force the user to only use
      pointers).
      52ddaf1e
  11. 05 Aug, 2016 4 commits
  12. 03 Aug, 2016 1 commit
  13. 29 Jul, 2016 3 commits
    • Vincent Bernat's avatar
      events: fix callback signatures for domain events · 5ac3f88f
      Vincent Bernat authored
      All C callbacks are expected to return void, not int. We fix everything
      with the notable exception of type `DomainEventCallback` because it is
      part of the public API. We only document the fact the return code is
      ignored.
      5ac3f88f
    • Vincent Bernat's avatar
      events: fix non-lifecycle domain event handling · 1d297234
      Vincent Bernat authored
      This is mostly a partial rip-off of #80. So, all credits to
      @kunteynir.
      
      First, we ensure we call `virConnectDomainEventRegisterAny_cgo()` with
      the right event ID, instead of `C.VIR_DOMAIN_EVENT_ID_LIFECYCLE`.
      
      Fix #98.
      
      Second, when a Go function is exported, `string` becomes a `GoString`
      which is not compatible with `char *`. Therefore, we use `*C.char` in
      the signature of those functions instead of `string` and we convert back
      to `GoString` inside the callback. This could have been caught at
      compile time if we were able to use exported definition in `cfuncs.go`,
      but this doesn't seem possible (see #87).
      1d297234
    • Vincent Bernat's avatar
      events: provide a String() method for all supported events · 7cfbee7f
      Vincent Bernat authored
      Also, add a bunch of constants (including some unrelated ones) that were
      missing. This is mostly stolen from #80, so all the credit goes to
      @kunteynir.
      7cfbee7f
  14. 28 Jul, 2016 1 commit
  15. 27 Jul, 2016 5 commits
    • Vincent Bernat's avatar
      test: ensure we don't have any connection leak · e59e9ced
      Vincent Bernat authored
      If ConnectionClose() method doesn't return 0, this means we have either
      an error, either there is still a reference to the connection by another
      object (we don't have virConnectRef()). In all tests, check that return
      code and ensure this is 0. Fix tests that weren't releasing all objects
      correctly.
      e59e9ced
    • Kyle Kelley's avatar
      Merge pull request #97 from exoscale/fix/ci · b3caa922
      Kyle Kelley authored
      ci: replace drone.io tests by Travis CI
      b3caa922
    • Vincent Bernat's avatar
      connection: remove dangerous SetPtr() and UnrefAndCloseConnection() methods · 9dff2cb6
      Vincent Bernat authored
      Those two changes break the API backward compatibility!
      
      The first function was introduced in #81 to workaround the absence of
      virConnectOpenAuth() method. This defeats the purpose of having an
      opaque structure for a connection. Now that there is a mechanism to
      handle callbacks, it should be easier to implement virConnectOpenAuth()
      correctly.
      
      The second function should not exist as there is no way to increment
      reference of an existing connection from Go code (virConnectRef() is not
      implemented). Therefore, if this function was needed, this should be
      because the C code increments a reference to a connection but the
      appropriate call to decrement it is absent. For example, we requested a
      domain but we didn't free it. Therefore, the domain holds a reference to
      the connection and the connection is not closed correctly. Forcing the
      connection to close implies there is a leak somewhere (the domain should
      be freed).
      9dff2cb6
    • Vincent Bernat's avatar
    • Vincent Bernat's avatar
      ci: replace drone.io tests by Travis CI · e3a39e58
      Vincent Bernat authored
      Also add a badge in README.md.
      
      Fix #66
      Fix #91
      e3a39e58
  16. 26 Jul, 2016 1 commit