[libvirt] libvirt-java, deprecated methods?

Daniel P. Berrange berrange at redhat.com
Tue Jul 21 14:03:53 UTC 2009


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 :|




More information about the libvir-list mailing list