use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method validateInitrdWithSlashOnly.
@Test
public void validateInitrdWithSlashOnly() throws Exception {
String initrd = "/";
VM vm = createVmForTesting(initrd, null);
assertEquals("/", vm.getInitrdUrl());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method testValidate.
@Test
public void testValidate() {
final VM vm = new VM();
vm.setStatus(VMStatus.Down);
command.setVm(vm);
command.setStoragePool(new StoragePool());
doReturn(true).when(command).checkRngDeviceClusterCompatibility();
doReturn(true).when(command).checkPayload(any());
doReturn(ValidationResult.VALID).when(command).checkDisksInBackupStorage();
command.setCluster(new Cluster());
ValidateTestUtils.runAndAssertValidateSuccess(command);
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method testFlowOnStatelessWithDisks.
@Test
public void testFlowOnStatelessWithDisks() {
final VM vm = new VM();
vm.setStatus(VMStatus.Down);
vm.getDiskList().add(new DiskImage());
command.setVm(vm);
command.getParameters().setRunAsStateless(true);
doReturn(false).when(command).isStatelessSnapshotExistsForVm();
doNothing().when(command).fetchVmDisksFromDb();
assertEquals(RunVmFlow.CREATE_STATELESS_IMAGES, command.getFlow());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method oneConnectFailed.
@Test
public void oneConnectFailed() {
command.setVm(new VM());
// create 2 lun disks
LunDisk lunDisk1 = new LunDisk();
LUNs lun1 = new LUNs();
lun1.setLUNId("id1");
lunDisk1.setLun(lun1);
// add luns to the vm
command.getVm().getDiskMap().put(Guid.newGuid(), lunDisk1);
List<StorageServerConnections> connections = new ArrayList<>();
// luns have the same backing targets
connections.add(new StorageServerConnections("/path/to/con1", "id1", null, null, StorageType.ISCSI, null, null, null));
when(storageServerConnectionDao.getAllForLun("id1")).thenReturn(connections);
ArgumentCaptor<StorageServerConnectionManagementVDSParameters> captor = ArgumentCaptor.forClass(StorageServerConnectionManagementVDSParameters.class);
doReturn(new VDSReturnValue()).when(command).runVdsCommand(eq(ConnectStorageServer), any(StorageServerConnectionManagementVDSParameters.class));
boolean connectSucceeded = command.connectLunDisks(Guid.newGuid());
// for same targets, connect only once
verify(command).runVdsCommand(eq(ConnectStorageServer), captor.capture());
assertThat(captor.getValue().getConnectionList().size(), is(1));
assertFalse(connectSucceeded);
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class AddVmTemplateCommandTest method createVM.
private VM createVM() {
Guid vmId = Guid.newGuid();
Guid clusterId = Guid.newGuid();
Guid spId = Guid.newGuid();
VM vm = new VM();
vm.setId(vmId);
vm.setClusterId(clusterId);
vm.setStoragePoolId(spId);
vm.setVmOs(14);
return vm;
}
Aggregations