use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class DeactivateStorageDomainCommand method getVmsWithAttachedISO.
protected List<String> getVmsWithAttachedISO() {
List<VmStatic> vms = vmStaticDao.getAllByStoragePoolId(getStorageDomain().getStoragePoolId());
List<String> vmNames = new LinkedList<>();
for (VmStatic vmStatic : vms) {
VmDynamic vmDynamic = vmDynamicDao.get(vmStatic.getId());
if (vmDynamic.getStatus() != VMStatus.Down && !StringUtils.isEmpty(vmDynamic.getCurrentCd())) {
vmNames.add(vmStatic.getName());
}
}
return vmNames;
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoTest method testGuestAgentStatus.
@Test
public void testGuestAgentStatus() throws Exception {
Guid vmId = FixturesTool.VM_RHEL5_POOL_51;
VmDynamic vmDynamic = dao.get(vmId);
vmDynamic.setGuestAgentStatus(GuestAgentStatus.UpdateNeeded);
dao.update(vmDynamic);
vmDynamic = dao.get(vmId);
assertEquals(vmDynamic.getGuestAgentStatus().getValue(), GuestAgentStatus.UpdateNeeded.getValue());
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoTest method testUpdateToUnknown.
@Test
public void testUpdateToUnknown() {
VmDynamic existingVm2 = dao.get(FixturesTool.VM_RHEL5_POOL_51);
VmDynamic existingVm3 = dao.get(FixturesTool.VM_RHEL5_POOL_50);
dao.updateVmsToUnknown(Arrays.asList(existingEntity.getId(), existingVm2.getId()));
assertEquals(VMStatus.Unknown, dao.get(existingEntity.getId()).getStatus());
assertEquals(VMStatus.Unknown, dao.get(existingVm2.getId()).getStatus());
assertNotEquals(VMStatus.Unknown, dao.get(existingVm3.getId()).getStatus());
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoTest method testGetAllForRunningForVds.
/**
* Gets all dynamic details for VMs running on a specific VDS.
*/
@Test
public void testGetAllForRunningForVds() {
List<VmDynamic> result = dao.getAllRunningForVds(FixturesTool.VDS_RHEL6_NFS_SPM);
assertNotNull(result);
assertFalse(result.isEmpty());
assertEquals(DYNAMIC_RUNNING_COUNT, result.size());
for (VmDynamic vmdynamic : result) {
assertEquals(FixturesTool.VDS_RHEL6_NFS_SPM, vmdynamic.getRunOnVds());
}
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmDynamicDaoTest method testUpdateConsoleUserWithOptimisticLockingSuccess.
/**
* Make sure that saving a new console user id and console user name to a virtual machine
* without a previous console user succeeds and returns {@code true}.
*/
@Test
public void testUpdateConsoleUserWithOptimisticLockingSuccess() throws Exception {
VmDynamic vmWithoutConsoleUser = dao.get(FixturesTool.VM_RHEL5_POOL_51);
vmWithoutConsoleUser.setConsoleUserId(new Guid("9bf7c640-b620-456f-a550-0348f366544b"));
boolean result = dao.updateConsoleUserWithOptimisticLocking(vmWithoutConsoleUser);
assertTrue(result);
}
Aggregations