Hi Bryan, I've applied and tested the PATCH and still does not work. Here is the console output: -> [chipiron04, Domain-0, XenTest, XenTest2, chipiron03] Dec 15, 2009 9:49:14 AM net.emotivecloud.virtmonitor.VirtMonitor getCPUPriority SEVERE: Error: getting CPU priority of "XenTest".class java.lang.NullPointerException java.lang.NullPointerException at org.libvirt.SchedParameter.create(Unknown Source) at org.libvirt.Domain.getSchedulerParameters(Unknown Source) at net.emotivecloud.virtmonitor.VirtMonitor.getCPUPriority(VirtMonitor.java:495) at net.emotivecloud.virtmonitor.VirtMonitor.main(VirtMonitor.java:775) 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) -1 Dec 15, 2009 9:49:14 AM 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:470) at net.emotivecloud.virtmonitor.VirtMonitor.main(VirtMonitor.java:776) 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) -1 Bot GetCPUCapacity and GetCPUPriority use the schedparameter type. Here is the code and the main. getDomain method just returns the domain object itself and I've also tested it's not null value at this point of the code: public int getCPUCapacity(String name) { int ret = -1; try { Domain d = getDomain(name); SchedParameter[] pars= d.getSchedulerParameters(); for (SchedParameter pri : pars) { if (pri.field=="cap") ret=Integer.parseInt(pri.getValueAsString()); } } catch (Exception e) { log.error(" Error: getting CPU capacity of \""+name+"\"."); e.printStackTrace(); } return ret; } /** * Returns CPU Priority assigned to VM name * @param name * @return */ 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 (Exception e) { log.error(" Error: getting CPU priority of \""+name+"\"." + e.getClass()); e.printStackTrace(); } return res; } public static void main(String args[]) { VirtMonitor virt = new VirtMonitor();
System.out.println(" -> " + virt.getDomains()); System.out.println(virt.getCPUPriority("XenTest")); System.out.println(virt.getCPUCapacity("XenTest")); } Thanks in advance, Marc Gonzalez Mateo Universitat Politècnica de Catalunya El 14/12/2009, a las 16:41, Bryan Kearney escribió:
|
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list