use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SmisStorageDevice method checkIfProviderSupportsAliasOperations.
/**
* This method return true if the SMI-S provider supports initiator alias operations.
* If not, it will throw an exception
*
* @param storage
* - StorageSystem object
* @throws Exception
*/
private void checkIfProviderSupportsAliasOperations(StorageSystem storageSystem) throws Exception {
String providerVersion = null;
if (storageSystem.checkIfVmax3() && storageSystem.getUsingSmis80()) {
StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storageSystem.getActiveProviderURI());
providerVersion = storageProvider.getVersionString();
}
if (VersionChecker.verifyVersionDetailsPostTrim(SmisConstants.SMIS_PROVIDER_VERSION_8_2, providerVersion) < 0) {
String errMsg = String.format("SMI-S Provider associated with Storage System %s does not support Initiator Alias operations", storageSystem.getSerialNumber());
_log.error(errMsg);
throw DeviceControllerException.exceptions.couldNotPerformAliasOperation(errMsg);
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class DbSMISProviderToStorageProviderMigrationTest method validateStorageProviderInstances.
private void validateStorageProviderInstances(boolean isAfterMigration) {
int size = 0;
List<URI> keys = _dbClient.queryByType(StorageProvider.class, true);
Iterator<StorageProvider> iter = _dbClient.queryIterativeObjects(StorageProvider.class, keys);
while (iter.hasNext()) {
size++;
StorageProvider storageProvider = iter.next();
if (StorageProvider.InterfaceType.vplex.name().equals(storageProvider.getInterfaceType())) {
verifyVPlexStorageProvider(storageProvider);
} else {
Assert.assertEquals("Interface type should be smis", StorageProvider.InterfaceType.smis.name(), storageProvider.getInterfaceType());
StringSet storageSystems = storageProvider.getStorageSystems();
int storageSystemCount = 0;
for (String storageSystemURI : storageSystems) {
storageSystemCount++;
}
if (isAfterMigration) {
if ("smis1".equals(storageProvider.getLabel())) {
Assert.assertEquals("StorageSystems count is mismatch for " + storageProvider.getLabel(), 2, storageSystemCount);
} else if ("smis3".equals(storageProvider.getLabel()) || "smis2".equals(storageProvider.getLabel())) {
Assert.assertEquals("StorageSystems count is mismatch for " + storageProvider.getLabel(), 1, storageSystemCount);
}
}
}
}
if (isAfterMigration) {
Assert.assertEquals("StorageProvider size should be 4", 4, size);
} else {
Assert.assertEquals("StorageProvider size should be 0", 0, size);
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class TestDataCollectionJobConsumer method triggerScanning.
private void triggerScanning(DataCollectionScanJob job) throws Exception {
_logger.info("Started scanning SMIS Providers : triggerScanning()");
List<URI> allProviderURI = _dbClient.queryByType(StorageProvider.class, true);
List<StorageProvider> allProviders = _dbClient.queryObject(StorageProvider.class, allProviderURI);
Map<String, StorageSystemViewObject> storageSystemsCache = Collections.synchronizedMap(new HashMap<String, StorageSystemViewObject>());
boolean exceptionIntercepted = false;
try {
List<URI> cacheProviders = new ArrayList<URI>();
// since dbQuery does not return a normal list required by
// bookkeeping, we need to rebuild it.
allProviderURI = new ArrayList<URI>();
// at the same time.
for (StorageProvider provider : allProviders) {
allProviderURI.add(provider.getId());
ScanTaskCompleter scanCompleter = job.findProviderTaskCompleter(provider.getId());
if (scanCompleter == null) {
String taskId = UUID.randomUUID().toString();
scanCompleter = new ScanTaskCompleter(StorageProvider.class, provider.getId(), taskId);
job.addCompleter(scanCompleter);
}
try {
provider.setLastScanStatusMessage("");
_dbClient.persistObject(provider);
_logger.info("provider.getInterfaceType():{}", provider.getInterfaceType());
performScan(provider.getId(), scanCompleter, storageSystemsCache);
cacheProviders.add(provider.getId());
} catch (Exception ex) {
_logger.error("Scan failed for {}--->", provider.getId(), ex);
}
_dbClient.persistObject(provider);
}
// Perform BooKKeeping
// TODO: we need to access the status of job completer.
// for now we assume that this operation can not fail.
_util.performBookKeeping(storageSystemsCache, allProviderURI);
for (URI provider : cacheProviders) {
job.findProviderTaskCompleter(provider).ready(_dbClient);
_logger.info("Scan complete successfully for " + provider);
}
} catch (final Exception ex) {
_logger.error("Scan failed for {} ", ex.getMessage());
job.error(_dbClient, DeviceControllerErrors.dataCollectionErrors.scanFailed(ex.getLocalizedMessage(), ex));
exceptionIntercepted = true;
throw ex;
} finally {
try {
if (!exceptionIntercepted && job.isSchedulerJob()) {
// Manually trigger discoveries, if any new Arrays detected
triggerDiscoveryNew(storageSystemsCache, DataCollectionJob.JobOrigin.SCHEDULER);
}
} catch (Exception ex) {
_logger.error(ex.getMessage(), ex);
}
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SmisCommandHelper method checkIfProviderSupportsCompressionOperations.
/**
* This method return true if the SMI-S provider supports compression operations.
* If not, it will throw an exception
*
* @param storage - StorageSystem object
* @param boolean to report if SMI-S provider supports compression
*/
public Boolean checkIfProviderSupportsCompressionOperations(StorageSystem storageSystem) {
if (storageSystem.checkIfVmax3() && storageSystem.getUsingSmis80()) {
try {
StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storageSystem.getActiveProviderURI());
String providerVersion = storageProvider.getVersionString();
if (VersionChecker.verifyVersionDetailsPostTrim(SMIS_PROVIDER_VERSION_8_3, providerVersion) < 0) {
String errMsg = String.format("SMI-S Provider associated with Storage System %s does not support compression operations", storageSystem.getSerialNumber());
_log.error(errMsg);
return false;
}
} catch (Exception e) {
_log.error("Exception get provider version for the storage system {} {}.", storageSystem.getLabel(), storageSystem.getId());
return false;
}
}
return true;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SmisCommandHelper method convertStandAloneStorageGroupToCascaded.
/**
* Converts a stand alone storage group in the masking view to cascaded.
* This method is supported from SMI-S v8.4
*
* @param storage the storage system
* @param storageGroupPath the storage group path
* @param storageGroupName the storage group name
* @throws WBEMException the WBEM exception
*/
public void convertStandAloneStorageGroupToCascaded(StorageSystem storage, CIMObjectPath storageGroupPath, String storageGroupName) throws WBEMException {
// This method is supported from SMI-S v8.4
StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storage.getActiveProviderURI());
String providerVersion = storageProvider.getVersionString();
if (VersionChecker.verifyVersionDetailsPostTrim(SMIS_PROVIDER_VERSION_8_4, providerVersion) >= 0) {
String ChildStorageGroupName = String.format("%s_ChildSG", storageGroupName);
CIMArgument[] inArgs = getConvertStandAloneStorageGroupToCascadedInputArguments(storage, storageGroupPath, ChildStorageGroupName);
CIMArgument[] outArgs = new CIMArgument[5];
invokeMethod(storage, _cimPath.getControllerConfigSvcPath(storage), "EMCConvertMaskingGroup", inArgs, outArgs);
} else {
_log.info("SMI-S Provider version {} does not support converting" + " Stand alone storage group to Cascaded.", providerVersion);
}
}
Aggregations