Search in sources :

Example 11 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class AbstractFileServiceApiImpl method deleteFileSystems.

@Override
public void deleteFileSystems(URI systemURI, List<URI> fileSystemURIs, String deletionType, boolean forceDelete, boolean deleteOnlyMirrors, String task) throws InternalException {
    // Get volume descriptor for all volumes to be deleted.
    List<FileDescriptor> fileDescriptors = getDescriptorsOfFileShareDeleted(systemURI, fileSystemURIs, deletionType, forceDelete, deleteOnlyMirrors);
    // place request in queue
    FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
    controller.deleteFileSystems(fileDescriptors, task);
}
Also used : FileOrchestrationController(com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Example 12 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class FileSystemVpoolChangeCompleter method handleFileShareErrors.

private void handleFileShareErrors(DbClient dbClient) {
    for (FileDescriptor fileDescriptor : FileDescriptor.getDescriptors(_fileDescriptors, FileDescriptor.Type.FILE_DATA)) {
        FileShare fileShare = dbClient.queryObject(FileShare.class, fileDescriptor.getFsURI());
        if (fileShare != null && (fileShare.getNativeId() == null || fileShare.getNativeId().equals(""))) {
            _log.info("No native id was present on FileShare {}, marking inactive", fileShare.getLabel());
            dbClient.markForDeletion(fileShare);
        }
    }
}
Also used : FileShare(com.emc.storageos.db.client.model.FileShare) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Example 13 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class FileDeviceController method addStepsForDeleteFileSystems.

public String addStepsForDeleteFileSystems(Workflow workflow, String waitFor, List<FileDescriptor> filesystems, String taskId) throws InternalException {
    List<FileDescriptor> sourceDescriptors = FileDescriptor.filterByType(filesystems, FileDescriptor.Type.FILE_DATA, FileDescriptor.Type.FILE_EXISTING_SOURCE, FileDescriptor.Type.FILE_MIRROR_SOURCE);
    // Segregate by device.
    Map<URI, List<FileDescriptor>> deviceMap = FileDescriptor.getDeviceMap(sourceDescriptors);
    // Add a step to delete the fileshares in each device.
    for (URI deviceURI : deviceMap.keySet()) {
        filesystems = deviceMap.get(deviceURI);
        List<URI> fileshareURIs = FileDescriptor.getFileSystemURIs(filesystems);
        for (URI uriFile : fileshareURIs) {
            FileShare fsObj = _dbClient.queryObject(FileShare.class, uriFile);
            // unmount exports only if FULL delete
            if (FileControllerConstants.DeleteTypeEnum.FULL.toString().equalsIgnoreCase(filesystems.get(0).getDeleteType())) {
                waitFor = createMethod(workflow, waitFor, CHECK_FILESYSTEM_DEPENDENCIES_METHOD, null, "Check File System dependencies: NFS and CIFS exports and snapshots", fsObj.getStorageDevice(), new Object[] { fsObj.getStorageDevice(), fsObj.getId() });
                // get all the mounts and generate steps for unmounting them
                List<MountInfo> mountList = getAllMountedExports(uriFile, null, true);
                for (MountInfo mount : mountList) {
                    Object[] args = new Object[] { mount.getHostId(), mount.getFsId(), mount.getMountPath() };
                    waitFor = createMethod(workflow, waitFor, UNMOUNT_FILESYSTEM_EXPORT_METHOD, null, "Unmounting path:" + mount.getMountPath(), fsObj.getStorageDevice(), args);
                }
            } else {
                // Only remove the mounts from CoPRHD database if Inventory Only delete
                Object[] args = new Object[] { uriFile };
                waitFor = createMethod(workflow, waitFor, CHECK_IF_MOUNT_EXISTS_ON_HOST, null, "Confirming mount dependencies for fs:" + fsObj.getId(), fsObj.getStorageDevice(), args);
            }
            if (fsObj != null && fsObj.getMirrorfsTargets() != null) {
                for (String mirrorTarget : fsObj.getMirrorfsTargets()) {
                    URI targetURI = URI.create(mirrorTarget);
                    FileShare fsTargObj = _dbClient.queryObject(FileShare.class, targetURI);
                    if (fsTargObj != null && !fsTargObj.getInactive()) {
                        _log.info("addStepsForDeleteFileSystems - deleting target fs {} for file system {}", fsTargObj.getId(), fsObj.getId());
                        workflow.createStep(DELETE_FILESYSTEMS_STEP, String.format("Deleting fileshares:%n%s", asList(targetURI)), waitFor, fsTargObj.getStorageDevice(), getDeviceType(fsTargObj.getStorageDevice()), this.getClass(), deleteFileSharesMethod(fsTargObj.getStorageDevice(), asList(targetURI), filesystems.get(0).isForceDelete(), filesystems.get(0).getDeleteType(), taskId), null, null);
                    }
                }
            }
            // Dont delete the source file system for delete only targets operation!!
            if (!filesystems.get(0).isDeleteTargetOnly()) {
                _log.info("addStepsForDeleteFileSystems - deleting source fs {} ", fsObj.getId());
                workflow.createStep(DELETE_FILESYSTEMS_STEP, String.format("Deleting fileshares:%n%s", fileshareURIs), waitFor, deviceURI, getDeviceType(deviceURI), this.getClass(), deleteFileSharesMethod(deviceURI, fileshareURIs, filesystems.get(0).isForceDelete(), filesystems.get(0).getDeleteType(), taskId), null, null);
            }
        }
    }
    return waitFor = DELETE_FILESYSTEMS_STEP;
}
Also used : Arrays.asList(java.util.Arrays.asList) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) FileObject(com.emc.storageos.db.client.model.FileObject) DataObject(com.emc.storageos.db.client.model.DataObject) FileMountInfo(com.emc.storageos.db.client.model.FileMountInfo) MountInfo(com.emc.storageos.model.file.MountInfo) URI(java.net.URI) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Example 14 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class FileCreateWorkflowCompleter method handleFileShareErrors.

