Search in sources :

Example 1 with RecoverPointConnection

use of com.emc.storageos.recoverpoint.utils.RecoverPointConnection in project coprhd-controller by CoprHD.

the class RecoverPointClient method reconnect.

/**
 * Method to refresh the connection of this RPClient to the Recover Point System
 * via FAPI. Used just in case the connection has become stale.
 */
public void reconnect() {
    logger.info(String.format("Attempt to refresh connection to RecoverPoint at %s", this.getEndpoint()));
    try {
        // Remove existing FAPI reference
        this.setFunctionalAPI(null);
        // Create the connection
        FunctionalAPIImpl impl = new RecoverPointConnection().connect(this.getEndpoint(), this.getUsername(), this.getPassword());
        // Add the new FAPI instance to the RecoverPointClient
        this.setFunctionalAPI(impl);
        // We just connected but to be safe, lets do a quick ping to confirm that
        // we can reach the new RecoverPoint client
        this.ping();
        logger.info("Connection refreshed.");
    } catch (Exception e) {
        logger.error("Received " + e.toString() + ". Failed to refresh RP connection: " + this.getEndpoint().toString() + ", Cause: " + RecoverPointClient.getCause(e));
        throw RecoverPointException.exceptions.failedToPingMgmtIP(this.getEndpoint().toString(), RecoverPointClient.getCause(e));
    }
}
Also used : RecoverPointConnection(com.emc.storageos.recoverpoint.utils.RecoverPointConnection) FunctionalAPIImpl(com.emc.fapiclient.ws.FunctionalAPIImpl) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Aggregations

FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIImpl (com.emc.fapiclient.ws.FunctionalAPIImpl)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1 RecoverPointConnection (com.emc.storageos.recoverpoint.utils.RecoverPointConnection)1