Problem with listDomains() in Xen

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

 



This question concerns the usage of the listDomains(). When I run this
piece of code in KVM, it works perfectly fine but throws an array out of
bounds exception in Xen.

 Connect conn=null;
 conn = new Connect("xen:///", true);
 int[] id = conn.listDomains();
 System.out.println("lD of VM " +id[0]);

Answer I'd got:
Well, your code assumes that id.length is >= 1, but listDomains() can
return an empty array when there are no active domains known to
libvirt. So you need to check id.length before accessing any element
in the array.

Follow up- I tried accessing the length of the array and it's 0 all the time. And there are active domains available.
In fact, I'm able to getUUID from the domain name. Other functions work fine too.

Am I missing something?Can someone please help me? Thanks!

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux