Search in sources :

Example 26 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class MdsNetworkSystemDevice method removeZones.

@Override
public BiosCommandResult removeZones(NetworkSystem network, List<Zone> zones, String fabricId, String fabricWwn, boolean activateZones) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    MDSDialog dialog = null;
    Map<String, String> removedZoneNames = new HashMap<String, String>();
    try {
        dialog = setUpDialog(network);
        List<IvrZone> removingIvrZones = new ArrayList<IvrZone>();
        List<Zone> removingZones = new ArrayList<Zone>();
        for (Zone zone : zones) {
            IvrZone routedZone = getRoutedZone(dialog, zone, network);
            // as normal zone
            if (routedZone != null) {
                removingIvrZones.add(routedZone);
            } else {
                removingZones.add(zone);
            }
        }
        // Throw artificial exception here to simulate FOD for MDS same as creating alias
        InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_057);
        if (!removingZones.isEmpty()) {
            Integer vsanId = checkVsanFabric(dialog, fabricId, fabricWwn);
            removedZoneNames.putAll(removeZonesStrategy(dialog, removingZones, vsanId, activateZones));
        }
        if (!removingIvrZones.isEmpty()) {
            removedZoneNames.putAll(removeIvrZonesStrategy(dialog, removingIvrZones));
        }
        _log.info("Remove VSAN zone results: " + toMessage(removedZoneNames));
        result = getBiosCommandResult(removedZoneNames);
    } catch (Exception ex) {
        _log.error("Cannot remove zones: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
        throw ex;
    } finally {
        disconnect(dialog);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ArrayList(java.util.ArrayList) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 27 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class MdsNetworkSystemDevice method activateZones.

@Override
public BiosCommandResult activateZones(NetworkSystem network, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    MDSDialog dialog = null;
    try {
        dialog = setUpDialog(network);
        Integer vsanId = checkVsanFabric(dialog, fabricId, fabricWwn);
        String activatedZonesetName = activateZonesStrategy(dialog, vsanId);
        String msg = "";
        if (activatedZonesetName == null) {
            msg = "Vsan: " + fabricId + ": No zoneset was activated";
        } else {
            msg = "Vsan: " + fabricId + ": Successfully activated zoneset: " + activatedZonesetName;
        }
        _log.info(msg);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (NetworkDeviceControllerException ex) {
        _log.error("Cannot activate zoneset: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
        throw ex;
    } finally {
        disconnect(dialog);
    }
    return result;
}
Also used : NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 28 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class MdsNetworkSystemDevice method doConnect.

@Override
public BiosCommandResult doConnect(NetworkSystem network) {
    BiosCommandResult result = null;
    MDSDialog dialog = null;
    try {
        dialog = setUpDialog(network);
        String[] versInfo = dialog.showVersion();
        result = BiosCommandResult.createSuccessfulResult();
        if (versInfo[0].startsWith("MDS") == false && versInfo[0].startsWith("Nexus") == false) {
            ServiceError svcError = NetworkDeviceControllerException.errors.doConnectFailedNotMds(network.getLabel());
            result = BiosCommandResult.createErrorResult(svcError);
        }
    } catch (Exception ex) {
        ServiceError svcError = NetworkDeviceControllerException.errors.doConnectFailed(network.getLabel());
        result = BiosCommandResult.createErrorResult(svcError);
    } finally {
        disconnect(dialog);
    }
    _log.info("Connetwork to NetworkSystem " + (result.isCommandSuccess() ? "successful " : "failed ") + result.getMessage());
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 29 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class MdsNetworkSystemDevice method addAliases.

@Override
public BiosCommandResult addAliases(NetworkSystem network, List<ZoneWwnAlias> addingAliases, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    MDSDialog dialog = null;
    Map<String, String> addedAliasesName = new HashMap<String, String>();
    try {
        dialog = setUpDialog(network);
        if (!addingAliases.isEmpty()) {
            addedAliasesName.putAll(addAliasesStrategy(dialog, addingAliases));
        }
        String msg = "Successfully added aliases: " + addedAliasesName.toString();
        if (!hasResult(addedAliasesName, SUCCESS)) {
            msg = "Network System: " + network.getLabel() + ": No aliases were added";
        }
        _log.info(msg);
        result = getBiosCommandResult(addedAliasesName);
    } catch (Exception ex) {
        _log.error("Cannot add aliases: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
        throw ex;
    } finally {
        disconnect(dialog);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 30 with BiosCommandResult

use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.

the class MdsNetworkSystemDevice method updateAliases.

@Override
public BiosCommandResult updateAliases(NetworkSystem network, List<ZoneWwnAliasUpdate> updatingAliases, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    MDSDialog dialog = null;
    Map<String, String> updatedAliasesName = new HashMap<String, String>();
    try {
        dialog = setUpDialog(network);
        if (!updatingAliases.isEmpty()) {
            updatedAliasesName.putAll(updateAliasesStrategy(dialog, updatingAliases));
        }
        String msg = "Successfully updated aliases: " + updatedAliasesName.toString();
        if (!hasResult(updatedAliasesName, SUCCESS)) {
            msg = "Network System: " + network.getLabel() + ": No aliases were updated";
        }
        _log.info(msg);
        result = getBiosCommandResult(updatedAliasesName);
    } catch (Exception ex) {
        _log.error("Cannot updated aliases: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
        throw ex;
    } finally {
        disconnect(dialog);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Aggregations

BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)135 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)76 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)69 ControllerException (com.emc.storageos.volumecontroller.ControllerException)64 NetAppException (com.emc.storageos.netapp.NetAppException)34 ArrayList (java.util.ArrayList)34 NetworkDeviceControllerException (com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)28 NetAppCException (com.emc.storageos.netappc.NetAppCException)19 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)18 NetAppApi (com.emc.storageos.netapp.NetAppApi)18 NetAppClusterApi (com.emc.storageos.netappc.NetAppClusterApi)18 URI (java.net.URI)16 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)15 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)15 VNXFileCommApi (com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi)15 ApplicationContext (org.springframework.context.ApplicationContext)15 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)15 FileShare (com.emc.storageos.db.client.model.FileShare)14 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)14 NetworkSystem (com.emc.storageos.db.client.model.NetworkSystem)11