use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DataCollectionJobUtil method getSMISProvidersWithUpdatedSystems.
/**
* Update all the SMISProviders with their actively managed storage systems information.
*
* @param providersToUpdate : dataStructure holds the provider => list of managed systems.
*/
private List<StorageProvider> getSMISProvidersWithUpdatedSystems(Map<URI, List<String>> providersToUpdate) {
List<StorageProvider> providerList = new ArrayList<StorageProvider>();
if (!providersToUpdate.isEmpty()) {
Iterator<URI> providerIdKeyItr = providersToUpdate.keySet().iterator();
while (providerIdKeyItr.hasNext()) {
URI providerIdKey = null;
try {
providerIdKey = providerIdKeyItr.next();
List<String> storageSystemList = providersToUpdate.get(providerIdKey);
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, providerIdKey);
if (null != provider.getStorageSystems()) {
provider.getStorageSystems().clear();
provider.getStorageSystems().addAll(storageSystemList);
} else {
StringSet storageSystems = new StringSet();
storageSystems.addAll(storageSystemList);
provider.setStorageSystems(storageSystems);
}
providerList.add(provider);
} catch (DatabaseException ioEx) {
_logger.error("IOException occurred while updating storageSystems for provider {}", providerIdKey);
}
}
}
return providerList;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DataCollectionJobUtil method populateUnityAccessProfileForSystem.
/**
* Populate access profile for storage system.
* If it has active provider, it will populate the access profile from provider info,
* otherwise, it will populate the access profile from the storage system.
* @param accessProfile
* @param storageDevice
*/
private void populateUnityAccessProfileForSystem(AccessProfile accessProfile, StorageSystem storageDevice) {
URI providerUri = storageDevice.getActiveProviderURI();
if (!NullColumnValueGetter.isNullURI(providerUri)) {
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, providerUri);
accessProfile.setSystemType(storageDevice.getSystemType());
accessProfile.setIpAddress(provider.getIPAddress());
accessProfile.setUserName(provider.getUserName());
accessProfile.setPassword(provider.getPassword());
accessProfile.setserialID(storageDevice.getSerialNumber());
accessProfile.setPortNumber(provider.getPortNumber());
accessProfile.setLastSampleTime(0L);
} else {
accessProfile.setSystemType(storageDevice.getSystemType());
accessProfile.setIpAddress(storageDevice.getIpAddress());
accessProfile.setUserName(storageDevice.getUsername());
accessProfile.setPassword(storageDevice.getPassword());
accessProfile.setserialID(storageDevice.getSerialNumber());
accessProfile.setPortNumber(storageDevice.getPortNumber());
accessProfile.setLastSampleTime(0L);
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DataCollectionJobUtil method populateHDSAccessProfile.
/**
* Get the AccessProfile details based on the profile Name.
* For Hitachi, metering is handled thru SMI-S.
* Hitachi supports two types of providers
* 1. Embedded SMI-S running SVP -> supports only HUS VM, VSP, VSP G1000.
* 2. HiCommand Suite Provider -> supports only AMS series
*
* @TODO need to look at HUS series model.
* @TODO User should create a new user using storage navigator to do metering.
*
* Prerequisites for Embedded SMI-S Provider.
* User should enable certificate to activate SMI-S and enable performance monitor using storage navigator.
*
* @TODO should we document above prerequisites?
*
* @param accessProfile
* @param storageDevice
* @param nameSpace
*/
private void populateHDSAccessProfile(AccessProfile accessProfile, StorageSystem storageDevice, String nameSpace) {
accessProfile.setSystemType(storageDevice.getSystemType());
accessProfile.setserialID(storageDevice.getSerialNumber());
accessProfile.setLastSampleTime(0L);
if (null != nameSpace) {
accessProfile.setnamespace(nameSpace);
}
if (accessProfile.getProfileName().equalsIgnoreCase(ControllerServiceImpl.METERING)) {
accessProfile.setIpAddress(getHDSSMISIPAddressBasedOnModel(storageDevice));
accessProfile.setInteropNamespace(HDSConstants.HITACHI_NAMESPACE);
// Currently API is not supporting hence hardcoded to make them
// work.
// @TODO remove once API is fixed.
accessProfile.setPortNumber(getHDSSMISPortBasedOnModel(storageDevice));
accessProfile.setSslEnable(Boolean.TRUE.toString());
accessProfile.setUserName(storageDevice.getSmisUserName());
accessProfile.setPassword(storageDevice.getSmisPassword());
} else {
StorageProvider activeProvider = getActiveProviderForStorageSystem(storageDevice, accessProfile);
// For discovery use the active provider credentials directly.
accessProfile.setIpAddress(activeProvider.getIPAddress());
accessProfile.setPortNumber(activeProvider.getPortNumber());
accessProfile.setUserName(activeProvider.getUserName());
accessProfile.setPassword(activeProvider.getPassword());
accessProfile.setSslEnable(String.valueOf(activeProvider.getUseSSL()));
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DataCollectionJobUtil method injectDiscoveryProfile.
/**
* inject Details needed for Discovery
*
* @param accessProfile
* @param system
* @throws IOException
*/
private void injectDiscoveryProfile(AccessProfile accessProfile, StorageSystem system) throws DatabaseException, DeviceControllerException {
StorageProvider provider = getActiveProviderForStorageSystem(system, accessProfile);
populateSMISAccessProfile(accessProfile, provider);
accessProfile.setSystemId(system.getId());
accessProfile.setSystemClazz(system.getClass());
accessProfile.setserialID(system.getSerialNumber());
accessProfile.setSystemType(system.getSystemType());
String namespace = Constants.EMC_NAMESPACE;
if (Type.ibmxiv.name().equals(system.getSystemType())) {
namespace = Constants.IBM_NAMESPACE;
}
// To-Do: get Namespace field in SMISProvider
accessProfile.setInteropNamespace(namespace);
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DataCollectionJobUtil method getActiveProviderForStorageSystem.
/**
* Return the active StorageProvider for a given storage system.
*
* @param system
* @param accessProfile
* @return
*/
private StorageProvider getActiveProviderForStorageSystem(StorageSystem system, AccessProfile accessProfile) {
URI activeProviderURI = system.getActiveProviderURI();
if (NullColumnValueGetter.isNullURI(activeProviderURI)) {
// Set the error message only when the job type is discovery.
if (ControllerServiceImpl.isDiscoveryJobTypeSupported(accessProfile.getProfileName())) {
system.setLastDiscoveryStatusMessage("Discovery failed " + "since it does not have an active Provider");
_dbClient.persistObject(system);
}
throw DeviceControllerException.exceptions.cannotFindActiveProviderForStorageSystem();
}
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, activeProviderURI);
if (provider == null) {
if (ControllerServiceImpl.DISCOVERY.equalsIgnoreCase(accessProfile.getProfileName())) {
system.setLastDiscoveryStatusMessage("Discovery failed " + "since it does not have a valid active Provider");
_dbClient.persistObject(system);
}
throw DeviceControllerException.exceptions.cannotFindValidActiveProviderForStorageSystem();
}
return provider;
}
Aggregations