Search in sources :

Example 1 with ConfigFile

use of com.emc.storageos.hds.model.ConfigFile in project coprhd-controller by CoprHD.

the class HDSApiProtectionManager method getReplicationRelatedObjectIds.

/**
 * Return's replicationGroup's objectID and replicationInfo's objectID for the given P-VOl and S-VOL
 *
 * @param primaryVolumeNativeId
 * @param secondaryVolumeNativeId
 * @return {@link Map} replicationGroup's objectID and replicationInfo's objectID
 * @throws Exception
 */
public Map<String, String> getReplicationRelatedObjectIds(String primaryVolumeNativeId, String secondaryVolumeNativeId) throws Exception {
    Map<String, String> objectIds = new HashMap<>();
    log.info("primaryVolumeNativeId :{}", primaryVolumeNativeId);
    log.info("secondaryVolumeNativeId :{}", secondaryVolumeNativeId);
    List<HDSHost> hostList = getHDSHostList();
    if (hostList != null) {
        for (HDSHost hdsHost : hostList) {
            log.info("HDSHost :{}", hdsHost.toXMLString());
            if (hdsHost != null && hdsHost.getConfigFileList() != null && !hdsHost.getConfigFileList().isEmpty()) {
                for (ConfigFile configFile : hdsHost.getConfigFileList()) {
                    if (configFile != null) {
                        ReplicationGroup replicationGroup = configFile.getReplicationGroup();
                        if (replicationGroup != null && replicationGroup.getReplicationInfoList() != null) {
                            log.debug("replicationGroup :{}", replicationGroup.toXMLString());
                            List<ReplicationInfo> replicationInfoList = replicationGroup.getReplicationInfoList();
                            if (replicationInfoList != null) {
                                for (ReplicationInfo replicationInfo : replicationInfoList) {
                                    log.debug("replicationInfo :{}", replicationInfo.toXMLString());
                                    if (primaryVolumeNativeId.equalsIgnoreCase(replicationInfo.getPvolDevNum()) && secondaryVolumeNativeId.equalsIgnoreCase(replicationInfo.getSvolDevNum())) {
                                        objectIds.put(HDSConstants.REPLICATION_INFO_OBJ_ID, replicationInfo.getObjectID());
                                        objectIds.put(HDSConstants.REPLICATION_GROUP_OBJ_ID, replicationGroup.getObjectID());
                                        log.info("objectIds :{}", objectIds);
                                        return objectIds;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    log.error("Unable to get replication information from pair management server");
    return objectIds;
}
Also used : HDSHost(com.emc.storageos.hds.model.HDSHost) HashMap(java.util.HashMap) ConfigFile(com.emc.storageos.hds.model.ConfigFile) ReplicationInfo(com.emc.storageos.hds.model.ReplicationInfo) ReplicationGroup(com.emc.storageos.hds.model.ReplicationGroup)

Example 2 with ConfigFile

use of com.emc.storageos.hds.model.ConfigFile in project coprhd-controller by CoprHD.

the class HDSApiProtectionManager method getReplicationInfoFromSystem.

public Pair<ReplicationInfo, String> getReplicationInfoFromSystem(String sourceNativeId, String targetNativeId) throws Exception {
    log.info("sourceNativeId :{}", sourceNativeId);
    log.info("targetNativeId :{}", targetNativeId);
    List<HDSHost> hostList = getHDSHostList();
    if (hostList != null) {
        for (HDSHost hdsHost : hostList) {
            log.info("HDSHost :{}", hdsHost.toXMLString());
            if (hdsHost != null && hdsHost.getConfigFileList() != null && !hdsHost.getConfigFileList().isEmpty()) {
                for (ConfigFile configFile : hdsHost.getConfigFileList()) {
                    if (configFile != null) {
                        ReplicationGroup replicationGroup = configFile.getReplicationGroup();
                        if (replicationGroup != null && replicationGroup.getReplicationInfoList() != null) {
                            log.info("replicationGroup :{}", replicationGroup.toXMLString());
                            List<ReplicationInfo> replicationInfoList = replicationGroup.getReplicationInfoList();
                            if (replicationInfoList != null) {
                                for (ReplicationInfo replicationInfo : replicationInfoList) {
                                    log.debug("replicationInfo :{}", replicationInfo.toXMLString());
                                    if (sourceNativeId.equals(replicationInfo.getPvolDevNum()) && targetNativeId.equals(replicationInfo.getSvolDevNum())) {
                                        log.info("Found replicationInfo object from system:{}", replicationInfo.toXMLString());
                                        log.info("Host Object Id :{}", hdsHost.getObjectID());
                                        return (new Pair<ReplicationInfo, String>(replicationInfo, hdsHost.getObjectID()));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // If we are here there is no matching replication info available on pair management server.
    log.error("Unable to find replication info details from device manager for the pvol {} svol {}", sourceNativeId, targetNativeId);
    return null;
}
Also used : HDSHost(com.emc.storageos.hds.model.HDSHost) ConfigFile(com.emc.storageos.hds.model.ConfigFile) ReplicationInfo(com.emc.storageos.hds.model.ReplicationInfo) ReplicationGroup(com.emc.storageos.hds.model.ReplicationGroup)

Example 3 with ConfigFile

use of com.emc.storageos.hds.model.ConfigFile in project coprhd-controller by CoprHD.

the class HDSApiProtectionManager method getReplicationGroupObjectId.

/**
 * Returns ViPR-Replication-Group objectID collected from Device manager to create ShadowImage pair on
 * Hitachi StorageSystem.
 *
 * @return replicationGroup's objectID
 * @throws Exception
 */
public String getReplicationGroupObjectId() throws Exception {
    List<HDSHost> hostList = getHDSHostList();
    String replicationGroupObjectId = null;
    HDSHost pairMgmtServer = null;
    if (hostList != null) {
        outerloop: for (HDSHost hdsHost : hostList) {
            log.info("HDSHost :{}", hdsHost.toXMLString());
            if (hdsHost != null && hdsHost.getConfigFileList() != null && !hdsHost.getConfigFileList().isEmpty()) {
                for (ConfigFile configFile : hdsHost.getConfigFileList()) {
                    if (configFile != null) {
                        ReplicationGroup replicationGroup = configFile.getReplicationGroup();
                        if (replicationGroup != null && HDSConstants.VIPR_REPLICATION_GROUP_NAME.equalsIgnoreCase(replicationGroup.getGroupName())) {
                            pairMgmtServer = hdsHost;
                            log.info("Pair management server {} found", pairMgmtServer.getName());
                            replicationGroupObjectId = replicationGroup.getObjectID();
                            log.info("ViPR Replication Group {} found", replicationGroup.toXMLString());
                            break outerloop;
                        }
                    }
                }
            }
        }
    }
    return replicationGroupObjectId;
}
Also used : HDSHost(com.emc.storageos.hds.model.HDSHost) ConfigFile(com.emc.storageos.hds.model.ConfigFile) ReplicationGroup(com.emc.storageos.hds.model.ReplicationGroup)

Aggregations

ConfigFile (com.emc.storageos.hds.model.ConfigFile)3 HDSHost (com.emc.storageos.hds.model.HDSHost)3 ReplicationGroup (com.emc.storageos.hds.model.ReplicationGroup)3 ReplicationInfo (com.emc.storageos.hds.model.ReplicationInfo)2 HashMap (java.util.HashMap)1