Search in sources :

Example 31 with Snapshot

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

the class VNXeStorageDevice method updateExportRules.

@Override
public BiosCommandResult updateExportRules(StorageSystem storage, FileDeviceInputOutput args) {
    // Requested Export Rules
    List<ExportRule> exportAdd = args.getExportRulesToAdd();
    List<ExportRule> exportDelete = args.getExportRulesToDelete();
    List<ExportRule> exportModify = args.getExportRulesToModify();
    // To be processed export rules
    List<ExportRule> exportsToRemove = new ArrayList<>();
    List<ExportRule> exportsToAdd = new ArrayList<>();
    List<ExportRule> newExportsForDelete = new ArrayList<>();
    VNXeFileTaskCompleter completer = null;
    VNXeApiClient apiClient = getVnxeClient(storage);
    String subDir = args.getSubDirectory();
    // ALL EXPORTS
    List<ExportRule> exportsToprocess = args.getExistingDBExportRules();
    Map<String, ArrayList<ExportRule>> existingExportsMapped = new HashMap();
    try {
        String exportPath;
        if (!args.getFileOperation()) {
            exportPath = args.getSnapshotPath();
            if (subDir != null && subDir.length() > 0) {
                exportPath = args.getSnapshotPath() + "/" + subDir;
            }
        } else {
            exportPath = args.getFs().getPath();
            if (subDir != null && subDir.length() > 0) {
                exportPath = args.getFs().getPath() + "/" + subDir;
            }
        }
        _logger.info("exportPath : {}", exportPath);
        args.setExportPath(exportPath);
        try {
            // add the new export rule from the array into the update request.
            Map<String, ExportRule> arrayExportRuleMap = extraExportRuleFromArray(storage, args);
            if (!arrayExportRuleMap.isEmpty()) {
                if (exportModify != null) {
                    // merge the end point for which sec flavor is common.
                    for (ExportRule exportRule : exportModify) {
                        ExportRule arrayExportRule = arrayExportRuleMap.remove(exportRule.getSecFlavor());
                        if (arrayExportRule != null) {
                            if (exportRule.getReadOnlyHosts() != null) {
                                exportRule.getReadOnlyHosts().addAll(arrayExportRule.getReadOnlyHosts());
                            } else {
                                exportRule.setReadOnlyHosts(arrayExportRule.getReadOnlyHosts());
                            }
                            if (exportRule.getReadWriteHosts() != null) {
                                exportRule.getReadWriteHosts().addAll(arrayExportRule.getReadWriteHosts());
                            } else {
                                exportRule.setReadWriteHosts(arrayExportRule.getReadWriteHosts());
                            }
                            if (exportRule.getRootHosts() != null) {
                                exportRule.getRootHosts().addAll(arrayExportRule.getRootHosts());
                            } else {
                                exportRule.setRootHosts(arrayExportRule.getRootHosts());
                            }
                        }
                    }
                    // now add the remaining export rule
                    exportModify.addAll(arrayExportRuleMap.values());
                } else {
                    // if exportModify is null then create a new export rule and add
                    exportModify = new ArrayList<ExportRule>();
                    exportModify.addAll(arrayExportRuleMap.values());
                }
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            _logger.error("Not able to fetch latest Export rule from backend array.", e);
        }
        if (exportsToprocess == null) {
            exportsToprocess = new ArrayList<>();
        }
        _logger.info("Number of existng Rules found {}", exportsToprocess.size());
        // Process Exports
        for (ExportRule existingRule : exportsToprocess) {
            ArrayList<ExportRule> exps = existingExportsMapped.get(existingRule.getExportPath());
            if (exps == null) {
                exps = new ArrayList<>();
            }
            exps.add(existingRule);
            _logger.info("Checking existing export for {} : exps : {}", existingRule.getExportPath(), exps);
            existingExportsMapped.put(existingRule.getExportPath(), exps);
        }
        // Handle Add export Rules
        if (exportAdd != null && !exportAdd.isEmpty()) {
            // Check for existing exports for the export path including subdirectory
            ArrayList<ExportRule> exps = existingExportsMapped.get(exportPath);
            if (exps != null && !exps.isEmpty()) {
                _logger.error("Adding export rules is not supported as there can be only one export rule for VNXe.");
                ServiceError error = DeviceControllerErrors.vnxe.jobFailed("updateExportRules", "Adding export rule is not supported for VNXe");
                return BiosCommandResult.createErrorResult(error);
            }
        }
        // Handle Modified export Rules
        if (!exportsToprocess.isEmpty()) {
            if (subDir != null && !subDir.isEmpty()) {
                for (ExportRule existingRule : exportsToprocess) {
                    if (existingRule.getExportPath().endsWith("/" + subDir)) {
                        // Filter for a specific Sub Directory export
                        _logger.info("Updating all subdir exports rules at ViPR and  sub directory export at device {}", subDir);
                        processModifyRules(exportModify, existingRule, exportsToRemove, exportsToAdd);
                    } else {
                        exportsToRemove.add(existingRule);
                    }
                }
                // Handle Delete export Rules
                if (exportDelete != null && !exportDelete.isEmpty()) {
                    for (ExportRule existingRule : exportsToprocess) {
                        if (existingRule.getExportPath().endsWith("/" + subDir)) {
                            processDeleteRules(exportDelete, existingRule, exportsToRemove, newExportsForDelete);
                        } else {
                            exportsToRemove.add(existingRule);
                        }
                    }
                    exportsToAdd.addAll(newExportsForDelete);
                }
            } else {
                for (ExportRule existingRule : exportsToprocess) {
                    if (existingRule.getExportPath().equalsIgnoreCase(exportPath)) {
                        processModifyRules(exportModify, existingRule, exportsToRemove, exportsToAdd);
                    } else {
                        exportsToRemove.add(existingRule);
                    }
                }
                // Handle Delete export Rules
                if (exportDelete != null && !exportDelete.isEmpty()) {
                    for (ExportRule existingRule : exportsToprocess) {
                        if (existingRule.getExportPath().equalsIgnoreCase(exportPath)) {
                            processDeleteRules(exportDelete, existingRule, exportsToRemove, newExportsForDelete);
                        } else {
                            exportsToRemove.add(existingRule);
                        }
                    }
                    exportsToAdd.addAll(newExportsForDelete);
                }
            }
            // No of exports found to remove from the list
            _logger.info("No of exports found to remove from the existing exports list {}", exportsToRemove.size());
            exportsToprocess.removeAll(exportsToRemove);
            _logger.info("No of exports found to add to the existing exports list {}", exportsToAdd.size());
            exportsToprocess.addAll(exportsToAdd);
        } else {
            // This is valid only if no rules to modify exists
            if (exportAdd != null && !exportAdd.isEmpty()) {
                for (ExportRule newExport : exportAdd) {
                    if (args.getFileObjExports() != null) {
                        Collection<FileExport> expList = args.getFileObjExports().values();
                        Iterator<FileExport> it = expList.iterator();
                        FileExport exp = null;
                        while (it.hasNext()) {
                            FileExport export = it.next();
                            if (export.getPath().equalsIgnoreCase(exportPath)) {
                                exp = export;
                            }
                        }
                        if (exp != null) {
                            if (exp.getIsilonId() != null) {
                                newExport.setDeviceExportId(exp.getIsilonId());
                            }
                            if (exp.getNativeId() != null) {
                                newExport.setDeviceExportId(exp.getNativeId());
                            }
                        }
                    }
                    _logger.info("Add Export Rule {}", newExport);
                    newExport.setExportPath(exportPath);
                    exportsToAdd.add(newExport);
                }
            }
            exportsToprocess.addAll(exportsToAdd);
        }
        _logger.info("exportPath : {}", exportPath);
        args.setExportPath(exportPath);
        VNXeCommandJob job = null;
        for (ExportRule rule : exportsToprocess) {
            AccessEnum access = null;
            List<String> roHosts = null;
            List<String> rwHosts = null;
            List<String> rootHosts = null;
            String path = "/";
            String subdirName = "";
            String mountPathFs = args.getFsMountPath();
            String shareName = null;
            FileShareExport fsExport = null;
            boolean isDeleteRule = false;
            if (args.getFileObjExports() != null) {
                Collection<FileExport> expList = args.getFileObjExports().values();
                Iterator<FileExport> it = expList.iterator();
                FileExport exp = null;
                while (it.hasNext()) {
                    FileExport export = it.next();
                    if (export.getPath().equalsIgnoreCase(rule.getExportPath())) {
                        exp = export;
                    }
                }
                fsExport = new FileShareExport(exp);
            }
            String mountPathArg = rule.getExportPath();
            if (rule.getReadWriteHosts() != null && !rule.getReadWriteHosts().isEmpty()) {
                access = AccessEnum.READWRITE;
                if (rwHosts == null) {
                    rwHosts = new ArrayList<String>();
                }
                rwHosts.addAll(rule.getReadWriteHosts());
            }
            if (rule.getReadOnlyHosts() != null && !rule.getReadOnlyHosts().isEmpty()) {
                access = AccessEnum.READ;
                if (roHosts == null) {
                    roHosts = new ArrayList<String>();
                }
                roHosts.addAll(rule.getReadOnlyHosts());
            }
            if (rule.getRootHosts() != null && !rule.getRootHosts().isEmpty()) {
                access = AccessEnum.ROOT;
                if (rootHosts == null) {
                    rootHosts = new ArrayList<String>();
                }
                rootHosts.addAll(rule.getRootHosts());
            }
            if (newExportsForDelete.contains(rule)) {
                isDeleteRule = true;
            }
            if (args.getFileOperation()) {
                if (!mountPathArg.equals(mountPathFs)) {
                    // subdirectory specified.
                    subdirName = mountPathArg.substring(mountPathFs.length() + 1);
                    path += subdirName;
                }
                if (isDeleteRule) {
                    job = apiClient.removeNfsShare(rule.getDeviceExportId(), args.getFs().getNativeId());
                    if (job != null) {
                        completer = new VNXeFileTaskCompleter(FileShare.class, args.getFsId(), args.getOpId());
                        VNXeUnexportFileSystemJob unexportFSJob = new VNXeUnexportFileSystemJob(job.getId(), storage.getId(), completer, fsExport, args.getExportPath(), true);
                        ControllerServiceImpl.enqueueJob(new QueueJob(unexportFSJob));
                    } else {
                        _logger.error("No job returned from unexport FileSystem");
                        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("UnExportFileSystem", "No Job returned from UnExportFileSystem");
                        return BiosCommandResult.createErrorResult(error);
                    }
                } else {
                    job = apiClient.exportFileSystem(args.getFs().getNativeId(), roHosts, rwHosts, rootHosts, access, path, null, rule.getDeviceExportId(), null);
                    if (job != null) {
                        completer = new VNXeFileTaskCompleter(FileShare.class, args.getFsId(), args.getOpId());
                        VNXeModifyExportJob modifyExportJob = new VNXeModifyExportJob(job.getId(), storage.getId(), completer, rule, fsExport, args.getExportPath(), args.getFileOperation(), isDeleteRule, shareName);
                        ControllerServiceImpl.enqueueJob(new QueueJob(modifyExportJob));
                    } else {
                        _logger.error("No job returned from updateExportRules");
                        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("updateExportRules", "No Job returned from updateExportRules");
                        return BiosCommandResult.createErrorResult(error);
                    }
                }
            } else {
                shareName = VNXeUtils.buildNfsShareName(args.getSnapshotName(), path);
                if (isDeleteRule) {
                    job = apiClient.deleteNfsShareForSnapshot(rule.getDeviceExportId());
                    if (job != null) {
                        completer = new VNXeFileTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
                        VNXeUnexportFileSystemJob unexportFSJob = new VNXeUnexportFileSystemJob(job.getId(), storage.getId(), completer, fsExport, rule.getExportPath(), false);
                        ControllerServiceImpl.enqueueJob(new QueueJob(unexportFSJob));
                    } else {
                        _logger.error("No job returned from unexportFileSystem Snapshot");
                        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("UnExportFileSystem", "No Job returned from UnExportFileSystem");
                        return BiosCommandResult.createErrorResult(error);
                    }
                } else {
                    job = apiClient.createNfsShareForSnap(args.getSnapNativeId(), roHosts, rwHosts, rootHosts, access, path, shareName, null);
                    if (job != null) {
                        completer = new VNXeFileTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
                        VNXeModifyExportJob modifyExportJob = new VNXeModifyExportJob(job.getId(), storage.getId(), completer, rule, fsExport, args.getExportPath(), args.getFileOperation(), isDeleteRule, shareName);
                        ControllerServiceImpl.enqueueJob(new QueueJob(modifyExportJob));
                    } else {
                        _logger.error("No job returned from updateExportRules");
                        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("updateExportRules", "No Job returned from updateExportRules");
                        return BiosCommandResult.createErrorResult(error);
                    }
                }
            }
        }
    } catch (VNXeException e) {
        _logger.error("updateExportRules got the exception", e);
        if (completer != null) {
            completer.error(_dbClient, e);
        }
        return BiosCommandResult.createErrorResult(e);
    } catch (Exception ex) {
        _logger.error("updateExportRules got the exception", ex);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("updateExportRules", ex.getMessage());
        if (completer != null) {
            completer.error(_dbClient, error);
        }
        return BiosCommandResult.createErrorResult(error);
    }
    _logger.info("UpdateExportRules job submitted");
    return BiosCommandResult.createPendingResult();
}
Also used : VNXeModifyExportJob(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeModifyExportJob) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VNXeFileTaskCompleter(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFileTaskCompleter) VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) FileShareExport(com.emc.storageos.volumecontroller.FileShareExport) AccessEnum(com.emc.storageos.vnxe.models.AccessEnum) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) Snapshot(com.emc.storageos.db.client.model.Snapshot) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) VNXeException(com.emc.storageos.vnxe.VNXeException) FileExport(com.emc.storageos.db.client.model.FileExport) ExportRule(com.emc.storageos.model.file.ExportRule) VNXeUnexportFileSystemJob(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeUnexportFileSystemJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob)

