use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class VirtualArrays method storagePortsJson.
/**
* Renders the list of storage ports for a given virtual array as JSON.
*
* @param id
* the virtual array ID.
*/
public static void storagePortsJson(String id) {
List<StoragePortInfo> items = Lists.newArrayList();
CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
List<StoragePortRestRep> storagePorts = StoragePortUtils.getStoragePortsByVirtualArray(uri(id));
Map<URI, String> networks = NetworkUtils.getNetworkNamesByVirtualArray(id);
for (StoragePortRestRep storagePort : storagePorts) {
StoragePortInfo item = new StoragePortInfo(storagePort, storageSystems.get(storagePort.getStorageDevice()));
item.assigned = VirtualArrayUtils.isAssigned(storagePort, id);
item.network = networks.get(id(storagePort.getNetwork()));
items.add(item);
}
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class VirtualArrays method availableStoragePortsJson.
/**
* Renders the list of storage ports that are available to be assigned to the given virtual array.
*
* @param id
* the virtual array ID.
*/
public static void availableStoragePortsJson(String id) {
List<StoragePortInfo> items = Lists.newArrayList();
CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
Map<URI, String> networks = NetworkUtils.getNetworkNames();
List<StoragePortRestRep> storagePorts = StoragePortUtils.getStoragePortsAssignableToVirtualArray(uri(id));
for (StoragePortRestRep storagePort : storagePorts) {
StoragePortInfo item = new StoragePortInfo(storagePort, storageSystems.get(storagePort.getStorageDevice()));
item.network = networks.get(id(storagePort.getNetwork()));
items.add(item);
}
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.ports.StoragePortRestRep 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);
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class Networks method endpointsJson.
/**
* Creates and renders JSON datatable source for endpoints for the given network.
*
* @param networkId
* the network ID.
*/
public static void endpointsJson(String networkId) {
NetworkRestRep network = NetworkUtils.getNetwork(networkId);
if (network == null) {
error(MessagesUtils.get(UNKNOWN, networkId));
}
List<EndpointInfo> items = Lists.newArrayList();
// All known endpoints, remove endpoints from storage systems and hosts to get manual endpoints
Set<String> endpoints = Sets.newTreeSet(new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.compareToIgnoreCase(s2);
}
});
endpoints.addAll(network.getEndpoints());
// Add ports from storage systems
CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
for (StoragePortRestRep storagePort : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
items.add(new EndpointInfo(storagePort, storageSystems));
for (String endpoint : NetworkUtils.getEndPoints(storagePort)) {
endpoints.remove(endpoint);
}
}
// Add ports from hosts
CachedResources<HostRestRep> hosts = HostUtils.createCache();
for (InitiatorRestRep initiator : NetworkUtils.getInitiators(network.getId())) {
if (initiator.getHost() != null) {
items.add(new EndpointInfo(initiator, hosts));
endpoints.remove(NetworkUtils.getEndPoint(initiator));
}
}
for (IpInterfaceRestRep ipInterface : NetworkUtils.getIpInterfaces(network.getId())) {
if (ipInterface.getHost() != null) {
items.add(new EndpointInfo(ipInterface, hosts));
endpoints.remove(NetworkUtils.getEndPoint(ipInterface));
}
}
// Add any remaining endpoints as 'manual'
for (String endpoint : endpoints) {
items.add(new EndpointInfo(endpoint));
}
setEndpointAttrs(network, items);
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.ports.StoragePortRestRep in project coprhd-controller by CoprHD.
the class StorageSystems method savePort.
@FlashException(keep = true, referrer = { "ports" })
public static void savePort(StorageArrayPortForm storageArrayPort) {
storageArrayPort.validate("storageArrayPort");
if (Validation.hasErrors()) {
Common.handleError();
}
StoragePortRestRep port = storageArrayPort.save();
flash.success(MessagesUtils.get(SAVED_POOL, port.getPortName()));
ports(stringId(port.getStorageDevice()));
}
Aggregations