Search in sources :

Example 11 with BiosCommandResult

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

the class NetworkDeviceController method updateSanZones.

@Override
public void updateSanZones(URI uri, String fabricId, String fabricWwn, List<ZoneUpdate> zones, boolean activateZones, String taskId) throws ControllerException {
    NetworkSystem device = getNetworkSystemObject(uri);
    // Lock to prevent concurrent operations on the same VSAN / FABRIC.
    InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
    try {
        // Get the file device reference for the type of file device managed
        // by the controller.
        NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
        if (networkDevice == null) {
            throw NetworkDeviceControllerException.exceptions.updateSanZonesFailedNull(device.getSystemType());
        }
        BiosCommandResult result = networkDevice.updateZones(device, zones, fabricId, fabricWwn, activateZones);
        setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
        _auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.UPDATE_SAN_ZONE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
    } catch (Exception ex) {
        ServiceError serviceError = NetworkDeviceControllerException.errors.updateSanZonesFailedExc(device.getSystemType(), ex);
        _dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
    } finally {
        NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetworkSystem(com.emc.storageos.db.client.model.NetworkSystem) InterProcessLock(org.apache.curator.framework.recipes.locks.InterProcessLock) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 12 with BiosCommandResult

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

the class NetworkDeviceController method addSanZones.

@Override
public void addSanZones(URI uri, String fabricId, String fabricWwn, List<Zone> zones, boolean activateZones, String taskId) throws ControllerException {
    NetworkSystem device = getNetworkSystemObject(uri);
    // Lock to prevent concurrent operations on the same VSAN / FABRIC.
    InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
    try {
        // Get the file device reference for the type of file device managed
        // by the controller.
        NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
        if (networkDevice == null) {
            throw NetworkDeviceControllerException.exceptions.addSanZonesFailedNull(device.getSystemType());
        }
        BiosCommandResult result = networkDevice.addZones(device, zones, fabricId, fabricWwn, activateZones);
        setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
        _auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.ADD_SAN_ZONE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
    } catch (Exception ex) {
        ServiceError serviceError = NetworkDeviceControllerException.errors.addSanZonesFailedExc(device.getSystemType(), ex);
        _dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
    } finally {
        NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetworkSystem(com.emc.storageos.db.client.model.NetworkSystem) InterProcessLock(org.apache.curator.framework.recipes.locks.InterProcessLock) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 13 with BiosCommandResult

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

the class NetworkSystemDeviceImpl method getBiosCommandResult.

protected BiosCommandResult getBiosCommandResult(Map<String, String> results) {
    BiosCommandResult result = null;
    if (hasResult(results, ERROR)) {
        ServiceError serviceError = NetworkDeviceControllerException.errors.batchOperationFailed(toMessage(results));
        result = BiosCommandResult.createErrorResult(serviceError);
    } else {
        result = BiosCommandResult.createSuccessfulResult();
    }
    result.setObjectList(Collections.singletonList((Object) results));
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 14 with BiosCommandResult

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

the class BrocadeNetworkSystemDevice method activateZones.

@Override
public BiosCommandResult activateZones(NetworkSystem networkSystem, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    NetworkDeviceControllerException exception = null;
    try {
        WBEMClient client = getNetworkDeviceClient(networkSystem);
        CIMInstance zonesetIns = _smisHelper.getActiveZonesetInstance(client, fabricId, fabricWwn);
        if (zonesetIns != null) {
            CIMObjectPath shadowZonesetPath = _smisHelper.getShadowZonesetPath(client, fabricId, fabricWwn, zonesetIns);
            CIMInstance zoneServiceIns = _smisHelper.getZoneServiceInstance(client, fabricId, fabricWwn);
            boolean activate = !_smisHelper.isEmptyZoneset(client, shadowZonesetPath);
            if (_smisHelper.activateZoneSet(client, zoneServiceIns, zonesetIns.getObjectPath(), activate)) {
                _log.info("The active zoneset for fabric " + fabricId + " was " + (activate ? "re-activated" : "deactivated"));
            } else {
                _log.error("Failed to re-activate zoneset");
                exception = NetworkDeviceControllerException.exceptions.zonesetActivationFailed(fabricId, new Throwable());
            }
        } else {
            exception = NetworkDeviceControllerException.exceptions.noActiveZonesetForFabric(fabricId);
        }
        result = BiosCommandResult.createSuccessfulResult();
    } catch (Exception ex) {
        _log.error("Cannot re-activate zoneset: " + ex.getLocalizedMessage());
        exception = NetworkDeviceControllerException.exceptions.zonesetActivationFailed(fabricId, ex);
    }
    if (exception != null) {
        throw exception;
    }
    return result;
}
Also used : NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) CIMObjectPath(javax.cim.CIMObjectPath) WBEMClient(javax.wbem.client.WBEMClient) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException)

Example 15 with BiosCommandResult

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

the class BrocadeNetworkSystemDevice method removeZones.

public BiosCommandResult removeZones(NetworkSystem networkSystem, List<Zone> zones, String fabricId, String fabricWwn, boolean activateZones) throws NetworkDeviceControllerException {
    BiosCommandResult result = null;
    Map<String, String> removedZoneResults = new HashMap<String, String>();
    try {
        validateFabric(networkSystem, fabricWwn, fabricId);
        Map<NetworkLite, List<Zone>> zonesPerFabric = getAllZonesForZones(zones, true, fabricId, fabricWwn);
        for (NetworkLite network : zonesPerFabric.keySet()) {
            WBEMClient client = getNetworkDeviceClient(networkSystem);
            removedZoneResults.putAll(removeZonesStrategy(client, zonesPerFabric.get(network), network.getNativeId(), NetworkUtil.getNetworkWwn(network), activateZones));
        }
        result = getBiosCommandResult(removedZoneResults);
        _log.info("Remove zone results {}", toMessage(removedZoneResults));
    } catch (NetworkDeviceControllerException ex) {
        _log.error("Cannot remove zones: " + ex.getLocalizedMessage());
        throw ex;
    }
    return result;
}
Also used : NetworkDeviceControllerException(com.emc.storageos.networkcontroller.exceptions.NetworkDeviceControllerException) HashMap(java.util.HashMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetworkLite(com.emc.storageos.util.NetworkLite) ArrayList(java.util.ArrayList) List(java.util.List) WBEMClient(javax.wbem.client.WBEMClient)

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