Search in sources :

Example 1 with HOST_STATUS

use of com.emc.storageos.xiv.api.XIVRestClient.HOST_STATUS in project coprhd-controller by CoprHD.

the class XIVRestOperationsHelper method isClusteredHostOnArray.

/**
 * Validates if the given Host name is identified as Clustered host with respect to XIV
 *
 * @param storage
 *            XIV storage system
 * @param hostName
 *            Host name to ve validated
 * @return true if the host is part of Cluster. Else false.
 */
private boolean isClusteredHostOnArray(StorageSystem storage, String hostName) {
    boolean isClusteredHost = false;
    XIVRestClient restExportOpr = getRestClient(storage);
    if (null != restExportOpr && null != hostName) {
        HOST_STATUS hostStatus = null;
        try {
            hostStatus = restExportOpr.getHostStatus(storage.getSmisProviderIP(), hostName);
        } catch (Exception e) {
            _log.error("Unable to validate host {} information on array : {} ", hostName, storage.getLabel(), e);
        }
        if (null != hostStatus) {
            if (HOST_STATUS.HOST_NOT_PRESENT.equals(hostStatus)) {
                _log.info("Host {} not present on Array {}. Creating a new instance!", hostName, storage.getLabel());
                isClusteredHost = true;
            } else if (HOST_STATUS.CLUSTER_HOST.equals(hostStatus)) {
                _log.info("Identified Host {} as a Clustered Host on Array {}.", hostName, storage.getLabel());
                isClusteredHost = true;
            } else if (HOST_STATUS.STANDALONE_HOST.equals(hostStatus)) {
                _log.info("Host {} identified as a Standalone host on Array {}. Using SMIS for provisioning!", hostName, storage.getLabel());
                isClusteredHost = false;
            }
        }
    }
    return isClusteredHost;
}
Also used : HOST_STATUS(com.emc.storageos.xiv.api.XIVRestClient.HOST_STATUS) XIVRestClient(com.emc.storageos.xiv.api.XIVRestClient) XIVRestException(com.emc.storageos.xiv.api.XIVRestException)

Aggregations

XIVRestClient (com.emc.storageos.xiv.api.XIVRestClient)1 HOST_STATUS (com.emc.storageos.xiv.api.XIVRestClient.HOST_STATUS)1 XIVRestException (com.emc.storageos.xiv.api.XIVRestException)1