use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class UpdateRngDeviceTest method mockCommand.
private UpdateRngDeviceCommand mockCommand() {
final VmStatic vmMock = mock(VmStatic.class);
when(vmMock.getClusterId()).thenReturn(clusterId);
when(vmDaoMock.get(vmId)).thenReturn(vmMock);
when(vmDeviceDaoMock.getVmDeviceByVmIdAndType(vmId, VmDeviceGeneralType.RNG)).thenReturn(Collections.singletonList(new VmDevice()));
final Cluster cluster = mock(Cluster.class);
when(cluster.getRequiredRngSources()).thenReturn(Collections.singleton(VmRngDevice.Source.RANDOM));
when(clusterMock.get(clusterId)).thenReturn(cluster);
cmd.init();
return cmd;
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class UpdateVmCommandTest method initParams.
private static VmManagementParametersBase initParams() {
VmStatic vmStatic = new VmStatic();
vmStatic.setClusterId(clusterId);
vmStatic.setName("my_vm");
vmStatic.setMaxMemorySizeMb(MAX_MEMORY_SIZE);
vmStatic.setMemSizeMb(MEMORY_SIZE);
VmManagementParametersBase params = new VmManagementParametersBase();
params.setCommandType(ActionType.UpdateVm);
params.setVmStaticData(vmStatic);
params.setUpdateNuma(true);
return params;
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method initVmStaticsOrderedByAutoStartup.
/**
* Creates an array of VM static which was initiated for Priority and MigrationSupport order, and modified the
* auto-startup to reflect the precedence of the auto-startup column on top the Priority.
*
* @return an array of VmStatics, in descending order according to: auto_startup, priority, MigrationSupport. The
* auto_startup is the one being checked
*/
private VmStatic[] initVmStaticsOrderedByAutoStartup(List<VmStatic> vmStatics) {
VmStatic[] vmStaticArray = initVmStaticsOrderedByPriority(vmStatics);
// Swapping the first two VmStatics
VmStatic tempVmStatic = vmStaticArray[0];
vmStaticArray[0] = vmStaticArray[1];
vmStaticArray[1] = tempVmStatic;
// Maintaining the order correctness of the elements by incrementing the auto_startup of the first element
vmStaticArray[0].setAutoStartup(true);
updateArrayOfVmStaticsInDb(vmStaticArray);
return vmStaticArray;
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testGetAllWithFailbackByVds.
/**
* Ensures that the right set of VMs are returned.
*/
@Test
public void testGetAllWithFailbackByVds() {
List<VmStatic> result = dao.getAllWithFailbackByVds(FixturesTool.VDS_RHEL6_NFS_SPM);
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmStatic vm : result) {
assertEquals(FixturesTool.CLUSTER, vm.getClusterId());
}
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method generateNewEntity.
@Override
protected VmStatic generateNewEntity() {
VmStatic newVmStatic = new VmStatic();
newVmStatic.setId(Guid.newGuid());
newVmStatic.setName("New Virtual Machine");
newVmStatic.setClusterId(FixturesTool.CLUSTER);
newVmStatic.setVmtGuid(FixturesTool.VM_TEMPLATE_RHEL5);
newVmStatic.setOrigin(OriginType.OVIRT);
newVmStatic.setQuotaId(FixturesTool.QUOTA_GENERAL);
newVmStatic.setCpuProfileId(FixturesTool.CPU_PROFILE_1);
newVmStatic.setSmallIconId(FixturesTool.SMALL_ICON_ID);
newVmStatic.setLargeIconId(FixturesTool.LARGE_ICON_ID);
newVmStatic.setConsoleDisconnectAction(ConsoleDisconnectAction.REBOOT);
return newVmStatic;
}
Aggregations