[libvirt] libvirt-java, deprecated methods?

Hi, I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days. It looks very interesting, but I think I may have found a bug: .... conn = new Connect("xen://node02", false); .... conn.setDom0Memory(512000) gives: exception caught:org.libvirt.LibvirtException: invalid domain pointer in virDomainSetMemory level:VIR_ERR_ERROR code:VIR_ERR_INVALID_DOMAIN domain:VIR_FROM_DOM hasConn:false hasDom:false hasNet:false message:invalid domain pointer in virDomainSetMemory str1:invalid domain pointer in %s str2:virDomainSetMemory str3:null int1:0 int2:0 Furthermore, f.e. conn.GetHypervisorVersion(conn.getType()) gives: exception caught:org.libvirt.LibvirtException: this function is not supported by the hypervisor: Xen level:VIR_ERR_ERROR code:VIR_ERR_NO_SUPPORT domain:VIR_FROM_NONE hasConn:false hasDom:false hasNet:false message:this function is not supported by the hypervisor: Xen str1:this function is not supported by the hypervisor: %s str2:Xen str3:null int1:0 int2:0 But Domain dom0=conn.domainLookupByID(0); //domainLookupByName("Domain-0"); too DomainInfo dom0info = dom0.getInfo(); .... dom0.setMemory(256000); .... works without glitches and does the job (btw, I can't see any effect of setMaxMemory() on Xen?) Is it possible that there are some inconsistences between libvirt-java and libvirt? Since libvirt-java wasn't updated approx. 1y, I assume that. Thanks for feedback, kr, thomas

On Tue, Jul 21, 2009 at 11:52:11AM +0200, Thomas Treutner wrote:
Hi,
I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days. It looks very interesting, but I think I may have found a bug:
.... conn = new Connect("xen://node02", false); .... conn.setDom0Memory(512000)
Hmm, dunno what that method is doing - it doesn't correspond to one in the libvirt C API. It would be worth gettinga trace of API calls by setting the following environment variables before running your app LIBVIRT_LOG_FILTERS="1:libvirt" LIBVIRT_LOG_OUTPUTS="1:stderr" Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tuesday 21 July 2009 13:01:06 Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 11:52:11AM +0200, Thomas Treutner wrote:
Hi,
I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days. It looks very interesting, but I think I may have found a bug:
.... conn = new Connect("xen://node02", false); .... conn.setDom0Memory(512000)
Hmm, dunno what that method is doing - it doesn't correspond to one in the libvirt C API.
It would be worth gettinga trace of API calls by setting the following environment variables before running your app
LIBVIRT_LOG_FILTERS="1:libvirt" LIBVIRT_LOG_OUTPUTS="1:stderr"
Seems like the domain ID is not defined - not surprisingly: 13:24:07.905: debug : virDomainSetMemory:2601 : domain=(nil), memory=512000 13:24:07.905: error : virLibDomainError:433 : invalid domain pointer in virDomainSetMemory Since the dom0 is AFAIK very xen-specific, I wonder if such a function may ever have been part of libvirt? kr, thomas

On Tue, Jul 21, 2009 at 01:39:51PM +0200, Thomas Treutner wrote:
On Tuesday 21 July 2009 13:01:06 Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 11:52:11AM +0200, Thomas Treutner wrote:
Hi,
I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days. It looks very interesting, but I think I may have found a bug:
.... conn = new Connect("xen://node02", false); .... conn.setDom0Memory(512000)
Hmm, dunno what that method is doing - it doesn't correspond to one in the libvirt C API.
It would be worth gettinga trace of API calls by setting the following environment variables before running your app
LIBVIRT_LOG_FILTERS="1:libvirt" LIBVIRT_LOG_OUTPUTS="1:stderr"
Seems like the domain ID is not defined - not surprisingly:
13:24:07.905: debug : virDomainSetMemory:2601 : domain=(nil), memory=512000 13:24:07.905: error : virLibDomainError:433 : invalid domain pointer in virDomainSetMemory
Since the dom0 is AFAIK very xen-specific, I wonder if such a function may ever have been part of libvirt?
I've just looked at the java code and found this horrible snippet JNIEXPORT jint JNICALL Java_org_libvirt_Connect__1setDom0Memory (JNIEnv *env, jobject obj, jlong memory){ return virDomainSetMemory(NULL, memory); } This could not possibly have ever worked. It is forbidden to pass NULL to virDomainSetMemory(), no matter what hypervisor driver. We should just remove the setDom0Memory() method from the java code, since it is fundamentally broken & always has been Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Jul 21, 2009 at 03:03:53PM +0100, Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 01:39:51PM +0200, Thomas Treutner wrote:
On Tuesday 21 July 2009 13:01:06 Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 11:52:11AM +0200, Thomas Treutner wrote:
Hi,
I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days.
You mean libvirt-java-0.1.1, I don't think I ever released a newer version. Unfortunately as you found out the bindings are in a not so nice shape. The good point is that someone with more Java knowledge than me is looking at cleaning this up !
I've just looked at the java code and found this horrible snippet
JNIEXPORT jint JNICALL Java_org_libvirt_Connect__1setDom0Memory (JNIEnv *env, jobject obj, jlong memory){ return virDomainSetMemory(NULL, memory); }
This could not possibly have ever worked. It is forbidden to pass NULL to virDomainSetMemory(), no matter what hypervisor driver.
We should just remove the setDom0Memory() method from the java code, since it is fundamentally broken & always has been
I never realized we had this in, yup I need to clean this up ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Jul 21, 2009 at 05:23:32PM +0200, Daniel Veillard wrote:
On Tue, Jul 21, 2009 at 03:03:53PM +0100, Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 01:39:51PM +0200, Thomas Treutner wrote:
On Tuesday 21 July 2009 13:01:06 Daniel P. Berrange wrote:
On Tue, Jul 21, 2009 at 11:52:11AM +0200, Thomas Treutner wrote:
Hi,
I'm playing around with libvirt-0.6.5 and libvirt-java-0.2.1 these days.
You mean libvirt-java-0.1.1, I don't think I ever released a newer version.
Actually Tom pointed out we are at version 2.1, oops :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Thomas Treutner