Example 32 with Snapshot

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

the class VNXeStorageDevice method doDeleteSnapshot.

@Override
public BiosCommandResult doDeleteSnapshot(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    _logger.info("Deleting file system {} snapshot {} ", args.getFsName(), args.getSnapshotLabel());
    VNXeApiClient apiClient = getVnxeClient(storage);
    VNXeCommandJob job = null;
    VNXeFileTaskCompleter completer = null;
    try {
        job = apiClient.deleteFileSystemSnap(args.getSnapNativeId());
        if (job != null) {
            completer = new VNXeFileTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
            VNXeDeleteFileSystemSnapshotJob snapJob = new VNXeDeleteFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
            ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
        } else {
            _logger.error("No job returned from deleteFileSystemSnap");
            ServiceError error = DeviceControllerErrors.vnxe.jobFailed("snapshotFileSystem", "No Job returned from deleteFileSystemSnap");
            return BiosCommandResult.createErrorResult(error);
        }
    } catch (VNXeException e) {
        _logger.error("Delete file system snapshot got the exception", e);
        if (completer != null) {
            completer.error(_dbClient, e);
        }
        return BiosCommandResult.createErrorResult(e);
    } catch (Exception ex) {
        _logger.error("Delete file system snpashot got the exception", ex);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystemSnapshot", ex.getMessage());
        if (completer != null) {
            completer.error(_dbClient, error);
        }
        return BiosCommandResult.createErrorResult(error);
    }
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Delete filesystem snapshot job submitted - Array:%s, fileSystem: %s, snapshot: %s", storage.getSerialNumber(), args.getFsName(), args.getSnapshotName()));
    _logger.info(logMsgBuilder.toString());
    return BiosCommandResult.createPendingResult();
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) Snapshot(com.emc.storageos.db.client.model.Snapshot) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) VNXeDeleteFileSystemSnapshotJob(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeDeleteFileSystemSnapshotJob) VNXeException(com.emc.storageos.vnxe.VNXeException) VNXeFileTaskCompleter(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFileTaskCompleter) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 33 with Snapshot

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

