Search in sources :

Example 51 with DiskImage

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

Example 52 with DiskImage

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

the class AddVmTemplateCommandTest method testOneEmptyDiskAlias.

@Test
public void testOneEmptyDiskAlias() {
    Map<Guid, DiskImage> diskInfoDestinationMap = new HashMap<>();
    DiskImage disk1 = new DiskImage();
    disk1.setDiskAlias("");
    diskInfoDestinationMap.put(Guid.newGuid(), disk1);
    cmd.diskInfoDestinationMap = diskInfoDestinationMap;
    assertFalse(cmd.isDisksAliasNotEmpty());
}
Also used : HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 53 with DiskImage

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

the class AddVmTemplateCommandTest method getDisksList.

private List<DiskImage> getDisksList(Guid spId) {
    DiskImage disk = new DiskImage();
    disk.setStorageIds(new ArrayList<>(Collections.singletonList(spId)));
    return Collections.singletonList(disk);
}
Also used : DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 54 with DiskImage

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

the class AddVmTemplateCommandTest method testOneOfManyEmptyDiskAlias.

@Test
public void testOneOfManyEmptyDiskAlias() {
    Map<Guid, DiskImage> diskInfoDestinationMap = new HashMap<>();
    DiskImage disk1 = new DiskImage();
    DiskImage disk2 = new DiskImage();
    disk1.setDiskAlias("");
    disk2.setDiskAlias("disk");
    diskInfoDestinationMap.put(Guid.newGuid(), disk1);
    diskInfoDestinationMap.put(Guid.newGuid(), disk2);
    cmd.diskInfoDestinationMap = diskInfoDestinationMap;
    assertFalse(cmd.isDisksAliasNotEmpty());
}
Also used : HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 55 with DiskImage

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

the class CommonVmPoolCommandTestAbstract method getDiskImageTempalteList.

private static Map<Guid, DiskImage> getDiskImageTempalteList() {
    Map<Guid, DiskImage> diskTemplateList = new HashMap<>();
    DiskImage diskImageTemplate = new DiskImage();
    diskImageTemplate.setId(Guid.newGuid());
    diskImageTemplate.setImageId(Guid.newGuid());
    diskImageTemplate.setStorageIds(new ArrayList<>());
    diskTemplateList.put(diskImageTemplate.getId(), diskImageTemplate);
    diskImageTemplate = new DiskImage();
    diskImageTemplate.setId(Guid.newGuid());
    diskImageTemplate.setImageId(Guid.newGuid());
    diskImageTemplate.setStorageIds(new ArrayList<>());
    diskTemplateList.put(diskImageTemplate.getId(), diskImageTemplate);
    return diskTemplateList;
}
Also used : HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)635 Guid (org.ovirt.engine.core.compat.Guid)212 ArrayList (java.util.ArrayList)167 Test (org.junit.Test)132 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)80 VM (org.ovirt.engine.core.common.businessentities.VM)77 HashMap (java.util.HashMap)64 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)62 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)62 List (java.util.List)56 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)48 Map (java.util.Map)39 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)38 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)35 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)34 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)31 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)31 EngineException (org.ovirt.engine.core.common.errors.EngineException)29 ActionType (org.ovirt.engine.core.common.action.ActionType)22 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)22