use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class DiskVmElementDiscardSupportValidatorTest method data.
@Parameters
public static Object[][] data() {
ValidationResult passDiscardNotSupportedByDiskInterface = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE, getDiskAliasVarReplacement());
ValidationResult passDiscardNotSupportedForDirectLunByUnderlyingStorage = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_FOR_DIRECT_LUN_BY_UNDERLYING_STORAGE, getDiskAliasVarReplacement());
ValidationResult passDiscardNotSupportedForDiskImageByUnderlyingStorage = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_FOR_DISK_IMAGE_BY_UNDERLYING_STORAGE, getDiskAliasVarReplacement(), getStorageDomainNameVarReplacement());
ValidationResult passDiscardNotSupportedByCinder = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_STORAGE_TYPE, getDiskAliasVarReplacement(), String.format("$diskStorageType %s", DiskStorageType.CINDER));
// sdSupportsDiscard, diskWipeAfterDelete, expectedResult.
return new Object[][] { // isPassDiscard == false
{ new DiskImage(), false, null, null, null, null, null, ValidationResult.VALID }, // Unsupported interface
{ new DiskImage(), true, DiskInterface.VirtIO, null, null, null, null, passDiscardNotSupportedByDiskInterface }, { new DiskImage(), true, DiskInterface.SPAPR_VSCSI, null, null, null, null, passDiscardNotSupportedByDiskInterface }, // Direct lun without support from underlying storage (different interfaces)
{ new LunDisk(), true, DiskInterface.VirtIO_SCSI, 0L, null, null, null, passDiscardNotSupportedForDirectLunByUnderlyingStorage }, { new LunDisk(), true, DiskInterface.IDE, 0L, null, null, null, passDiscardNotSupportedForDirectLunByUnderlyingStorage }, // Direct lun with support from underlying storage (different interfaces)
{ new LunDisk(), true, DiskInterface.VirtIO_SCSI, 1024L, null, null, null, ValidationResult.VALID }, { new LunDisk(), true, DiskInterface.IDE, 1024L, null, null, null, ValidationResult.VALID }, /*
Image on file storage domain:
- with/without support from underlying storage
- different interfaces
- different file storage types
*/
{ new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.NFS, true, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.POSIXFS, false, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.POSIXFS, null, null, ValidationResult.VALID }, /*
Image on block storage domain without support from underlying storage:
- different interfaces
- different block storage types
*/
{ new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, false, null, passDiscardNotSupportedForDiskImageByUnderlyingStorage }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, false, null, passDiscardNotSupportedForDiskImageByUnderlyingStorage }, /*
Image on block storage domain with support from underlying storage:
- different interfaces
- different block storage types
*/
{ new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, true, null, ValidationResult.VALID }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, true, null, ValidationResult.VALID }, /*
Image on block storage domain with support from underlying storage and WAD enabled:
- different interfaces
- different block storage types
*/
{ new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.ISCSI, true, true, new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(), getDiskAliasVarReplacement()) }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.FCP, true, true, new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(), getDiskAliasVarReplacement()) }, /*
Image on non file or block storage domain:
- different interfaces
- different non file or block storage types
*/
{ new DiskImage(), true, DiskInterface.VirtIO_SCSI, null, StorageType.UNKNOWN, null, null, createPassDiscardNotSupportedByStorageTypeValResult(StorageType.UNKNOWN) }, { new DiskImage(), true, DiskInterface.IDE, null, StorageType.CINDER, null, null, createPassDiscardNotSupportedByStorageTypeValResult(StorageType.CINDER) }, // Unsupported disk storage type (different interfaces)
{ new CinderDisk(), true, DiskInterface.VirtIO_SCSI, null, null, null, null, passDiscardNotSupportedByCinder }, { new CinderDisk(), true, DiskInterface.IDE, null, null, null, null, passDiscardNotSupportedByCinder } };
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class MultipleStorageDomainsValidatorTest method testAllDomainsHaveSpaceForClonedDisksFail.
@Test
public void testAllDomainsHaveSpaceForClonedDisksFail() {
List<Guid> sdIds = Arrays.asList(sdId1, sdId2);
List<DiskImage> disksList = generateDisksList(NUM_DISKS, sdIds);
StorageDomainValidator storageDomainValidator = mock(StorageDomainValidator.class);
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(storageDomainValidator).hasSpaceForClonedDisks(any());
doReturn(storageDomainValidator).when(validator).getStorageDomainValidator(any());
ValidationResult result = validator.allDomainsHaveSpaceForClonedDisks(disksList);
assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class MultipleStorageDomainsValidatorTest method testAllDomainsExistAndActiveOneInactive.
@Test
public void testAllDomainsExistAndActiveOneInactive() {
domain1.setStatus(StorageDomainStatus.Active);
domain2.setStatus(StorageDomainStatus.Inactive);
domain3.setStatus(StorageDomainStatus.Active);
ValidationResult result = validator.allDomainsExistAndActive();
assertThat("One domain should not be active", result, failsWith(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class MultipleStorageDomainsValidatorTest method testAllDomainsHaveSpaceForAllDisksFail.
@Test
public void testAllDomainsHaveSpaceForAllDisksFail() {
List<Guid> sdIdsForNew = Arrays.asList(sdId1, sdId2);
List<Guid> sdIdsForCloned = Arrays.asList(sdId2, sdId3);
List<DiskImage> disksListForNew = generateDisksList(NUM_DISKS, sdIdsForNew);
List<DiskImage> disksListForCloned = generateDisksList(NUM_DISKS, sdIdsForCloned);
StorageDomainValidator storageDomainValidator = mock(StorageDomainValidator.class);
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(storageDomainValidator).hasSpaceForAllDisks(any(), any());
doReturn(storageDomainValidator).when(validator).getStorageDomainValidator(any());
ValidationResult result = validator.allDomainsHaveSpaceForAllDisks(disksListForNew, disksListForCloned);
assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class MultipleStorageDomainsValidatorTest method testAllDomainsWithinThresholdsOneLacking.
@Test
public void testAllDomainsWithinThresholdsOneLacking() {
domain1.getStorageDynamicData().setAvailableDiskSize(CRITICAL_SPACE_THRESHOLD + 1);
domain2.getStorageDynamicData().setAvailableDiskSize(CRITICAL_SPACE_THRESHOLD - 1);
domain1.setCriticalSpaceActionBlocker(CRITICAL_SPACE_THRESHOLD);
domain2.setCriticalSpaceActionBlocker(CRITICAL_SPACE_THRESHOLD);
ValidationResult result = validator.allDomainsWithinThresholds();
assertThat("domain2 should not be within thresholds", result, failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
}
Aggregations