Search in sources :

Example 11 with RemoteDirectorGroup

use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.

the class ProtocolEndPointToPortProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        CIMObjectPath protocolEndPointPath = getObjectPathfromCIMArgument(args);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
        String protocolEndPointId = protocolEndPointPath.getKey(Constants.NAME).getValue().toString();
        _log.info("Protocol End Point ID :" + protocolEndPointId);
        @SuppressWarnings("unchecked") Map<String, URI> volumeToRAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
        URI remoteRAGroupUri = volumeToRAGroupMap.get(protocolEndPointId);
        _log.info("Remote RA Group URI :" + remoteRAGroupUri);
        String sourceSystemSerialId = keyMap.get(Constants._serialID).toString();
        _log.info("Source Serial ID :" + sourceSystemSerialId);
        RemoteDirectorGroup remoteGroup = _dbClient.queryObject(RemoteDirectorGroup.class, remoteRAGroupUri);
        if (remoteGroup == null) {
            _log.info("RA Group Not Found {}", remoteRAGroupUri);
        }
        while (it.hasNext()) {
            CIMInstance portInstance = it.next();
            StoragePort port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
            if (null == port) {
                _log.info("RA Group Port Not Found {}", portInstance.getObjectPath());
                continue;
            }
            if (portInstance.getObjectPath().toString().contains(sourceSystemSerialId)) {
                remoteGroup.setSourcePort(port.getId());
                _log.info("Source Port added :" + portInstance.getObjectPath());
            } else {
                remoteGroup.setRemotePort(port.getId());
                _log.info("Remote Port added :" + portInstance.getObjectPath());
            }
            _dbClient.persistObject(remoteGroup);
        }
    } catch (Exception e) {
        _log.error("Discovering Ports for RA Groups failed", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) StoragePort(com.emc.storageos.db.client.model.StoragePort) AccessProfile(com.emc.storageos.plugins.AccessProfile) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 12 with RemoteDirectorGroup

use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.

the class RemoteConnectivityCollectionProcessor method createRAGroup.

private RemoteDirectorGroup createRAGroup(CIMInstance instance, RemoteDirectorGroup raGroup, StorageSystem system) {
    boolean newRAGroup = false;
    if (null == raGroup) {
        newRAGroup = true;
        raGroup = new RemoteDirectorGroup();
        raGroup.setId(URIUtil.createId(RemoteDirectorGroup.class));
        raGroup.setNativeGuid(NativeGUIDGenerator.generateRAGroupNativeGuid(instance));
        raGroup.setSourceGroupId(getSourceGroupId(system, instance));
        raGroup.setRemoteGroupId(getRemoteGroupId(system, instance));
    }
    // moved outside, as during 1st time discovery, if the remote system was not detected,
    // we could end up in not updating this field during re-discovery, even though the remote system had been detected in ViPR later.
    raGroup.setSourceStorageSystemUri(system.getId());
    raGroup.setRemoteStorageSystemUri(getRemoteConnectedSystemURI(system, instance));
    raGroup.setLabel(getCIMPropertyValue(instance, ELEMENT_NAME));
    raGroup.setActive(Boolean.parseBoolean(getCIMPropertyValue(instance, ACTIVE)));
    raGroup.setConnectivityStatus(ConnectivityStatus.getConnectivityStatus(getCIMPropertyValue(instance, CONNECTIVITY_STATUS)));
    if (newRAGroup) {
        newlyAddedGroups.add(raGroup);
    } else {
        modifiedGroups.add(raGroup);
    }
    return raGroup;
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup)

Example 13 with RemoteDirectorGroup

use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.

the class RemoteConnectivityCollectionProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    StorageSystem device = null;
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        device = getStorageSystem(_dbClient, profile.getSystemId());
        @SuppressWarnings("unchecked") Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
        Set<String> remoteConnectedStorageSystems = new HashSet<String>();
        boolean srdfSupported = false;
        while (iterator.hasNext()) {
            srdfSupported = true;
            CIMInstance instance = iterator.next();
            RemoteDirectorGroup remoteRAGroup = checkRAGroupExistsInDB(_dbClient, instance);
            remoteRAGroup = createRAGroup(instance, remoteRAGroup, device);
            raGroupIds.add(remoteRAGroup.getNativeGuid());
            addRemoteConnectedStorageSystems(instance, device, remoteConnectedStorageSystems);
            addPath(keyMap, operation.getResult(), instance.getObjectPath());
        }
        updateSupportedCopyModes(srdfSupported, device);
        updateRemoteConnectedStorageSystems(device, remoteConnectedStorageSystems);
        _dbClient.persistObject(device);
        if (!newlyAddedGroups.isEmpty()) {
            _dbClient.createObject(newlyAddedGroups);
        }
        if (!modifiedGroups.isEmpty()) {
            _dbClient.persistObject(modifiedGroups);
        }
        performRAGroupsBookKeeping(raGroupIds, device.getId());
    } catch (Exception e) {
        _log.error("Finding out Active RA Groups Failed.SRDF will not be supported on this Array {} ", device.getNativeGuid(), e);
    } finally {
        raGroupIds = null;
        newlyAddedGroups = null;
        modifiedGroups = null;
    }
}
Also used : Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) HashSet(java.util.HashSet)

