Search in sources :

Example 76 with StorageProvider

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());
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 77 with StorageProvider

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());
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 78 with StorageProvider

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());
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 79 with StorageProvider

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;
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 80 with StorageProvider

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;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) WBEMException(javax.wbem.WBEMException) URI(java.net.URI) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StorageProvider (com.emc.storageos.db.client.model.StorageProvider)97 URI (java.net.URI)44 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)26 ArrayList (java.util.ArrayList)24 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)23 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)19 Produces (javax.ws.rs.Produces)19 IOException (java.io.IOException)18 StringSet (com.emc.storageos.db.client.model.StringSet)17 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)15 Path (javax.ws.rs.Path)15 Consumes (javax.ws.rs.Consumes)11 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)10 MapStorageProvider (com.emc.storageos.api.mapper.functions.MapStorageProvider)8 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)8 GET (javax.ws.rs.GET)8 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)7 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)7 AsyncTask (com.emc.storageos.volumecontroller.AsyncTask)7 BlockController (com.emc.storageos.volumecontroller.BlockController)7