[libvirt] getSchedulerParameters() always returning nullpointerexception in JAVA

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

 



Hi everyvody,
I'm developing a new API based on libvirt.
I'm currently stucked using getSchedulerParameters, always is returning a nullpointerexception, no matter which Xen Domain I'm passing to the function.

Enclosing both the code and the error console:


public int getCPUPriority(String name) {
        int res=-1;
       
        try {
            Domain d = getDomain(name);
            SchedParameter[] pars = d.getSchedulerParameters();

            for (SchedParameter pri : pars) {
                if (pri.field=="weight")
                    res=Integer.parseInt(pri.getValueAsString());
            }
           
        } catch (LibvirtException e) {
            log.error(" Error: getting CPU priority of \""+name+"\"." + e.getClass());
            e.printStackTrace();
        }
       
        return res;
    }



Dec 11, 2009 1:04:18 PM net.emotivecloud.virtmonitor.VirtMonitor getCPUCapacity
SEVERE:  Error: getting CPU capacity of "XenTest".
java.lang.NullPointerException
    at org.libvirt.SchedParameter.create(Unknown Source)
    at org.libvirt.Domain.getSchedulerParameters(Unknown Source)
    at net.emotivecloud.virtmonitor.VirtMonitor.getCPUCapacity(VirtMonitor.java:462)
    at net.emotivecloud.virtmonitor.VirtMonitor.main(VirtMonitor.java:763)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
    at java.lang.Thread.run(Thread.java:636)


Any ideas?

Thanks in advance,


Marc Gonzalez Mateo



--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]