Search in sources :

Example 56 with BiosCommandResult

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

the class NetAppClusterModeDevice method doDeleteSnapshot.

@Override
public BiosCommandResult doDeleteSnapshot(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    if (null == args.getFsName()) {
        throw new DeviceControllerException("Filesystem name is either missing or empty", new Object[] {});
    }
    if (null == args.getSnapshotName()) {
        throw new DeviceControllerException("Snapshot name is either missing or empty for filesystem name {0}", new Object[] { args.getFsName() });
    }
    _log.info("NetAppClusterModeDevice doDeleteSnapshot: {},{} - start", args.getSnapshotId(), args.getSnapshotName());
    BiosCommandResult result = new BiosCommandResult();
    String portGroup = findSVMName(args.getFs());
    NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
    try {
        if (!ncApi.deleteSnapshot(args.getFsName(), args.getSnapshotName())) {
            _log.error("NetAppClusterModeDevice doDeleteSnapshot {} - failed", args.getFsId());
            result.setCommandSuccess(false);
            result.setMessage("NetAppClusterModeDevice doDeleteSnapshot - failed");
            result.setCommandStatus(Operation.Status.error.name());
        } else {
            _log.info("doDeleteSnapshot for snapshot {} on filesystem {} successful", args.getSnapshotName(), args.getFsName());
            result.setCommandSuccess(true);
            result.setCommandStatus(Operation.Status.ready.name());
            result.setMessage("Snapshot," + args.getSnapshotName() + " has been successfully deleted");
        }
    } catch (NetAppCException e) {
        throw new DeviceControllerException("Failed to delete snapshot, {0} for filesystem, {1} with: {2}", new Object[] { args.getSnapshotName(), args.getFsName(), e.getMessage() });
    }
    return result;
}
Also used : NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 57 with BiosCommandResult

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

the class NetAppClusterModeDevice method deleteShareACLs.

