use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoTest method testUpdateStatus.
/**
* Ensures updating the dynamic status aspect of the VM works.
*/
@Test
public void testUpdateStatus() {
existingEntity.setStatus(VMStatus.Down);
dao.updateStatus(existingEntity.getId(), existingEntity.getStatus());
VmDynamic after = dao.get(existingEntity.getId());
assertEquals(existingEntity, after);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class MaintenanceNumberOfVdssCommand method cancelIncommingMigrations.
private void cancelIncommingMigrations() {
for (Guid hostId : vdssToMaintenance.keySet()) {
for (VmDynamic vm : vmDynamicDao.getAllMigratingToHost(hostId)) {
if (vm.getStatus() == VMStatus.MigratingFrom) {
log.info("Cancelling incoming migration of '{}' id '{}'", vm, vm.getId());
runVdsCommand(VDSCommandType.CancelMigrate, new CancelMigrationVDSParameters(vm.getRunOnVds(), vm.getId(), true));
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method init.
@Override
protected void init() {
if (Guid.isNullOrEmpty(getParameters().getVmTemplateId())) {
getParameters().setVmTemplateId(Guid.newGuid());
}
setVmTemplateId(getParameters().getVmTemplateId());
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId()));
setVmTemplateName(getParameters().getName());
VmStatic masterVm = getParameters().getMasterVm();
if (masterVm != null) {
setVmId(masterVm.getId());
setClusterId(masterVm.getClusterId());
// API backward compatibility
if (getVmDeviceUtils().shouldOverrideSoundDevice(masterVm, getMasterVmCompatibilityVersion(), getParameters().isSoundDeviceEnabled())) {
getParameters().setSoundDeviceEnabled(true);
}
if (getParameters().isSoundDeviceEnabled() == null) {
getParameters().setSoundDeviceEnabled(false);
}
if (getParameters().isConsoleEnabled() == null) {
getParameters().setConsoleEnabled(false);
}
vmHandler.updateDefaultTimeZone(masterVm);
vmHandler.autoSelectUsbPolicy(masterVm);
vmHandler.autoSelectDefaultDisplayType(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices());
vmHandler.autoSelectGraphicsDevice(getVmId(), masterVm, getCluster(), getParameters().getGraphicsDevices(), getMasterVmCompatibilityVersion());
vmHandler.autoSelectResumeBehavior(masterVm, getCluster());
separateCustomProperties(masterVm);
}
if (getVm() != null) {
updateVmDevices();
images.addAll(getVmDisksFromDB());
setStoragePoolId(getVm().getStoragePoolId());
isVmInDb = true;
} else if (getCluster() != null && masterVm != null) {
VM vm = new VM(masterVm, new VmDynamic(), null);
vm.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion());
setVm(vm);
setStoragePoolId(getCluster().getStoragePoolId());
}
updateDiskInfoDestinationMap();
generateTargetDiskIds();
getParameters().setUseCinderCommandCallback(!getCinderDisks().isEmpty());
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class RestoreAllSnapshotsCommandTest method getVmDynamic.
/**
* Mock a VM.
*/
private VmDynamic getVmDynamic() {
VmDynamic vmDynamic = new VmDynamic();
vmDynamic.setId(vmId);
vmDynamic.setStatus(VMStatus.Down);
return vmDynamic;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmMapperTest method testGuestTimezone.
@Test
public void testGuestTimezone() {
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.setGuestOsTimezoneName("This is not a timezone");
vmDynamic.setGuestOsTimezoneOffset(-60);
vm.setDynamicData(vmDynamic);
Vm map = VmMapper.map(vm, (Vm) null);
assertNotNull(map.getGuestTimeZone());
assertEquals("-01:00", map.getGuestTimeZone().getUtcOffset());
assertEquals("This is not a timezone", map.getGuestTimeZone().getName());
}
Aggregations