use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDomainValidatorFreeSpaceTest method createParams.
@Parameterized.Parameters
public static Collection<Object[]> createParams() {
List<Object[]> params = new ArrayList<>();
for (StorageType storageType : StorageType.values()) {
if (storageType.isConcreteStorageType() && !storageType.isCinderDomain()) {
List<VolumeType> volumeTypes = storageType.isFileDomain() ? Arrays.asList(VolumeType.Preallocated, VolumeType.Sparse) : Collections.singletonList(VolumeType.Preallocated);
for (VolumeType volumeType : volumeTypes) {
for (VolumeFormat volumeFormat : new VolumeFormat[] { VolumeFormat.COW, VolumeFormat.RAW }) {
DiskImage disk = new DiskImage();
disk.setVolumeFormat(volumeFormat);
disk.setVolumeType(volumeType);
disk.getSnapshots().add(disk);
disk.setSizeInGigabytes(200);
// GB
disk.setActualSize(100);
StorageDomain sd = new StorageDomain();
sd.setStorageType(storageType);
// GB
sd.setAvailableDiskSize(107);
params.add(new Object[] { disk, sd, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse });
}
}
}
}
return params;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class StorageDomainValidatorTest method mockStorageDomain.
private static StorageDomain mockStorageDomain(int availableSize, int usedSize, StorageType storageType) {
StorageDomain sd = new StorageDomain();
sd.setAvailableDiskSize(availableSize);
sd.setUsedDiskSize(usedSize);
sd.setStatus(StorageDomainStatus.Active);
sd.setStorageType(storageType);
sd.setCriticalSpaceActionBlocker(CRITICAL_SPACE_THRESHOLD);
return sd;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain 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.StorageDomain in project ovirt-engine by oVirt.
the class AbstractSyncStorageDomainsLunsCommandTest method setUp.
@Before
public void setUp() {
blockSd1Id = Guid.newGuid();
String sd1Name = "vg1";
blockSd1 = new StorageDomain();
blockSd1.setId(blockSd1Id);
blockSd1.setStorageType(StorageType.ISCSI);
blockSd1.setStatus(StorageDomainStatus.Active);
blockSd1.setStorage(sd1Name);
blockSd1Lun1 = new LUNs();
blockSd1Lun1.setId("blockSd1Lun1");
blockSd1Lun1.setVolumeGroupId(sd1Name);
blockSd1Lun1.setStorageDomainId(blockSd1Id);
blockSd2Id = Guid.newGuid();
String sd2Name = "vg2";
blockSd2 = new StorageDomain();
blockSd2.setId(blockSd2Id);
blockSd2.setStorageType(StorageType.FCP);
blockSd2.setStatus(StorageDomainStatus.Active);
blockSd2.setStorage(sd2Name);
blockSd2Lun1 = new LUNs();
blockSd2Lun1.setId("blockSd2Lun1");
blockSd2Lun2 = new LUNs();
blockSd2Lun2.setId("blockSd2Lun2");
blockSd2Lun1.setVolumeGroupId(sd2Name);
blockSd2Lun1.setStorageDomainId(blockSd2Id);
blockSd2Lun2.setVolumeGroupId(sd2Name);
blockSd2Lun2.setStorageDomainId(blockSd2Id);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class SyncAllStorageDomainsLunsCommandTest method getStorageDomainsToSync.
@Test
public void getStorageDomainsToSync() {
StorageDomain validSd = new StorageDomain();
validSd.setId(Guid.newGuid());
validSd.setStorageType(StorageType.ISCSI);
validSd.setStatus(StorageDomainStatus.Active);
StorageDomain nfsSd = new StorageDomain();
nfsSd.setId(Guid.newGuid());
nfsSd.setStorageType(StorageType.NFS);
StorageDomain inactiveIscsiSd = new StorageDomain();
inactiveIscsiSd.setId(Guid.newGuid());
inactiveIscsiSd.setStorageType(StorageType.ISCSI);
inactiveIscsiSd.setStatus(StorageDomainStatus.Inactive);
List<StorageDomain> storageDomains = Arrays.asList(validSd, inactiveIscsiSd, nfsSd);
when(storageDomainDao.getAllForStoragePool(storagePoolId)).thenReturn(storageDomains);
assertEquals(Collections.singletonList(validSd), command.getStorageDomainsToSync().collect(Collectors.toList()));
}
Aggregations