@Override
public BiosCommandResult deleteShareACLs(StorageSystem storage, FileDeviceInputOutput args) {
    BiosCommandResult result = new BiosCommandResult();
    List<ShareACL> existingAcls = new ArrayList<ShareACL>();
    existingAcls = args.getExistingShareAcls();
    String portGroup = findSVMName(args.getFs());
    NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
    try {
        updateShareAcl(ncApi, args.getShareName(), existingAcls, AclOperation.DELETE);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::Delete All ACL failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteCIFSShareAcl();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ArrayList(java.util.ArrayList) ShareACL(com.emc.storageos.model.file.ShareACL) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Example 58 with BiosCommandResult

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

the class NetAppClusterModeDevice method rollbackShareACLs.

private BiosCommandResult rollbackShareACLs(StorageSystem storage, FileDeviceInputOutput args, List<ShareACL> existingList) {
    BiosCommandResult result = new BiosCommandResult();
    String portGroup = findSVMName(args.getFs());
    NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
    try {
        // We can have multiple ace added/modified in one put call ,some of them can fail due to some reason.
        // In case of failure, to make it consistent in vipr db and NetApp share, delete all currently
        // added and modified ace and revert it to old acl list
        _log.info("NetAppClusterModeDevice::Rolling back update ACL by trying delete ACL for share {}", args.getShareName());
        List<ShareACL> aclsToClear = new ArrayList<ShareACL>();
        aclsToClear.addAll(args.getShareAclsToAdd());
        aclsToClear.addAll(args.getShareAclsToModify());
        updateShareAcl(ncApi, args.getShareName(), aclsToClear, AclOperation.FORCE_DELETE);
        _log.info("NetAppClusterModeDevice::Adding back old ACL to Share {}", args.getShareName());
        updateShareAcl(ncApi, args.getShareName(), existingList, AclOperation.FORCE_ADD);
        result = BiosCommandResult.createSuccessfulResult();
    } catch (Exception e) {
        _log.error("NetAppClusterModeDevice::Roll Back of ACL failed with an Exception", e);
        ServiceError serviceError = DeviceControllerErrors.netappc.unableToUpdateCIFSShareAcl();
        serviceError.setMessage(e.getLocalizedMessage());
        result = BiosCommandResult.createErrorResult(serviceError);
    }
    return result;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) NetAppClusterApi(com.emc.storageos.netappc.NetAppClusterApi) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) ArrayList(java.util.ArrayList) ShareACL(com.emc.storageos.model.file.ShareACL) ControllerException(com.emc.storageos.volumecontroller.ControllerException) NetAppCException(com.emc.storageos.netappc.NetAppCException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Example 59 with BiosCommandResult

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

the class RPCommunicationInterface method discoverRPSiteArrays.

@SuppressWarnings("unchecked")
private void discoverRPSiteArrays(ProtectionSystem rpSystem) throws RecoverPointCollectionException {
    _log.info("BEGIN RecoverPointProtection.discoveryProtectionSystem()");
    // Retrieve the storage device info from the database.
    ProtectionSystem storageObj = rpSystem;
    // Wait for any storage system discovery to complete
    waitForStorageSystemDiscovery();
    // Get the rp system's array mappings from the RP client
    BiosCommandResult result = getRPArrayMappings(storageObj);
    _log.info(String.format("discoverProtectionSystem(): after rpa array mappings with result: [%s] ", result.getCommandStatus()));
    RPSiteArray rpSiteArray = null;
    if (result.getCommandSuccess()) {
        // Current implementation:
        // 1. Clear out any of its entries regarding associations
        // 2. For each RPSite object, there is an associated RP storage system
        // 3. Find the storage system in the database
        // 4. Fill in associations
        List<URI> ids = _dbClient.queryByType(RPSiteArray.class, true);
        for (URI id : ids) {
            _log.info("discoverProtectionSystem(): reading RPSiteArray: " + id.toASCIIString());
            rpSiteArray = _dbClient.queryObject(RPSiteArray.class, id);
            if (rpSiteArray == null) {
                continue;
            }
            if ((rpSiteArray.getRpProtectionSystem() != null) && (rpSiteArray.getRpProtectionSystem().equals(storageObj.getId()))) {
                _log.info(String.format("discoverProtectionSystem(): removing RPSiteArray[%s](%s) " + "entry for Storage System [%s].", rpSiteArray.getLabel(), rpSiteArray.getId().toASCIIString(), rpSiteArray.getArraySerialNumber()));
                _dbClient.markForDeletion(rpSiteArray);
            } else if (rpSiteArray.getRpProtectionSystem() == null) {
                _log.error("RPSiteArray " + id.toASCIIString() + " does not have a parent assigned, therefore it is an orphan.");
            }
        }
        // Store any unmatched WWNs for logging purposes
        StringBuffer unmatchedWWNs = new StringBuffer();
        // Map the information from the RP client to information in our database
        for (SiteArrays siteArray : (List<SiteArrays>) result.getObjectList().get(0)) {
            for (String wwn : siteArray.getArrays()) {
                // Find the array that corresponds to the wwn endpoint we found
                URIQueryResultList storagePortList = new URIQueryResultList();
                StoragePort storagePort = null;
                _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStoragePortEndpointConstraint(WwnUtils.convertWWN(wwn, WwnUtils.FORMAT.COLON)), storagePortList);
                List<URI> storagePortURIs = new ArrayList<URI>();
                for (URI uri : storagePortList) {
                    storagePort = _dbClient.queryObject(StoragePort.class, uri);
                    if (storagePort != null && !storagePort.getInactive() && storagePort.getRegistrationStatus().equals(RegistrationStatus.REGISTERED.name())) {
                        // ignore cinder managed storage system's port
                        StorageSystem system = _dbClient.queryObject(StorageSystem.class, storagePort.getStorageDevice());
                        if (!DiscoveredDataObject.Type.openstack.name().equals(system.getSystemType())) {
                            storagePortURIs.add(uri);
                        }
                    }
                }
                if (!storagePortURIs.isEmpty()) {
                    storagePort = _dbClient.queryObject(StoragePort.class, storagePortURIs).get(0);
                    StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storagePort.getStorageDevice());
                    rpSiteArray = new RPSiteArray();
                    rpSiteArray.setInactive(false);
                    rpSiteArray.setLabel(siteArray.getSite().getSiteName() + ":" + wwn);
                    rpSiteArray.setRpProtectionSystem(storageObj.getId());
                    rpSiteArray.setStorageSystem(storagePort.getStorageDevice());
                    rpSiteArray.setArraySerialNumber(storageSystem.getSerialNumber());
                    rpSiteArray.setRpInternalSiteName(siteArray.getSite().getInternalSiteName());
                    rpSiteArray.setRpSiteName(siteArray.getSite().getSiteName());
                    rpSiteArray.setId(URIUtil.createId(RPSiteArray.class));
                    _log.info(String.format("discoverProtectionSystem(): adding RPSiteArray[%s](%s) " + "entry for Storage System [%s].", rpSiteArray.getLabel(), rpSiteArray.getId().toASCIIString(), rpSiteArray.getArraySerialNumber()));
                    _dbClient.createObject(rpSiteArray);
                } else {
                    unmatchedWWNs.append("\n" + wwn);
                }
            }
        }
        if (!StringUtils.isEmpty(unmatchedWWNs.toString())) {
            _log.warn(String.format("Discovery of RecoverPoint Protection System [%s](%s) found the following endpoints, however " + "they could not be aligned with existing configured arrays. Note this is not an error and that some could be Host " + "endpoints but please ensure all arrays are registered before registering/running discovery of " + "RecoverPoint: [%s]", rpSystem.getLabel(), rpSystem.getId(), unmatchedWWNs));
        }
    } else {
        _log.warn(String.format("RPA array mappings did not return a successful result, " + "please check network connectivity for RecoverPoint Protection System [%s](%s)."), rpSystem.getLabel(), rpSystem.getId());
    }
    _log.info("END RecoverPointProtection.discoveryProtectionSystem()");
}
Also used : RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) SiteArrays(com.emc.storageos.recoverpoint.objectmodel.SiteArrays) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) List(java.util.List) ArrayList(java.util.ArrayList) NamespaceList(com.emc.storageos.plugins.common.domainmodel.NamespaceList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 60 with BiosCommandResult

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

the class VNXFileStorageDeviceXML method doDeleteShares.

@Override
public BiosCommandResult doDeleteShares(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    BiosCommandResult result = new BiosCommandResult();
    result.setCommandSuccess(false);
    result.setCommandStatus(Operation.Status.error.name());
    result.setMessage("SMB sharing is not supported.");
    return result;
}
Also used : BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

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