Beispiel #1
0
 static void testEnumeration(VirtualBoxManager mgr, IVirtualBox vbox) {
   List<IMachine> machs = vbox.getMachines();
   for (IMachine m : machs) {
     String name;
     Long ram = 0L;
     boolean hwvirtEnabled = false, hwvirtNestedPaging = false;
     boolean paeEnabled = false;
     boolean inaccessible = false;
     try {
       name = m.getName();
       ram = m.getMemorySize();
       hwvirtEnabled = m.getHWVirtExProperty(HWVirtExPropertyType.Enabled);
       hwvirtNestedPaging = m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging);
       paeEnabled = m.getCPUProperty(CPUPropertyType.PAE);
       String osType = m.getOSTypeId();
       IGuestOSType foo = vbox.getGuestOSType(osType);
     } catch (VBoxException e) {
       name = "<inaccessible>";
       inaccessible = true;
     }
     System.out.println("VM name: " + name);
     if (!inaccessible) {
       System.out.println(
           " RAM size: "
               + ram
               + "MB"
               + ", HWVirt: "
               + hwvirtEnabled
               + ", Nested Paging: "
               + hwvirtNestedPaging
               + ", PAE: "
               + paeEnabled);
     }
   }
 }