Search in sources :

Example 86 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class DiskValidatorTest method testDiskAttachedToVMValid.

@Test
public void testDiskAttachedToVMValid() {
    VM vm = createVM();
    when(vmDao.getVmsListForDisk(any(), anyBoolean())).thenReturn(Collections.singletonList(vm));
    assertThat(validator.isDiskAttachedToVm(vm), isValid());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 87 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class DiskValidatorTest method testDiskAttachedToVMFail.

@Test
public void testDiskAttachedToVMFail() {
    VM vm = createVM();
    assertThat(validator.isDiskAttachedToVm(vm), failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_ATTACHED_TO_VM));
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 88 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class DiskValidatorTest method prepareForCheckingIfDiskPluggedToVmsThatAreNotDown.

public List<Pair<VM, VmDevice>> prepareForCheckingIfDiskPluggedToVmsThatAreNotDown() {
    VM vm1 = createVM();
    VM vm2 = createVM();
    VmDevice device1 = createVmDeviceForDisk(vm1, disk);
    VmDevice device2 = createVmDeviceForDisk(vm1, disk);
    List<Pair<VM, VmDevice>> vmsInfo = new LinkedList<>();
    vmsInfo.add(new Pair<>(vm1, device1));
    vmsInfo.add(new Pair<>(vm2, device2));
    return vmsInfo;
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VM(org.ovirt.engine.core.common.businessentities.VM) LinkedList(java.util.LinkedList) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 89 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class DiskVmElementValidatorTest method diskInterfaceSupportedByOs.

@Test
public void diskInterfaceSupportedByOs() {
    VM vm = createVM(OS_WITH_SUPPORTED_INTERFACES);
    initializeInterfaceValidation(DiskInterface.VirtIO);
    dve.setDiskInterface(DiskInterface.VirtIO);
    assertThat(validator.isDiskInterfaceSupported(vm), isValid());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 90 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class DiskVmElementValidatorTest method diskInterfaceNotSupportedByOs.

@Test
public void diskInterfaceNotSupportedByOs() {
    VM vm = createVM(OS_WITH_NO_SUPPORTED_INTERFACES);
    initializeInterfaceValidation(DiskInterface.VirtIO);
    dve.setDiskInterface(DiskInterface.VirtIO);
    assertThat(validator.isDiskInterfaceSupported(vm), failsWith(EngineMessage.ACTION_TYPE_DISK_INTERFACE_UNSUPPORTED));
}
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