[libvirt-users] is libvirt java binding thread safe?

Matthias Bolte matthias.bolte at googlemail.com
Fri Sep 3 09:07:55 UTC 2010


Well, if the domain is not running then I get this exception with
libvirt 0.6.3 and libvirt-java 0.4.2:

org.libvirt.LibvirtException: invalid argument in cannot pin vcpus on
an inactive domain
	at org.libvirt.ErrorHandler.processError(Unknown Source)
	at org.libvirt.Connect.processError(Unknown Source)
	at org.libvirt.Domain.processError(Unknown Source)
	at org.libvirt.Domain.getVcpusInfo(Unknown Source)
	at TestMultiThreadingLibvirtWithError.run(TestMultiThreadingLibvirtWithError.java:20)
	at java.lang.Thread.run(Thread.java:636)

The error message is misleading and current git version gives this
exception when the domain is not running:

org.libvirt.LibvirtException: Requested operation is not valid: cannot
list vcpu pinning for an inactive domain
	at org.libvirt.ErrorHandler.processError(Unknown Source)
	at org.libvirt.Connect.processError(Unknown Source)
	at org.libvirt.Domain.processError(Unknown Source)
	at org.libvirt.Domain.getVcpusInfo(Unknown Source)
	at TestMultiThreadingLibvirtWithError.run(TestMultiThreadingLibvirtWithError.java:20)
	at java.lang.Thread.run(Thread.java:636)

And that's perfectly valid, as the complete vCPU information is only
available when the domain is running, therefore the exception is
expected when you call getVcpusInfo on a non-running domain. Also this
has nothing to do with thread-safety.

If this isn't the exception you're referring to, then please show a
stacktrace of the exception you're seeing.

Matthias

2010/9/3 Ravi Pawar <ravifc at gmail.com>:
> thank you for the reply and time you spend.
> your guest domain should not be running and then run my program without any
> change.you will see an exception where you dont expect it to occur.
> libvirt : 0.6.3 and libvirt-java: 0.4.2 i am using. Please let me know if i
> miss to provide you any other details.
>
>
> On Fri, Sep 3, 2010 at 3:29 AM, Matthias Bolte
> <matthias.bolte at googlemail.com> wrote:
>>
>> 2010/9/2 Ravi Pawar <ravifc at gmail.com>:
>> > please check the java file attached they throws the exception in case of
>> > passing.
>> > please let me know if i am missing something.
>> >
>>
>> Can you explain in more detail what one should do to reproduce the
>> problem you seem to see with the attached code? Also you didn't
>> mention which versions of libvirt and libvirt-java you're using.
>>
>> When I run you example code (with a guest name that exists in my setup
>> and libvirt and libvirt-java form current git head) I don't see any
>> exceptions. Even when I add e.printStackTrace() to the catch block of
>> TestMultiThreadingLibvirtWithError I don't see exceptions.
>>
>> $ java -classpath
>> ./target/libvirt-0.4.6.jar:./ravi:/usr/share/java/jna.jar Test
>> start class 0
>> start class 1
>> start class 2
>> start class 3
>> start class 4
>> start class 5
>> start class 6
>> start class 7
>> start class 8
>> start class 9
>>
>> So this works for me.
>>
>> Matthias
>
>
>
> --
> Thanks & Regards
>
> Ravi Pawar
>




More information about the libvirt-users mailing list