the class VNXeCreateFileSystemSnapshotJob method updateStatus.

/**
 * Called to update the job status when the file system snapshot create job completes.
 *
 * @param jobContext The job context.
 */
@Override
public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    try {
        if (_status == JobStatus.IN_PROGRESS) {
            return;
        }
        String opId = getTaskCompleter().getOpId();
        StringBuilder logMsgBuilder = new StringBuilder(String.format("Updating status of job %s to %s", opId, _status.name()));
        VNXeApiClient vnxeApiClient = getVNXeClient(jobContext);
        URI snapId = getTaskCompleter().getId();
        Snapshot snapshotObj = dbClient.queryObject(Snapshot.class, snapId);
        URI fsUri = snapshotObj.getParent().getURI();
        FileShare fsObj = dbClient.queryObject(FileShare.class, fsUri);
        String event = null;
        if (_status == JobStatus.SUCCESS && snapshotObj != null) {
            updateSnapshot(snapshotObj, dbClient, logMsgBuilder, vnxeApiClient);
            event = String.format("Create file system snapshot successfully for URI: %s", getTaskCompleter().getId());
        } else if (_status == JobStatus.FAILED && snapshotObj != null) {
            if (!snapshotObj.getInactive()) {
                snapshotObj.setInactive(true);
                dbClient.persistObject(snapshotObj);
            }
            event = String.format("Task %s failed to create file system snapshot: %s", opId, snapshotObj.getName());
            logMsgBuilder.append("\n");
            logMsgBuilder.append(event);
        } else {
            logMsgBuilder.append(String.format("Could not find the snapshot:%s", snapId.toString()));
        }
        _logger.info(logMsgBuilder.toString());
        FileDeviceController.recordFileDeviceOperation(dbClient, OperationTypeEnum.CREATE_FILE_SYSTEM_SNAPSHOT, _isSuccess, event, "", snapshotObj, fsObj);
    } catch (Exception e) {
        _logger.error("Caught an exception while trying to updateStatus for VNXeCreateFileSystemSnapshotJob", e);
        setErrorStatus("Encountered an internal error during file system snapshot create job status processing : " + e.getMessage());
    } finally {
        super.updateStatus(jobContext);
    }
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) DbClient(com.emc.storageos.db.client.DbClient) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) URI(java.net.URI) FileShare(com.emc.storageos.db.client.model.FileShare) IOException(java.io.IOException)

