use of com.emc.storageos.datadomain.restapi.model.DDExportClientModify in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method ddModifyExports.
private void ddModifyExports(DataDomainClient ddClient, String storagePoolId, FSExportMap exportMap, List<FileExport> modifyFileExports) {
for (FileExport fileExport : modifyFileExports) {
fileExport.setNativeId(exportMap.get(fileExport.getFileExportKey()).getNativeId());
List<DDExportClientModify> ddExportClients = ddBuildModifyExportClientList(exportMap, fileExport);
DDExportInfoDetail ddExport = ddClient.getExport(storagePoolId, fileExport.getNativeId());
if (ddExport.getPathStatus() != DataDomainApiConstants.PATH_EXISTS) {
DDServiceStatus ddSvcStatus = ddClient.deleteExport(storagePoolId, ddExport.getId());
throw DataDomainApiException.exceptions.failedExportPathDoesNotExist(ddExport.getPath());
} else {
DDExportInfo ddExportInfo = ddClient.modifyExport(storagePoolId, fileExport.getNativeId(), ddExportClients);
FileExport existingExport = exportMap.get(fileExport.getFileExportKey());
ddSetExistingExportProperties(existingExport, fileExport, ddExportInfo);
}
}
}
use of com.emc.storageos.datadomain.restapi.model.DDExportClientModify in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method doAddDeleteClients.
private void doAddDeleteClients(DataDomainClient ddClient, String storagePoolId, String exportId, List<ExportRule> rulesToModify, boolean delete) throws DataDomainApiException {
if ((rulesToModify != null) && (!rulesToModify.isEmpty())) {
// Build list of endpoints for rules being modified (added or deleted)
List<DDExportClient> ddExportClients = new ArrayList<>();
for (ExportRule ruleToModify : rulesToModify) {
List<DDExportClient> ddExpClients = ddBuildExportClientList(ruleToModify);
if (ddExpClients != null) {
ddExportClients.addAll(ddExpClients);
}
}
// Build list of clients to be modified on the array
List<DDExportClientModify> modifyClients = new ArrayList<>();
for (DDExportClient ddExportClient : ddExportClients) {
DDExportClientModify modifyClient = new DDExportClientModify(ddExportClient.getName(), ddExportClient.getOptions(), delete);
modifyClients.add(modifyClient);
}
// Modify clients on the array
if (!modifyClients.isEmpty()) {
DDExportInfo ddExportInfo = ddClient.modifyExport(storagePoolId, exportId, modifyClients);
if (ddExportInfo.getPathStatus() != DataDomainApiConstants.PATH_EXISTS) {
DDExportInfoDetail exportDetail = ddClient.getExport(storagePoolId, exportId);
if (delete) {
throw DataDomainApiException.exceptions.failedToDeleteExportClients(exportDetail.getPath());
} else {
throw DataDomainApiException.exceptions.failedToAddExportClients(exportDetail.getPath());
}
}
}
}
}
use of com.emc.storageos.datadomain.restapi.model.DDExportClientModify in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method ddBuildModifyExportClientList.
private List<DDExportClientModify> ddBuildModifyExportClientList(FSExportMap exportMap, FileExport fileExport) {
List<DDExportClientModify> ddExportClients = new ArrayList<>();
String options = ddSetExportOptions(fileExport);
// Add clients from the new export
List<String> addClients = fileExport.getClients();
// Remove clients not in the new export
List<String> removeClients = new ArrayList<>();
List<String> oldClients = exportMap.get(fileExport.getFileExportKey()).getClients();
for (String oldClient : oldClients) {
if (!addClients.contains(oldClient)) {
removeClients.add(oldClient);
}
}
// Add new clients
for (String client : addClients) {
ddExportClients.add(new DDExportClientModify(client, options, false));
}
// Remove old clients no more in the list
for (String client : removeClients) {
ddExportClients.add(new DDExportClientModify(client, options, true));
}
return (ddExportClients);
}
Aggregations