Example 14 with RemoteDirectorGroup

use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.

the class RemoteConnectivityCollectionProcessor method performRAGroupsBookKeeping.

/**
 * if the RAGroup had been deleted from the Array, the rediscovery cycle should set the RAGroup to inactive.
 *
 * @param policyNames
 * @param storageSystemURI
 * @throws IOException
 */
private void performRAGroupsBookKeeping(Set<String> raGroupIds, URI storageSystemURI) throws IOException {
    @SuppressWarnings("deprecation") List<URI> raGroupsInDB = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceRemoteGroupsConstraint(storageSystemURI));
    for (URI raGroupUri : raGroupsInDB) {
        RemoteDirectorGroup raGroup = _dbClient.queryObject(RemoteDirectorGroup.class, raGroupUri);
        if (null == raGroup || raGroup.getInactive()) {
            continue;
        }
        if (!raGroupIds.contains(raGroup.getNativeGuid())) {
            _log.info("RA Group set to inactive", raGroup);
            raGroup.setSourceStorageSystemUri(NullColumnValueGetter.getNullURI());
            raGroup.setInactive(true);
            _dbClient.updateAndReindexObject(raGroup);
        }
    }
}
Also used : RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) URI(java.net.URI)

Example 15 with RemoteDirectorGroup

use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.

the class VolumeToSynchronizedRefProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        CIMObjectPath volumePath = getObjectPathfromCIMArgument(args);
        String volumeNativeGuid = getVolumeNativeGuid(volumePath);
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") Map<String, URI> volumeToRAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
        URI remoteRAGroupUri = volumeToRAGroupMap.get(volumeNativeGuid);
        _log.debug("Remote RA Group URI {}", remoteRAGroupUri);
        RemoteDirectorGroup remoteGroup = _dbClient.queryObject(RemoteDirectorGroup.class, remoteRAGroupUri);
        if (null == remoteGroup) {
            _log.info("Remote Group not found {}", remoteRAGroupUri);
            return;
        }
        String copyMode = null;
        int numberOfTargets = 0;
        if (it != null) {
            while (it.hasNext()) {
                CIMInstance storageSynchronized = it.next();
                CIMObjectPath storageSynchronizedPath = storageSynchronized.getObjectPath();
                CIMObjectPath sourcePath = (CIMObjectPath) storageSynchronizedPath.getKey(Constants._SystemElement).getValue();
                CIMObjectPath destPath = (CIMObjectPath) storageSynchronizedPath.getKey(Constants._SyncedElement).getValue();
                String sourceNativeGuid = createKeyfromPath(sourcePath);
                String targetNativeGuid = createKeyfromPath(destPath);
                _log.info("Source : {} , target : {}", sourceNativeGuid, targetNativeGuid);
                if (!findVolumesArefromSameArray(sourceNativeGuid, targetNativeGuid)) {
                    numberOfTargets++;
                    copyMode = storageSynchronized.getPropertyValue(MODE).toString();
                    _log.info("RDF Group {} detected Copy Mode {}", remoteGroup.getNativeGuid(), copyMode);
                }
            }
        }
        if (numberOfTargets > 1) {
            _log.info("RA Group {} is associated with Cascaded SRDF configuration, hence copyMode will not be updated.", remoteGroup.getNativeGuid());
            remoteGroup.setSupported(false);
        } else {
            // set copy Mode on Remote Group.
            // get Volume-->RA Group Mapping
            // if Copy Mode is already set on ViPr remoteGroup in DB, then don't change it.
            remoteGroup.setSupported(true);
            if (updateSupportedCopyMode(remoteGroup.getSupportedCopyMode())) {
                // in general, this property value can't be null, but in customer case we are seeing this, hence added this check
                if (null == copyMode) {
                    remoteGroup.setSupportedCopyMode(SupportedCopyModes.UNKNOWN.toString());
                } else {
                    remoteGroup.setSupportedCopyMode(SupportedCopyModes.getCopyMode(copyMode));
                }
            }
            _log.debug("Remote Group Copy Mode: {}", remoteGroup.getSupportedCopyMode());
        }
        _dbClient.persistObject(remoteGroup);
    } catch (Exception e) {
        _log.error("Copy Mode Discovery failed for remote Groups ", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) URI(java.net.URI) Map(java.util.Map) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

RemoteDirectorGroup (com.emc.storageos.db.client.model.RemoteDirectorGroup)53 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)30 URI (java.net.URI)30 Volume (com.emc.storageos.db.client.model.Volume)23 StringSet (com.emc.storageos.db.client.model.StringSet)16 ArrayList (java.util.ArrayList)15 CIMObjectPath (javax.cim.CIMObjectPath)13 NamedURI (com.emc.storageos.db.client.model.NamedURI)12 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)11 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)10 CIMInstance (javax.cim.CIMInstance)9 FCTN_STRING_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI)8 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)6 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)6 Workflow (com.emc.storageos.workflow.Workflow)6 Method (com.emc.storageos.workflow.Workflow.Method)6 CIMArgument (javax.cim.CIMArgument)6 WBEMException (javax.wbem.WBEMException)6 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)5