Example 34 with Snapshot

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

the class VNXeCreateShareJob method updateStatus.

@Override
public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    try {
        if (_status == JobStatus.IN_PROGRESS) {
            return;
        }
        String opId = getTaskCompleter().getOpId();
        StringBuilder logMsgBuilder = new StringBuilder(String.format("Updating status of job %s to %s", opId, _status.name()));
        VNXeApiClient vnxeApiClient = getVNXeClient(jobContext);
        String event = "";
        FileShare fsObj = null;
        Snapshot snapObj = null;
        URI fsId = getTaskCompleter().getId();
        fsObj = dbClient.queryObject(FileShare.class, fsId);
        if (_status == JobStatus.SUCCESS) {
            if (isFile) {
                updateFileSystem(vnxeApiClient, dbClient, fsObj);
                event = String.format("Create file system smbShare successfully for URI: %s", getTaskCompleter().getId());
            } else {
                snapObj = updateSnapshot(vnxeApiClient, dbClient);
                event = String.format("Create snapshot smbShare successfully for URI: %s", getTaskCompleter().getId());
            }
        } else if (_status == JobStatus.FAILED) {
            event = String.format("Task %s failed to create file system smbShare: %s", opId, smbShare.getName());
            logMsgBuilder.append("\n");
            logMsgBuilder.append(event);
        }
        _logger.info(logMsgBuilder.toString());
        if (isFile) {
            FileDeviceController.recordFileDeviceOperation(dbClient, OperationTypeEnum.CREATE_FILE_SYSTEM_SHARE, _isSuccess, event, smbShare.getName(), fsObj, smbShare);
        } else {
            fsObj = dbClient.queryObject(FileShare.class, snapObj.getParent());
            FileDeviceController.recordFileDeviceOperation(dbClient, OperationTypeEnum.CREATE_FILE_SNAPSHOT_SHARE, _isSuccess, event, smbShare.getName(), snapObj, fsObj, smbShare);
        }
    } catch (Exception e) {
        _logger.error("Caught an exception while trying to updateStatus for VNXeCreateFileSystemSnapshotJob", e);
        setErrorStatus("Encountered an internal error during file system snapshot create job status processing : " + e.getMessage());
    } finally {
        super.updateStatus(jobContext);
    }
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) DbClient(com.emc.storageos.db.client.DbClient) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) URI(java.net.URI)

