use of org.ovirt.engine.core.common.businessentities.VmStatistics in project ovirt-engine by oVirt.
the class SetVmStatusVDSCommand method executeVDSCommand.
@Override
protected void executeVDSCommand() {
VmDynamic vmDynamic = vmDynamicDao.get(getParameters().getVmId());
resourceManager.removeAsyncRunningVm(getParameters().getVmId());
resourceManager.internalSetVmStatus(vmDynamic, getParameters().getStatus(), getParameters().getExitStatus());
resourceManager.getVmManager(getParameters().getVmId()).update(new VmStatistics(getParameters().getVmId()));
// TODO: update network statistics
resourceManager.getVmManager(getParameters().getVmId()).update(vmDynamic);
}
use of org.ovirt.engine.core.common.businessentities.VmStatistics in project ovirt-engine by oVirt.
the class VmManager method estimateOverhead.
private int estimateOverhead(VmStatic vmStatic) {
// Prepare VM object using the available bits and pieces
VM compose = new VM(vmStatic, new VmDynamic(), new VmStatistics(), clusterArchitecture, clusterCompatibilityVersion);
// Load device list, TODO ignores unmanaged devices for now
Map<Guid, VmDevice> devices = vmDeviceDao.getVmDeviceByVmId(vmId).stream().filter(VmDevice::isManaged).collect(Collectors.toMap(d -> d.getId().getDeviceId(), Function.identity()));
vmStatic.setManagedDeviceMap(devices);
return vmOverheadCalculator.getTotalRequiredMemoryInMb(compose);
}
use of org.ovirt.engine.core.common.businessentities.VmStatistics in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method buildVmsDataFromExternalProvider.
public static VM buildVmsDataFromExternalProvider(Map<String, Object> struct) {
VmStatic vmStatic = buildVmStaticDataFromExternalProvider(struct);
if (vmStatic == null) {
return null;
}
VmDynamic vmDynamic = buildVMDynamicDataFromList(struct);
VM vm = new VM(vmStatic, vmDynamic, new VmStatistics());
for (DiskImage image : vm.getImages()) {
vm.getDiskMap().put(Guid.newGuid(), image);
}
try {
vm.setClusterArch(parseArchitecture(struct));
} catch (IllegalArgumentException ex) {
log.warn("Illegal architecture type: {}, replacing with x86_64", struct.get(VdsProperties.vm_arch));
vm.setClusterArch(ArchitectureType.x86_64);
} catch (NullPointerException ex) {
log.warn("null architecture type, replacing with x86_64, {}", vm);
vm.setClusterArch(ArchitectureType.x86_64);
}
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VmStatistics in project ovirt-engine by oVirt.
the class VmStatisticsDaoTest method generateNewEntity.
@Override
protected VmStatistics generateNewEntity() {
VmStatistics newVmStatistics = new VmStatistics();
newVmStatistics.setId(FixturesTool.VM_RHEL5_POOL_50_ID);
newVmStatistics.setCpuSys(22.0D);
newVmStatistics.setCpuUser(35.0D);
newVmStatistics.setUsageCpuPercent(44);
newVmStatistics.setUsageMemPercent(67);
newVmStatistics.setDisksUsage("disk_usage");
newVmStatistics.setGuestMemoryBuffered(32L);
newVmStatistics.setGuestMemoryCached(34L);
return newVmStatistics;
}
use of org.ovirt.engine.core.common.businessentities.VmStatistics in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilderTest method testNullDisksUsages.
@Test
public void testNullDisksUsages() {
VmStatistics vmStatistics = getVmStatistics();
Map<String, Object> xml = setDisksUsage(null);
VdsBrokerObjectsBuilder.updateVMStatisticsData(vmStatistics, xml);
assertNull(vmStatistics.getDisksUsage());
}
Aggregations