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);
}
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);
}
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;
}
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;
}
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;
}
Aggregations