Example 35 with Snapshot

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

the class VNXeCreateShareJob method updateSnapshot.

private Snapshot updateSnapshot(VNXeApiClient apiClient, DbClient dbClient) {
    URI snapId = getTaskCompleter().getId();
    Snapshot snapObj = dbClient.queryObject(Snapshot.class, snapId);
    SMBShareMap shareMap = snapObj.getSMBFileShares();
    if (shareMap == null) {
        shareMap = new SMBShareMap();
        snapObj.setSMBFileShares(shareMap);
    }
    VNXeCifsShare vnxeShare = apiClient.findCifsShareByName(smbShare.getName());
    if (vnxeShare != null) {
        smbShare.setNativeId(vnxeShare.getId());
        SMBFileShare share = smbShare.getSMBFileShare();
        // set Mount Point
        share.setMountPoint(share.getNetBIOSName(), share.getStoragePortNetworkId(), share.getStoragePortName(), share.getName());
        shareMap.put(share.getName(), share);
        createDefaultACEForShare(dbClient, snapId, smbShare);
    } else {
        _logger.error("Could not find the smbShare : {} in vnxe", smbShare.getName());
        setErrorStatus(String.format("Could not find the smbShare: %s in the VNXe array", smbShare.getName()));
    }
    dbClient.persistObject(snapObj);
    return snapObj;
}
Also used : Snapshot(com.emc.storageos.db.client.model.Snapshot) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) VNXeCifsShare(com.emc.storageos.vnxe.models.VNXeCifsShare) URI(java.net.URI)

Aggregations

Snapshot (com.emc.storageos.db.client.model.Snapshot)92 FileShare (com.emc.storageos.db.client.model.FileShare)59 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)52 URI (java.net.URI)36 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)34 ControllerException (com.emc.storageos.volumecontroller.ControllerException)34 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)32 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)31 ArrayList (java.util.ArrayList)24 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)23 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)22 FileObject (com.emc.storageos.db.client.model.FileObject)21 URISyntaxException (java.net.URISyntaxException)21 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)19 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)19 WorkflowException (com.emc.storageos.workflow.WorkflowException)19 MapFileSnapshot (com.emc.storageos.api.mapper.functions.MapFileSnapshot)18 Path (javax.ws.rs.Path)18 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)17 Produces (javax.ws.rs.Produces)17