public static List < Domain > getRunningDomains ( Connect libvirt ) { try { List < Domain > domains = new ArrayList <> ( ) ; int [ ] ids = libvirt . listDomains ( ) ; for ( int id : ids ) { domains . add ( libvirt . domainLookupByID ( id ) ) ; } return domains ; } catch ( LibvirtException e ) { throw new LibvirtRuntimeException ( "Unable to list defined domains" , e ) ; } }
Get list of the active domains .