use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class LiveMigrateDiskCommand method getVm.
@Override
public VM getVm() {
VM vm = super.getVm();
if (vm == null) {
vm = vmDao.getVmsListForDisk(getImageGroupId(), false).get(0);
setVm(vm);
setVmId(vm.getId());
}
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method validateSimpleInitrdAndKernelName.
@Test
public void validateSimpleInitrdAndKernelName() throws Exception {
String Initrd = "/boot/initrd.initrd";
String Kernel = "/boot/kernel.image";
VM vm = createVmForTesting(Initrd, Kernel);
assertEquals(Initrd, vm.getInitrdUrl());
assertEquals(Kernel, vm.getKernelUrl());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method testFlowOnStatelessNoDisks.
@Test
public void testFlowOnStatelessNoDisks() {
final VM vm = new VM();
vm.setStatus(VMStatus.Down);
vm.getDiskList().clear();
command.setVm(vm);
command.getParameters().setRunAsStateless(true);
doNothing().when(command).fetchVmDisksFromDb();
doReturn(false).when(command).isStatelessSnapshotExistsForVm();
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 mockVm.
/**
* Mock a VM.
*/
private VM mockVm() {
VM vm = new VM();
vm.setStatus(VMStatus.Down);
when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);
command.setCluster(new Cluster());
// Avoid referencing the unmockable static VmHandler.updateCurrentCd
doNothing().when(command).updateCurrentCd(any());
doReturn(false).when(command).shouldRestoreMemory();
when(snapshotDAO.exists(any(Guid.class), any(SnapshotStatus.class))).thenReturn(false);
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class RunVmCommandTest method validateIsoPrefixNameForInitrdAndNullForKernel.
@Test
public void validateIsoPrefixNameForInitrdAndNullForKernel() throws Exception {
String initrd = "initrd";
VM vm = createVmForTesting(RunVmCommand.ISO_PREFIX + initrd, null);
assertEquals(ACTIVE_ISO_PREFIX + "/" + initrd, vm.getInitrdUrl());
assertNull(vm.getKernelUrl());
}
Aggregations