use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileStorageUtils method removeFileContinuousCopy.
private static void removeFileContinuousCopy(URI fileId, URI continuousCopyId) {
if (isFileSystemWithActiveReplication(fileId)) {
execute(new PauseFileContinuousCopy(fileId, continuousCopyId, FileTechnologyType.LOCAL_MIRROR.name()));
}
Task<FileShareRestRep> task = execute(new DeactivateFileContinuousCopy(fileId, continuousCopyId, FileControllerConstants.DeleteTypeEnum.FULL.toString()));
addAffectedResource(task);
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileStorageUtils method expandFileSystem.
public static void expandFileSystem(URI fileSystemId, double sizeInGb) {
String newSize = String.valueOf(DiskSizeConversionUtils.gbToBytes(sizeInGb));
Task<FileShareRestRep> response = execute(new ExpandFileSystem(fileSystemId, newSize));
addAffectedResource(response);
logInfo("file.storage.task", response.getOpId());
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileStorageUtils method updateFileSystemExport.
public static String updateFileSystemExport(URI fileSystemId, String subDirectory, FileExportRule[] fileExportRules, boolean bypassDnsCheck) {
List<ExportRule> exportRuleList = getFileSystemExportRules(fileSystemId, false, subDirectory);
Set<String> existingRuleSet = Sets.newHashSet();
for (ExportRule rule : exportRuleList) {
existingRuleSet.add(rule.getSecFlavor());
}
List<ExportRule> exportRuleListToAdd = Lists.newArrayList();
List<ExportRule> exportRuleListToModify = Lists.newArrayList();
for (FileExportRule rule : fileExportRules) {
ExportRule exportRule = new ExportRule();
exportRule.setFsID(fileSystemId);
exportRule.setSecFlavor(rule.security);
String rootUserMapping = rule.rootUserMapping;
String domain = rule.domain;
if (StringUtils.isNotBlank(domain)) {
rootUserMapping = domain.trim() + "\\" + rootUserMapping.trim();
}
exportRule.setAnon(rootUserMapping);
Set<String> exportHosts = new HashSet<String>(rule.exportHosts);
switch(rule.getPermission()) {
case "ro":
exportRule.setReadOnlyHosts(exportHosts);
break;
case "rw":
exportRule.setReadWriteHosts(exportHosts);
break;
case "root":
exportRule.setRootHosts(exportHosts);
break;
default:
break;
}
if (existingRuleSet.contains(exportRule.getSecFlavor())) {
exportRuleListToModify.add(exportRule);
} else {
exportRuleListToAdd.add(exportRule);
}
}
FileShareExportUpdateParams params = new FileShareExportUpdateParams();
if (!exportRuleListToAdd.isEmpty()) {
ExportRules exportRulesToAdd = new ExportRules();
exportRulesToAdd.setExportRules(exportRuleListToAdd);
params.setExportRulesToAdd(exportRulesToAdd);
}
if (!exportRuleListToModify.isEmpty()) {
ExportRules exportRulesToModify = new ExportRules();
exportRulesToModify.setExportRules(exportRuleListToModify);
params.setExportRulesToModify(exportRulesToModify);
}
params.setBypassDnsCheck(bypassDnsCheck);
Task<FileShareRestRep> task = execute(new UpdateFileSystemExport(fileSystemId, subDirectory, params));
addAffectedResource(task);
String exportId = task.getResourceId().toString();
logInfo("file.storage.export.task", exportId, task.getOpId());
return exportId;
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSnapshots method snapshot.
public static void snapshot(String snapshotId) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileSnapshotRestRep snapshot = null;
try {
snapshot = client.fileSnapshots().get(uri(snapshotId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
snapshots(null);
}
throw e;
}
if (snapshot != null) {
if (snapshot.getParent() != null) {
FileShareRestRep fileSystem = client.fileSystems().get(snapshot.getParent());
renderArgs.put("fileSystem", fileSystem);
}
Tasks<FileSnapshotRestRep> tasksResponse = client.fileSnapshots().getTasks(snapshot.getId());
List<Task<FileSnapshotRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
} else {
flash.error(MessagesUtils.get(UNKNOWN, snapshotId));
snapshots(null);
}
render(snapshot);
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSystems method fileSystem.
public static void fileSystem(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileShareRestRep fileSystem = null;
try {
fileSystem = client.fileSystems().get(uri(fileSystemId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
flash.error(MessagesUtils.get(UNKNOWN, fileSystemId));
fileSystems(null);
}
throw e;
}
if (fileSystem != null) {
if (fileSystem.getVirtualArray() != null) {
VirtualArrayRestRep virtualArray = client.varrays().get(fileSystem.getVirtualArray());
renderArgs.put("virtualArray", virtualArray);
}
if (fileSystem.getVirtualPool() != null) {
FileVirtualPoolRestRep virtualPool = client.fileVpools().get(fileSystem.getVirtualPool());
renderArgs.put("virtualPool", virtualPool);
}
if (Security.isSystemAdminOrRestrictedSystemAdmin()) {
if (fileSystem.getStorageSystem() != null) {
StorageSystemRestRep storageSystem = client.storageSystems().get(fileSystem.getStorageSystem());
renderArgs.put("storageSystem", storageSystem);
}
if (fileSystem.getPool() != null) {
StoragePoolRestRep storagePool = client.storagePools().get(fileSystem.getPool());
renderArgs.put("storagePool", storagePool);
}
if (fileSystem.getStoragePort() != null) {
StoragePortRestRep storagePort = client.storagePorts().get(fileSystem.getStoragePort());
renderArgs.put("storagePort", storagePort);
}
}
Tasks<FileShareRestRep> tasksResponse = client.fileSystems().getTasks(fileSystem.getId());
List<Task<FileShareRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
} else {
notFound(MessagesUtils.get("resources.filesystems.notfound"));
}
renderArgs.put("permissionTypeOptions", PERMISSION_TYPES);
render(fileSystem);
}
Aggregations