private void handleFileShareErrors(DbClient dbClient) {
    for (FileDescriptor fileDescriptor : FileDescriptor.getDescriptors(_fileDescriptors, FileDescriptor.Type.FILE_DATA)) {
        FileShare fileShare = dbClient.queryObject(FileShare.class, fileDescriptor.getFsURI());
        if (fileShare != null && (fileShare.getNativeId() == null || fileShare.getNativeId().equals(""))) {
            _log.info("No native id was present on FileShare {}, marking inactive", fileShare.getLabel());
            dbClient.markForDeletion(fileShare);
        }
    }
}
Also used : FileShare(com.emc.storageos.db.client.model.FileShare) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Example 15 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class CreateMirrorFileSystemsCompleter method handleFileShareErrors.

private void handleFileShareErrors(DbClient dbClient) {
    for (FileDescriptor fileDescriptor : FileDescriptor.getDescriptors(_fileDescriptors, FileDescriptor.Type.FILE_DATA)) {
        FileShare fileShare = dbClient.queryObject(FileShare.class, fileDescriptor.getFsURI());
        if (fileShare != null && (fileShare.getNativeId() == null || fileShare.getNativeId().equals(""))) {
            _log.info("No native id was present on FileShare {}, marking inactive", fileShare.getLabel());
            dbClient.markForDeletion(fileShare);
        }
    }
}
Also used : FileShare(com.emc.storageos.db.client.model.FileShare) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Aggregations

FileDescriptor (com.emc.storageos.fileorchestrationcontroller.FileDescriptor)21 FileShare (com.emc.storageos.db.client.model.FileShare)20 ArrayList (java.util.ArrayList)13 FileOrchestrationController (com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController)8 URI (java.net.URI)7 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)5 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)4 Workflow (com.emc.storageos.workflow.Workflow)3 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 SMBShareMap (com.emc.storageos.db.client.model.SMBShareMap)2 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)2 FileSystemParam (com.emc.storageos.model.file.FileSystemParam)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 TaskMapper.toTask (com.emc.storageos.api.mapper.TaskMapper.toTask)1 MapFileShare (com.emc.storageos.api.mapper.functions.MapFileShare)1