Search in sources :

Example 16 with StoragePortRestRep

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));
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) StoragePortInfo(models.datatable.StoragePortDataTable.StoragePortInfo) URI(java.net.URI)

Example 17 with StoragePortRestRep

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));
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) StoragePortInfo(models.datatable.StoragePortDataTable.StoragePortInfo) URI(java.net.URI)

Example 18 with StoragePortRestRep

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);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Example 19 with StoragePortRestRep

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));
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 20 with StoragePortRestRep

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()));
}
Also used : StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) FlashException(controllers.util.FlashException)

Aggregations

StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)22 URI (java.net.URI)8 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)7 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)5 NetworkRestRep (com.emc.storageos.model.varray.NetworkRestRep)4 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 StoragePortInfo (models.datatable.StoragePortDataTable.StoragePortInfo)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)2 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)2 StoragePortList (com.emc.storageos.model.ports.StoragePortList)2 StoragePortUpdate (com.emc.storageos.model.ports.StoragePortUpdate)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 FlashException (controllers.util.FlashException)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 EndpointInfo (models.datatable.NetworkEndpointDataTable.EndpointInfo)2 Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 SnapshotList (com.emc.storageos.model.SnapshotList)1