use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class ImportValidatorTest method insufficientDiskSpaceWithCollapse.
@Test
public void insufficientDiskSpaceWithCollapse() {
ImportValidator validator = setupDiskSpaceTest(createParameters());
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleSdValidator).allDomainsHaveSpaceForClonedDisks(any());
assertThat(validator.validateSpaceRequirements(Collections.emptyList()), failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
verify(multipleSdValidator).allDomainsHaveSpaceForClonedDisks(any());
verify(multipleSdValidator, never()).allDomainsHaveSpaceForDisksWithSnapshots(any());
verify(multipleSdValidator, never()).allDomainsHaveSpaceForNewDisks(any());
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class InClusterUpgradeValidatorTest method shouldCreateNiceValidationResult.
@Test
public void shouldCreateNiceValidationResult() throws IOException {
invalidVM.setCpuPinning("i am pinned");
invalidVM.setDedicatedVmForVdsList(Guid.newGuid());
invalidVM.setMigrationSupport(PINNED_TO_HOST);
invalidVM.setId(Guid.Empty);
newHost1.setHostOs("invalid os");
ValidationResult validationResult = validator.isUpgradePossible(Collections.singletonList(newHost1), Collections.singletonList(invalidVM));
assertThat(validationResult.getVariableReplacements()).contains("CLUSTER_UPGRADE_DETAIL_HOST_INVALID_OS", "CLUSTER_UPGRADE_DETAIL_VM_CPUS_PINNED", "CLUSTER_UPGRADE_DETAIL_VM_NOT_MIGRATABLE");
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedLogicalNetworkBelongToAnotherDatacenter.
@Test
public void addedLogicalNetworkBelongToAnotherDatacenter() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
iscsiBond.getNetworkIds().add(networks.get(0).getId());
iscsiBond.getNetworkIds().add(Guid.newGuid());
ValidationResult res = validator.validateAddedLogicalNetworks(iscsiBond);
assertThat(res, failsWith(EngineMessage.NETWORKS_DONT_EXIST_IN_DATA_CENTER));
assertEquals(2, res.getVariableReplacements().size());
assertEquals("$networkIds " + iscsiBond.getNetworkIds().get(1).toString(), res.getVariableReplacements().get(0));
assertEquals("$dataCenterId " + iscsiBond.getStoragePoolId().toString(), res.getVariableReplacements().get(1));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method someAddedStorageConnectionsAreNotAnIscsi.
@Test
public void someAddedStorageConnectionsAreNotAnIscsi() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<StorageServerConnections> conns = new ArrayList<>();
conns.add(createStorageConnection());
doReturn(conns).when(storageServerConnectionDao).getConnectableStorageConnectionsByStorageType(iscsiBond.getStoragePoolId(), StorageType.ISCSI);
iscsiBond.getStorageConnectionIds().add(conns.get(0).getId());
iscsiBond.getStorageConnectionIds().add(Guid.newGuid().toString());
ValidationResult res = validator.validateAddedStorageConnections(iscsiBond);
assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTIONS_CANNOT_BE_ADDED_TO_ISCSI_BOND));
assertEquals(1, res.getVariableReplacements().size());
assertEquals("$connectionIds " + iscsiBond.getStorageConnectionIds().get(1).toString(), res.getVariableReplacements().get(0));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedRequiredLogicalNetworks.
@Test
public void addedRequiredLogicalNetworks() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
networks.add(createNetwork(iscsiBond.getStoragePoolId()));
doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
for (Network network : networks) {
iscsiBond.getNetworkIds().add(network.getId());
}
List<NetworkCluster> networkClusters = new ArrayList<>();
networkClusters.add(createNetworkCluster(true));
doReturn(networkClusters).when(networkClusterDao).getAllForNetwork(any());
ValidationResult res = validator.validateAddedLogicalNetworks(iscsiBond);
assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_ISCSI_BOND_NETWORK_CANNOT_BE_REQUIRED));
}
Aggregations