Search in sources :

Example 71 with DiskImage

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

the class RunVmValidatorTest method testVmWithDisks.

@Test
public void testVmWithDisks() {
    List<Disk> disks = new ArrayList<>();
    disks.add(new DiskImage());
    validateResult(runVmValidator.validateBootSequence(new VM(), disks), true, null);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 72 with DiskImage

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

the class RunVmValidatorTest method testNoIsoDomainIsoOnDataDomain.

@Test
public void testNoIsoDomainIsoOnDataDomain() {
    VM vm = new VM();
    vm.setStoragePoolId(Guid.newGuid());
    vm.setBootSequence(BootSequence.CD);
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(Guid.newGuid());
    DiskImage diskImage = new DiskImage();
    diskImage.setStorageIds(Collections.singletonList(storageDomain.getId()));
    diskImage.setContentType(DiskContentType.ISO);
    when(diskDao.get(any(Guid.class))).thenReturn(diskImage);
    when(storagePoolIsoMapDao.get(new StoragePoolIsoMapId(storageDomain.getId(), vm.getStoragePoolId()))).thenReturn(null);
    validateResult(runVmValidator.validateIsoPath(vm, Guid.newGuid().toString(), null, null), false, EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VM(org.ovirt.engine.core.common.businessentities.VM) StoragePoolIsoMapId(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 73 with DiskImage

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

the class ProcessOvfUpdateForStoragePoolCommandTest method generateVmTemplatesMapByGuids.

private Map<Guid, VmTemplate> generateVmTemplatesMapByGuids(List<Guid> ids, int diskCount, VmTemplateStatus templateStatus, ImageStatus diskStatus) {
    Map<Guid, VmTemplate> toReturn = new HashMap<>();
    for (Guid id : ids) {
        VmTemplate template = createVmTemplate(id, templateStatus);
        for (int i = 0; i < diskCount; i++) {
            DiskImage image = createDiskImage(diskStatus);
            template.getDiskTemplateMap().put(image.getId(), image);
            template.getDiskList().add(image);
        }
        toReturn.put(template.getId(), template);
    }
    return toReturn;
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) HashMap(java.util.HashMap) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 74 with DiskImage

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

the class ProcessOvfUpdateForStoragePoolCommandTest method createDiskImage.

private DiskImage createDiskImage(ImageStatus status) {
    DiskImage disk = new DiskImage();
    disk.setId(Guid.newGuid());
    disk.setImageStatus(status);
    ArrayList<Guid> storageIds = new ArrayList<>();
    storageIds.add(poolDomainsOvfInfo.keySet().iterator().next());
    disk.setStorageIds(storageIds);
    return disk;
}
Also used : ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 75 with DiskImage

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

the class OvfManagerTest method createDisksAndDiskVmElements.

private static ArrayList<DiskImage> createDisksAndDiskVmElements(VM vm) {
    ArrayList<DiskImage> disks = new ArrayList<>();
    RandomUtils rnd = RandomUtils.instance();
    for (int i = 0; i < rnd.nextInt(3, 10); i++) {
        DiskImage disk = createVmDisk(vm);
        disks.add(disk);
    }
    return disks;
}
Also used : RandomUtils(org.ovirt.engine.core.utils.RandomUtils) ArrayList(java.util.ArrayList) 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