use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmHandler method checkStatusAndLockVm.
/**
* Lock VM with compensation, after checking its status, If VM status is locked, we throw an exception.
*
* @param vmId
* - The ID of the VM, which we want to lock.
* @param compensationContext
* - Used to save the old VM status for compensation purposes.
*/
public void checkStatusAndLockVm(Guid vmId, CompensationContext compensationContext) {
VmDynamic vmDynamic = vmDynamicDao.get(vmId);
checkStatusBeforeLock(vmDynamic.getStatus());
lockVm(vmDynamic, compensationContext);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoImpl method getAllRunningForVds.
@Override
public List<VmDynamic> getAllRunningForVds(Guid id) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vds_id", id);
RowMapper<VmDynamic> mapper = createEntityRowMapper();
return getCallsHandler().executeReadList("GetVmsDynamicRunningOnVds", mapper, parameterSource);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class BackendVmPoolsResource method mapToVM.
protected VM mapToVM(VmPool model, VmTemplate template, Cluster cluster) {
// apply template
VmStatic fromTemplate = getMapper(VmTemplate.class, VmStatic.class).map(template, null);
VmStatic fromInstanceType = null;
if (model.isSetInstanceType()) {
org.ovirt.engine.core.common.businessentities.InstanceType instanceType = loadInstanceType(model);
fromTemplate.setInstanceTypeId(instanceType.getId());
fromInstanceType = VmMapper.map(instanceType, fromTemplate, cluster.getCompatibilityVersion());
fromInstanceType.setInstanceTypeId(instanceType.getId());
}
// override with client-provided data
VM vm = new VM(getMapper(VmPool.class, VmStatic.class).map(model, fromInstanceType != null ? fromInstanceType : fromTemplate), new VmDynamic(), new VmStatistics());
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmMapperTest method getInverse.
@Override
protected org.ovirt.engine.core.common.businessentities.VM getInverse(VmStatic to) {
VmStatistics statistics = new VmStatistics();
statistics.setCpuUser(10.0);
statistics.setCpuSys(20.0);
VmDynamic dynamic = new VmDynamic();
dynamic.setStatus(VMStatus.Up);
dynamic.setBootSequence(to.getDefaultBootSequence());
dynamic.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo());
org.ovirt.engine.core.common.businessentities.VM ret = new org.ovirt.engine.core.common.businessentities.VM(to, dynamic, statistics);
ret.setUsageMemPercent(50);
return ret;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmMapperTest method testGuestOs2.
@Test
public void testGuestOs2() {
org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
VmDynamic vmDynamic = new VmDynamic();
vmDynamic.setStatus(VMStatus.Up);
vmDynamic.setGuestOsType(OsType.Windows);
vmDynamic.setGuestOsCodename("");
vmDynamic.setGuestOsDistribution("");
vmDynamic.setGuestOsVersion("6.2.4800");
vmDynamic.setGuestOsArch(ArchitectureType.x86_64);
vmDynamic.setGuestOsKernelVersion("");
vm.setDynamicData(vmDynamic);
Vm map = VmMapper.map(vm, (Vm) null);
assertNotNull(map.getGuestOperatingSystem());
assertEquals("Windows", map.getGuestOperatingSystem().getFamily());
assertEquals("", map.getGuestOperatingSystem().getCodename());
assertEquals("", map.getGuestOperatingSystem().getDistribution());
assertEquals("6.2.4800", map.getGuestOperatingSystem().getVersion().getFullVersion());
assertNotNull(map.getGuestOperatingSystem().getVersion().getMajor());
assertEquals(6, (long) map.getGuestOperatingSystem().getVersion().getMajor());
assertNotNull(map.getGuestOperatingSystem().getVersion().getMinor());
assertEquals(2, (long) map.getGuestOperatingSystem().getVersion().getMinor());
assertNotNull(map.getGuestOperatingSystem().getVersion().getBuild());
assertEquals(4800, (long) map.getGuestOperatingSystem().getVersion().getBuild());
assertNull(map.getGuestOperatingSystem().getVersion().getRevision());
assertEquals("x86_64", map.getGuestOperatingSystem().getArchitecture());
assertNull(map.getGuestOperatingSystem().getKernel());
}
Aggregations