Search in sources :

Example 56 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class VPlexUtil method isVplexVolume.

/**
 * Check if the volume is a vplex virtual volume
 *
 * @param volume the volume
 * @param dbClient
 * @return true or false
 */
public static boolean isVplexVolume(Volume volume, DbClient dbClient) {
    URI storageURI = volume.getStorageController();
    StorageSystem storage = dbClient.queryObject(StorageSystem.class, storageURI);
    if (DiscoveredDataObject.Type.vplex.name().equals(storage.getSystemType())) {
        return true;
    } else {
        return false;
    }
}
Also used : URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 57 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class VPlexUtil method getBackendStorageSystemType.

/**
 * Gets the back-end volume's storage system type
 *
 * @param fcObject
 * @param dbClient
 * @return
 */
private static String getBackendStorageSystemType(BlockObject fcObject, DbClient dbClient) {
    URI backendStorageSystem = null;
    if (fcObject instanceof Volume) {
        Volume backendVolume = getVPLEXBackendVolume((Volume) fcObject, true, dbClient, true);
        backendStorageSystem = backendVolume.getStorageController();
    } else {
        backendStorageSystem = fcObject.getStorageController();
    }
    StorageSystem backendStorage = dbClient.queryObject(StorageSystem.class, backendStorageSystem);
    String systemType = backendStorage.getSystemType();
    return systemType;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 58 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class BlockControllerImpl method pauseNativeContinuousCopies.

@Override
public void pauseNativeContinuousCopies(URI storage, List<URI> mirrors, Boolean sync, String opId) throws InternalException {
    try {
        // Direct RMI call to expedite this call without any potential distribute-Q delay
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        Controller controller = lookupDeviceController(storageSystem);
        BlockController blkcontroller = (BlockController) controller;
        blkcontroller.pauseNativeContinuousCopies(storage, mirrors, sync, opId);
    } catch (RetryableDatabaseException e) {
        if (e.getServiceCode() == ServiceCode.DBSVC_CONNECTION_ERROR) {
            // netflix curator ConnectionException is not serializable
            // and thus should not be sent back to rmi client.
            _log.error("Failed to queue task due to dbsvc disconnected. Error: {}", e.getMessage());
            _log.error(e.getMessage(), e);
            throw DatabaseException.retryables.connectionFailed();
        }
        throw e;
    }
}
Also used : BlockController(com.emc.storageos.volumecontroller.BlockController) Controller(com.emc.storageos.Controller) BlockController(com.emc.storageos.volumecontroller.BlockController) AbstractDiscoveredSystemController(com.emc.storageos.impl.AbstractDiscoveredSystemController) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) RetryableDatabaseException(com.emc.storageos.db.exceptions.RetryableDatabaseException)

Example 59 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ControllerUtils method getAutoTieringPolicyName.

public static String getAutoTieringPolicyName(URI uri, DbClient dbClient) {
    String policyName = Constants.NONE;
    if (URIUtil.isType(uri, Volume.class)) {
        Volume volume = dbClient.queryObject(Volume.class, uri);
        URI policyURI = volume.getAutoTieringPolicyUri();
        if (!NullColumnValueGetter.isNullURI(policyURI)) {
            AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, policyURI);
            policyName = policy.getPolicyName();
        }
    } else if (URIUtil.isType(uri, BlockSnapshot.class)) {
        BlockSnapshot snapshot = dbClient.queryObject(BlockSnapshot.class, uri);
        StorageSystem storage = dbClient.queryObject(StorageSystem.class, snapshot.getStorageController());
        if (storage.checkIfVmax3()) {
            Volume volume = dbClient.queryObject(Volume.class, snapshot.getParent());
            URI policyURI = volume.getAutoTieringPolicyUri();
            if (!NullColumnValueGetter.isNullURI(policyURI)) {
                AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, policyURI);
                policyName = policy.getPolicyName();
            }
        }
    } else if (URIUtil.isType(uri, BlockMirror.class)) {
        BlockMirror mirror = dbClient.queryObject(BlockMirror.class, uri);
        if (!NullColumnValueGetter.isNullURI(mirror.getAutoTieringPolicyUri())) {
            AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, mirror.getAutoTieringPolicyUri());
            policyName = policy.getPolicyName();
        }
    }
    return policyName;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 60 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class FileOrchestrationDeviceController method failbackFileSystem.

