[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Libvirt Java Bindings - adding domain event support - pull request



Hi all

I'm new to this list, I've been making use of the Libvirt Java bindings recently.  I wanted to make use of domain events yesterday
so my application can be alerted when the state of a domain changes etc.

However I quickly discovered that domain events are completely broken in the current Java bindings.  Whilst some of the Libvirt
functions required to support domain events are exposed, the critical underpinnings are not.  Specifically there is no support
for setting up the event loop.

So I have implemented support for domain events in the Java bindings.  Currently I've only implemented the following domain
event IDs:

 * VIR_DOMAIN_EVENT_ID_LIFECYCLE
 * VIR_DOMAIN_EVENT_ID_REBOOT
 * VIR_DOMAIN_EVENT_ID_RTC_CHANGE

Implementing these is enough to test that my implementation is sane, I'm hoping to implement the majority of the other events
soon.

Events can be listened to by, registering via the Connect object, as follows:

 con.domainEventRegisterAny(DomainEventID.VIR_DOMAIN_EVENT_ID_LIFECYCLE, new DomainLifecycleEventHandler() {
   @Override
   public void onStarted(Connect connection, Domain domain, DomainEventType event, DomainEventStartedDetailType detail) throws LibvirtException {
     System.out.println("Got start event: " + event + "::" + detail + " for domain " + domain.getName());
   }
 });

I've put my clone of the libvirt-java git repository on Github, my modifications to the Java binding are in a separate branch and
should be simple to merge.  The changes can be viewed at:

  https://github.com/intrbiz/libvirt-java/compare/master...ce-domain-events

I'm keen to get these enhancements / fixes merged into libvirt-java.  I would also like to submit further fixes to race conditions
in the free() handling.


Any advice / thoughts / comments welcome.

Regards,
Chris Ellis

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]