use of org.ovirt.engine.core.bll.provider.storage.OpenStackVolumeProviderProxy in project ovirt-engine by oVirt.
the class CinderDisksValidator method initializeVolumeProviderProxyMap.
private Map<Guid, OpenStackVolumeProviderProxy> initializeVolumeProviderProxyMap() {
if (diskProxyMap == null) {
diskProxyMap = new HashMap<>();
for (CinderDisk cinderDisk : cinderDisks) {
OpenStackVolumeProviderProxy volumeProviderProxy = getVolumeProviderProxy(cinderDisk);
diskProxyMap.put(cinderDisk.getId(), volumeProviderProxy);
}
}
return diskProxyMap;
}
use of org.ovirt.engine.core.bll.provider.storage.OpenStackVolumeProviderProxy in project ovirt-engine by oVirt.
the class CINDERStorageHelper method activateCinderDomain.
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) {
OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, providerProxyFactory);
if (proxy == null) {
log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId);
return;
}
try {
proxy.testConnection();
updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active);
} catch (EngineException e) {
AuditLogable loggable = new AuditLogableImpl();
loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage());
auditLogDirector.log(loggable, AuditLogType.CINDER_PROVIDER_ERROR);
throw e;
}
}
use of org.ovirt.engine.core.bll.provider.storage.OpenStackVolumeProviderProxy in project ovirt-engine by oVirt.
the class CinderDisksValidator method validateCinderVolumeTypesExist.
/**
* Validates that the disk's volume type exists in Cinder
* (note that this method validates only against a single disk).
*/
public ValidationResult validateCinderVolumeTypesExist() {
return validate(() -> {
final CinderDisk disk = cinderDisks.iterator().next();
OpenStackVolumeProviderProxy proxy = diskProxyMap.get(disk.getId());
List<CinderVolumeType> volumeTypes = proxy.getVolumeTypes();
boolean volumeTypeExists = volumeTypes.stream().anyMatch(v -> v.getName().equals(disk.getCinderVolumeType()));
if (!volumeTypeExists) {
return new ValidationResult(EngineMessage.CINDER_VOLUME_TYPE_NOT_EXISTS, String.format("$cinderVolumeType %s", disk.getCinderVolumeType()));
}
return ValidationResult.VALID;
});
}
use of org.ovirt.engine.core.bll.provider.storage.OpenStackVolumeProviderProxy in project ovirt-engine by oVirt.
the class CinderDisksValidator method getRelatedCinderDisksToStorageDomainMap.
private Map<Guid, CinderStorageRelatedDisksAndProxy> getRelatedCinderDisksToStorageDomainMap() {
if (cinderStorageToRelatedDisks == null) {
cinderStorageToRelatedDisks = new HashMap<>();
for (CinderDisk cinderDisk : cinderDisks) {
Guid storageDomainId = cinderDisk.getStorageIds().get(0);
CinderStorageRelatedDisksAndProxy cinderRelatedDisksAndProxy = cinderStorageToRelatedDisks.get(storageDomainId);
if (cinderRelatedDisksAndProxy == null) {
List<CinderDisk> cinderDisks = new ArrayList<>();
cinderDisks.add(cinderDisk);
OpenStackVolumeProviderProxy proxy = diskProxyMap.get(cinderDisk.getId());
CinderStorageRelatedDisksAndProxy newCinderRelatedDisksAndProxy = new CinderStorageRelatedDisksAndProxy(storageDomainId, cinderDisks, proxy);
cinderStorageToRelatedDisks.put(storageDomainId, newCinderRelatedDisksAndProxy);
} else {
cinderRelatedDisksAndProxy.getCinderDisks().add(cinderDisk);
}
}
}
return cinderStorageToRelatedDisks;
}
Aggregations