use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class ScanTaskCompleter method updateObjectState.
@Override
protected void updateObjectState(DbClient dbClient, DataCollectionJobStatus jobStatus) {
Class type = getType();
if (StorageProvider.class.isAssignableFrom(type)) {
try {
StorageProvider dbObject = (StorageProvider) DataObject.createInstance(type, getId());
dbObject.trackChanges();
dbObject.setScanStatus(jobStatus.toString());
dbClient.persistObject(dbObject);
} catch (InstantiationException ex) {
DatabaseException.fatals.queryFailed(ex);
} catch (IllegalAccessException ex) {
DatabaseException.fatals.queryFailed(ex);
}
} else {
throw new RuntimeException("Unsupported system Type : " + type.toString());
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class ScanTaskCompleter method setLastTime.
@Override
public final void setLastTime(DbClient dbClient, long time) {
Class type = getType();
if (StorageProvider.class.isAssignableFrom(type)) {
try {
StorageProvider dbObject = (StorageProvider) DataObject.createInstance(type, getId());
dbObject.trackChanges();
dbObject.setLastScanTime(time);
dbClient.persistObject(dbObject);
} catch (InstantiationException ex) {
DatabaseException.fatals.queryFailed(ex);
} catch (IllegalAccessException ex) {
DatabaseException.fatals.queryFailed(ex);
}
} else {
throw DeviceControllerException.exceptions.invalidSystemType(type.toString());
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class ScanTaskCompleter method setSuccessTime.
@Override
public final void setSuccessTime(DbClient dbClient, long time) {
Class type = getType();
if (StorageProvider.class.isAssignableFrom(type)) {
try {
StorageProvider dbObject = (StorageProvider) DataObject.createInstance(type, getId());
dbObject.trackChanges();
dbObject.setSuccessScanTime(time);
dbClient.persistObject(dbObject);
} catch (InstantiationException ex) {
DatabaseException.fatals.queryFailed(ex);
} catch (IllegalAccessException ex) {
DatabaseException.fatals.queryFailed(ex);
}
} else {
throw DeviceControllerException.exceptions.invalidSystemType(type.toString());
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class RemoteConnectivityCollectionProcessor method checkSupportedSRDFActiveModeProvider.
private boolean checkSupportedSRDFActiveModeProvider(StorageSystem storageSystem) {
if (storageSystem.checkIfVmax3() && storageSystem.getUsingSmis80()) {
try {
StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storageSystem.getActiveProviderURI());
String providerVersion = storageProvider.getVersionString();
return (VersionChecker.verifyVersionDetailsPostTrim(SmisConstants.SMIS_PROVIDER_VERSION_8_2, providerVersion) >= 0);
} catch (Exception e) {
_log.error("Exception get provider version for the storage system {} {}.", storageSystem.getLabel(), storageSystem.getId());
return false;
}
} else {
return false;
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class FindProviderStrategyByCG method find.
@Override
public StorageSystem find() {
// first check if active Provider has CG.
// Do not unnecessarily check on passive providers when active provider has it.
CIMObjectPath cimPath = cimPathFactory.getReplicationGroupPath(system, groupName);
if (null == cimPath) {
log.warn("Replication Group {} not found in Provider {}", groupName, system.getActiveProviderURI());
} else {
return system;
}
Set<URI> providerUris = new HashSet<URI>();
if (null != system.getProviders()) {
providerUris.addAll(Collections2.transform(system.getProviders(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
}
/**
* Check which of the passive SMI-S provider has CG available on it.
* This may be required when the active Provider for a system changes.
*
* Get all providers managing this system
* for each provider (except active provider)
* get 1 storage system which is actively managed by this provider
* (list should contain unique systems (except this.system))
* look for the group name for this system
*/
List<String> storageSystemUriStrs = new ArrayList<String>();
List<StorageSystem> passiveProviderSystems = new ArrayList<StorageSystem>();
// add source system so that we will take other system reference on passive provider
storageSystemUriStrs.add(system.getId().toString());
providerUris.remove(system.getActiveProviderURI());
if (!providerUris.isEmpty()) {
List<StorageProvider> passiveSmisProviderList = dbClient.queryObject(StorageProvider.class, providerUris);
for (StorageProvider provider : passiveSmisProviderList) {
if (null != provider.getStorageSystems()) {
for (String systemUriStr : provider.getStorageSystems()) {
if (!storageSystemUriStrs.contains(systemUriStr)) {
StorageSystem passiveProviderSystem = dbClient.queryObject(StorageSystem.class, URI.create(systemUriStr));
if (provider.getId().toString().equalsIgnoreCase(passiveProviderSystem.getActiveProviderURI().toString())) {
storageSystemUriStrs.add(systemUriStr);
passiveProviderSystems.add(passiveProviderSystem);
break;
}
}
}
}
}
}
// Each Storage System in turn refers to a Provider, we loop through each Storage System
// check whether CG is found.
StorageSystem systemWithCGFound = null;
for (StorageSystem passiveProviderSystem : passiveProviderSystems) {
cimPath = cimPathFactory.getReplicationGroupPath(passiveProviderSystem, system.getSerialNumber(), groupName);
if (null == cimPath) {
log.warn("Replication Group {} not found in Provider {}", groupName, passiveProviderSystem.getActiveProviderURI());
continue;
}
systemWithCGFound = passiveProviderSystem;
break;
}
// So, there won't be conflict if we update it here.
if (systemWithCGFound != null) {
URI providerURI = systemWithCGFound.getActiveProviderURI();
log.info("Passive provider {} with Replication Group found. Making it active for system {}", providerURI, system.getId());
StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerURI);
system.setActiveProviderURI(providerURI);
system.setSmisPassword(provider.getPassword());
system.setSmisPortNumber(provider.getPortNumber());
system.setSmisProviderIP(provider.getIPAddress());
system.setSmisUserName(provider.getUserName());
system.setSmisUseSSL(provider.getUseSSL());
dbClient.persistObject(system);
log.info("Active provider for system {} has changed to {}.", system.getId(), system.getActiveProviderURI());
// (For instance, addVolume to CG - Volume created in P2 needs to be available in P1)
try {
helper.callRefreshSystem(system, null);
} catch (WBEMException e) {
log.error("EMCRefresh against StorageSystem {} failed.", system.getNativeGuid(), e);
}
return system;
}
return null;
}
Aggregations