use of com.emc.storageos.model.systems.StorageSystemRestRep 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.systems.StorageSystemRestRep 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.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathStorageSystem.
@SuppressWarnings("incomplete-switch")
@Asset("exportPathStorageSystem")
@AssetDependencies({ "exportPathExport" })
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx, URI exportId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
List<URI> storageSystemIds = new ArrayList<URI>();
ExportGroupRestRep export = client.blockExports().get(exportId);
List<ExportBlockParam> volumes = export.getVolumes();
for (ExportBlockParam volume : volumes) {
URI resourceId = volume.getId();
ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
switch(volumeType) {
case VOLUME:
VolumeRestRep v = client.blockVolumes().get(resourceId);
if (v != null) {
storageSystemIds.add(v.getStorageController());
}
break;
case BLOCK_SNAPSHOT:
BlockSnapshotRestRep s = client.blockSnapshots().get(resourceId);
if (s != null) {
storageSystemIds.add(s.getStorageController());
}
break;
}
}
List<StorageSystemRestRep> storageSystems = client.storageSystems().getByIds(storageSystemIds);
for (StorageSystemRestRep storageSystem : storageSystems) {
String systemType = storageSystem.getSystemType();
if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
}
}
return options;
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathStorageSystem.
@Asset("exportPathStorageSystem")
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
List<StorageSystemRestRep> storageSystems = client.storageSystems().getAll();
for (StorageSystemRestRep storageSystem : storageSystems) {
String systemType = storageSystem.getSystemType();
if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
}
}
return options;
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class GetMobilityGroupVolumesByHost method executeTask.
@Override
public Set<URI> executeTask() throws Exception {
Set<URI> mobilityGroupVolumes = Sets.newHashSet();
Set<URI> volumes = getHostExportedVolumes();
for (URI volume : volumes) {
VolumeRestRep vol = getClient().blockVolumes().get(volume);
StorageSystemRestRep storage = getClient().storageSystems().get(vol.getStorageController());
if (BlockStorageUtils.isVplexVolume(vol, storage.getSystemType())) {
mobilityGroupVolumes.add(volume);
}
}
return mobilityGroupVolumes;
}
Aggregations