Search in sources :

Example 51 with VM

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;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM)

Example 52 with 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());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 53 with VM

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());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 54 with VM

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;
}
Also used : SnapshotStatus(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid)

Example 55 with 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());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Aggregations

VM (org.ovirt.engine.core.common.businessentities.VM)591 Test (org.junit.Test)178 Guid (org.ovirt.engine.core.compat.Guid)150 ArrayList (java.util.ArrayList)130 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)82 HashMap (java.util.HashMap)69 List (java.util.List)65 VDS (org.ovirt.engine.core.common.businessentities.VDS)63 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)56 Map (java.util.Map)53 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)53 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)41 QueryType (org.ovirt.engine.core.common.queries.QueryType)36 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)34 Frontend (org.ovirt.engine.ui.frontend.Frontend)34 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)33 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)32 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)32 Collectors (java.util.stream.Collectors)31 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)31