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);
}
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);
}
}
}
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;
}
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);
}
}
}
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);
}
}
}
Aggregations