use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class InitVdsOnUpCommand method runConnectHostToPoolEvent.
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) {
EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL);
StoragePool storagePool = storagePoolDao.get(storagePoolId);
StorageDomain masterDomain = storageDomainDao.getStorageDomains(storagePoolId, StorageDomainType.Master).get(0);
List<StoragePoolIsoMap> storagePoolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(storagePoolId);
boolean masterDomainInactiveOrUnknown = masterDomain.getStatus() == StorageDomainStatus.Inactive || masterDomain.getStatus() == StorageDomainStatus.Unknown;
VDSError error = null;
try {
VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds, storagePool, masterDomain.getId(), storagePoolIsoMap));
if (!vdsReturnValue.getSucceeded()) {
error = vdsReturnValue.getVdsError();
}
} catch (EngineException e) {
error = e.getVdsError();
}
if (error != null) {
if (error.getCode() != EngineError.CannotConnectMultiplePools && masterDomainInactiveOrUnknown) {
log.info("Could not connect host '{}' to pool '{}', as the master domain is in inactive/unknown" + " status - not failing the operation", vds.getName(), storagePool.getName());
} else {
log.error("Could not connect host '{}' to pool '{}': {}", vds.getName(), storagePool.getName(), error.getMessage());
result.setSuccess(false);
}
}
if (result.isSuccess()) {
Pair<Boolean, List<StorageDomainStatic>> vdsStatsResults = proceedVdsStats(!masterDomainInactiveOrUnknown, storagePool);
result.setSuccess(vdsStatsResults.getFirst());
if (!result.isSuccess()) {
result.setResultData(vdsStatsResults.getSecond());
auditLogDirector.log(this, AuditLogType.VDS_STORAGE_VDS_STATS_FAILED);
}
}
return result;
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class CINDERStorageHelper method attachCinderDomainToPool.
public void attachCinderDomainToPool(final Guid storageDomainId, final Guid storagePoolId) {
StoragePoolIsoMap storagePoolIsoMap = new StoragePoolIsoMap(storageDomainId, storagePoolId, StorageDomainStatus.Maintenance);
storagePoolIsoMapDao.save(storagePoolIsoMap);
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class StoragePoolIsoMapDaoTest method testGetAllStoragePoolIsoMapsForIso.
@Test
public void testGetAllStoragePoolIsoMapsForIso() {
List<StoragePoolIsoMap> result = dao.getAllForStorage(FixturesTool.STORAGE_DOMAIN_SCALE_SD5);
assertNotNull(result);
assertFalse(result.isEmpty());
for (StoragePoolIsoMap mapping : result) {
assertEquals(FixturesTool.STORAGE_DOMAIN_SCALE_SD5, mapping.getStorageId());
}
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class StorageServerConnectionDaoTest method getStorageConnectionsByStorageTypeWithRecords.
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) {
List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES);
List<Guid> storageDomainIds = poolIsoMap.stream().filter(isoMap -> statuses.contains(isoMap.getStatus())).map(StoragePoolIsoMap::getStorageId).collect(Collectors.toList());
assertTrue("the list of the pool domains expected to be in the given statuses doesn't match the queried data", CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds));
List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses);
assertFalse("there should be connections for the tested domains to verify the correctness", result.isEmpty());
for (StorageServerConnections storageServerConnection : result) {
assertEquals("connections were loaded with incorrect storage type", StorageType.NFS, storageServerConnection.getStorageType());
}
List<StorageServerConnections> domainConnections = new LinkedList<>();
for (Guid domainId : storageDomainIds) {
domainConnections.addAll(dao.getAllForDomain(domainId));
}
assertTrue("the connections loaded by the given dao function should match the connections loaded separately", CollectionUtils.isEqualCollection(domainConnections, result));
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommand method changeStorageDomainStatusInTransaction.
protected void changeStorageDomainStatusInTransaction(final StorageDomainStatus status) {
executeInNewTransaction(() -> {
CompensationContext context = getCompensationContext();
for (StorageDomain domain : domains) {
for (StoragePoolIsoMap map : getStoragePoolIsoMap(domain)) {
context.snapshotEntityStatus(map);
updateStatus(map, status);
}
}
getCompensationContext().stateChanged();
return null;
});
}
Aggregations