// TODO : for XS/KVM (host-based resource), we require to remove
// VM completely from host, for some reason, KVM seems to still keep
// Stopped VM around, to work-around that, reporting only powered-on VM
//
if (state == PowerState.PowerOn)
vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName()));
} catch (final LibvirtException e) {
s_logger.warn("Unable to get vms", e);
} finally {
try {
if (dm != null) {
dm.free();
}
} catch (LibvirtException e) {
s_logger.trace("Ignoring libvirt error.", e);
}
}
}
for (int i = 0; i < vms.length; i++) {
try {
dm = conn.domainLookupByName(vms[i]);
DomainInfo.DomainState ps = dm.getInfo().state;
final PowerState state = convertToPowerState(ps);
String vmName = dm.getName();
s_logger.trace("VM " + vmName + ": powerstate = " + ps + "; vm state=" + state.toString());
// TODO : for XS/KVM (host-based resource), we require to remove
// VM completely from host, for some reason, KVM seems to still keep
// Stopped VM around, to work-around that, reporting only powered-on VM
//
if (state == PowerState.PowerOn)
vmStates.put(vmName, new HostVmStateReportEntry(state, conn.getHostName()));
} catch (final LibvirtException e) {
s_logger.warn("Unable to get vms", e);
} finally {
try {
if (dm != null) {