[libvirt] libvirt-java thoughts

Stefan Majer stefan.majer at gmail.com
Thu Dec 30 15:10:09 UTC 2010


Hi,

we use libvirt-java in our kvm based virtualization infrastructure a
lot. Thanks therefor. Sometimes we see crashes of the libvirtd and i
was thinking of the right way to handle such a situation from the java
side.

My first aproach was to use the ErrorCallback:

Connect.setErrorCallback(new VirErrorCallback() {
@Override
public void errorCallback(Pointer arg0, virError error) {
    // Do something usefull (reconnect for example)
  }
 }
);
 } catch (LibvirtException e) {
     LOG.error("Exception occurred. Stacktrace: ", e);
   }
 }

But this give me a jvm crash on shutdown of my application. No Idea why.

The next idea was to Intercept all calls to org.libvirt.Connect and
check if the connection is still working (isConnected) and reconnect
on false.
But the current API design makes this difficult and ugly, as Connect
is a concrete Class without an Interface.

Do you have any other Ideas ?
If no, do you probably accept patches which will resolve this issue ?
We can share Ideas what the best strategie could be.

Greetings

-- 
Stefan Majer




More information about the libvir-list mailing list