@Override
public void failbackFileSystem(URI fsURI, StoragePort nfsPort, StoragePort cifsPort, boolean replicateConfiguration, String taskId) throws ControllerException {
    FileWorkflowCompleter completer = new FileWorkflowCompleter(fsURI, taskId);
    Workflow workflow = null;
    String stepDescription = null;
    try {
        FileShare sourceFileShare = s_dbClient.queryObject(FileShare.class, fsURI);
        List<String> targetfileUris = new ArrayList<String>();
        targetfileUris.addAll(sourceFileShare.getMirrorfsTargets());
        FileShare targetFileShare = s_dbClient.queryObject(FileShare.class, URI.create(targetfileUris.get(0)));
        StorageSystem systemSource = s_dbClient.queryObject(StorageSystem.class, sourceFileShare.getStorageDevice());
        workflow = this._workflowService.getNewWorkflow(this, FAILBACK_FILESYSTEMS_WF_NAME, false, taskId, completer);
        // Failback from Target File System
        s_logger.info("Generating steps for Failback Source File System from Target");
        String failbackStep = workflow.createStepId();
        stepDescription = String.format("Failback to source file System : %s from target system : %s.", sourceFileShare.getName(), targetFileShare.getName());
        Workflow.Method failbackMethod = new Workflow.Method(FAILBACK_FILE_SYSTEM_METHOD, systemSource.getId(), sourceFileShare.getId());
        String waitForFailback = workflow.createStep(null, stepDescription, null, systemSource.getId(), systemSource.getSystemType(), getClass(), failbackMethod, null, failbackStep);
        // Replicate directory quota setting
        stepDescription = String.format("Replicating directory quota settings from source file system : %s to file target system : %s", sourceFileShare.getId(), targetFileShare.getId());
        Workflow.Method replicateDirQuotaSettingsMethod = new Workflow.Method(REPLICATE_FILESYSTEM_DIRECTORY_QUOTA_SETTINGS_METHOD, systemSource.getId(), targetFileShare.getId());
        String replicateDirQuotaSettingsStep = workflow.createStepId();
        workflow.createStep(null, stepDescription, waitForFailback, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateDirQuotaSettingsMethod, null, replicateDirQuotaSettingsStep);
        if (replicateConfiguration) {
            Map<String, List<NfsACE>> sourceNFSACL = FileOrchestrationUtils.queryNFSACL(sourceFileShare, s_dbClient);
            Map<String, List<NfsACE>> targetNFSACL = FileOrchestrationUtils.queryNFSACL(targetFileShare, s_dbClient);
            if (!sourceNFSACL.isEmpty() || !targetNFSACL.isEmpty()) {
                stepDescription = String.format("Replicating NFS ACL from source file system : %s to file target system : %s", sourceFileShare.getId(), targetFileShare.getId());
                Workflow.Method replicateNFSACLsMethod = new Workflow.Method(REPLICATE_FILESYSTEM_NFS_ACLS_METHOD, systemSource.getId(), targetFileShare.getId());
                String replicateNFSACLsStep = workflow.createStepId();
                workflow.createStep(null, stepDescription, waitForFailback, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateNFSACLsMethod, null, replicateNFSACLsStep);
            }
            // Replicate NFS export and rules to Target Cluster.
            FSExportMap targetnfsExportMap = targetFileShare.getFsExports();
            FSExportMap sourcenfsExportMap = sourceFileShare.getFsExports();
            if (!(targetnfsExportMap == null && sourcenfsExportMap == null)) {
                // Both source and target export map shouldn't be null
                stepDescription = String.format("Replicating NFS exports from target file system : %s to source file system : %s", targetFileShare.getId(), sourceFileShare.getId());
                Workflow.Method replicateNFSExportMethod = new Workflow.Method(REPLICATE_FILESYSTEM_NFS_EXPORT_METHOD, systemSource.getId(), targetFileShare.getId(), nfsPort);
                String replicateNFSExportStep = workflow.createStepId();
                String waitForExport = workflow.createStep(null, stepDescription, waitForFailback, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateNFSExportMethod, null, replicateNFSExportStep);
                stepDescription = String.format("Replicating NFS export rules from target file system : %s to source file system : %s", targetFileShare.getId(), sourceFileShare.getId());
                Workflow.Method replicateNFSExportRulesMethod = new Workflow.Method(REPLICATE_FILESYSTEM_NFS_EXPORT_RULE_METHOD, systemSource.getId(), targetFileShare.getId());
                String replicateNFSExportRulesStep = workflow.createStepId();
                workflow.createStep(null, stepDescription, waitForExport, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateNFSExportRulesMethod, null, replicateNFSExportRulesStep);
            }
            // Replicate CIFS shares and ACLs from Target File System to Source.
            SMBShareMap targetSMBShareMap = targetFileShare.getSMBFileShares();
            SMBShareMap sourceSMBShareMap = sourceFileShare.getSMBFileShares();
            if (!(targetSMBShareMap == null && sourceSMBShareMap == null)) {
                // Both source and target share map shouldn't be null
                stepDescription = String.format("Replicating CIFS shares from target file system : %s to file source system : %s", targetFileShare.getId(), sourceFileShare.getId());
                Workflow.Method replicateCIFSShareMethod = new Workflow.Method(REPLICATE_FILESYSTEM_CIFS_SHARES_METHOD, systemSource.getId(), targetFileShare.getId(), cifsPort);
                String replicateCIFSShareStep = workflow.createStepId();
                String waitForShare = workflow.createStep(null, stepDescription, waitForFailback, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateCIFSShareMethod, null, replicateCIFSShareStep);
                stepDescription = String.format("Replicating CIFS share ACLs from target file system : %s to source file system : %s", targetFileShare.getId(), sourceFileShare.getId());
                Workflow.Method replicateCIFSShareACLsMethod = new Workflow.Method(REPLICATE_FILESYSTEM_CIFS_SHARE_ACLS_METHOD, systemSource.getId(), targetFileShare.getId());
                String replicateCIFSShareACLsStep = workflow.createStepId();
                workflow.createStep(null, stepDescription, waitForShare, systemSource.getId(), systemSource.getSystemType(), getClass(), replicateCIFSShareACLsMethod, null, replicateCIFSShareACLsStep);
            }
        }
        String successMessage = "Failback FileSystem successful for: " + sourceFileShare.getLabel();
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        s_logger.error("Could not failback filesystems: " + fsURI, ex);
        String opName = ResourceOperationTypeEnum.FILE_PROTECTION_ACTION_FAILBACK.getName();
        ServiceError serviceError = DeviceControllerException.errors.createFileSharesFailed(fsURI.toString(), opName, ex);
        completer.error(s_dbClient, this._locker, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) FileWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1088 URI (java.net.URI)581 ArrayList (java.util.ArrayList)424 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)319 Volume (com.emc.storageos.db.client.model.Volume)299 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)272 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)258 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)246 NamedURI (com.emc.storageos.db.client.model.NamedURI)243 WorkflowException (com.emc.storageos.workflow.WorkflowException)233 ControllerException (com.emc.storageos.volumecontroller.ControllerException)231 HashMap (java.util.HashMap)172 StoragePool (com.emc.storageos.db.client.model.StoragePool)159 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)158 StringSet (com.emc.storageos.db.client.model.StringSet)156 URISyntaxException (java.net.URISyntaxException)145 List (java.util.List)139 IOException (java.io.IOException)136 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)127 Workflow (com.emc.storageos.workflow.Workflow)126