use of com.emc.storageos.model.project.VirtualNasParam in project coprhd-controller by CoprHD.
the class StorageSystems method dissociateProject.
@FlashException(keep = true, referrer = { "virtualNasServers" })
public static void dissociateProject(@As(",") String[] projectIdsToDissociate, String nasIds, String storageId) {
if (projectIdsToDissociate != null && projectIdsToDissociate.length > 0) {
for (String projectId : projectIdsToDissociate) {
Set<String> vNASSet = new HashSet<String>();
vNASSet.add(nasIds);
VirtualNasParam vNasParam = new VirtualNasParam();
vNasParam.setVnasServers(vNASSet);
getViprClient().virtualNasServers().unassignVnasServers(uri(projectId), vNasParam);
}
}
virtualNasServers(storageId);
}
use of com.emc.storageos.model.project.VirtualNasParam in project coprhd-controller by CoprHD.
the class StorageSystems method associateProject.
@FlashException(keep = true, referrer = { "virtualNasServers" })
public static void associateProject(String nasIds, String projectIds, String storageId) throws Exception {
boolean error = false;
Set<String> vnasServers = new TreeSet<String>();
String[] projectIdArray = null;
if (nasIds != null && !nasIds.isEmpty()) {
String[] nasArray = nasIds.split(",");
Collections.addAll(vnasServers, nasArray);
}
if (projectIds != null && !projectIds.isEmpty()) {
projectIds = projectIds.trim();
projectIdArray = projectIds.split(",");
}
VirtualNasParam vNasParam = new VirtualNasParam();
vNasParam.setVnasServers(vnasServers);
if (projectIdArray != null && projectIdArray.length > 0) {
for (int i = 0; i < projectIdArray.length; i++) {
try {
getViprClient().virtualNasServers().assignVnasServers(uri(projectIdArray[i].trim()), vNasParam);
} catch (Exception e) {
error = true;
continue;
}
}
if (error) {
String errorMsg = "Some Virtual NAS servers could not be associated with selected project(s). Please check the API logs for more information.";
throw new Exception(errorMsg);
}
}
virtualNasServers(storageId);
}
Aggregations