Search in sources :

Example 21 with StorageSystemRestRep

use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.

the class StorageSystemService method getStorageSystem.

/**
 * Get information about the registered storage system with the passed id.
 *
 * @param id the URN of a ViPR storage system.
 *
 * @brief Show storage system
 * @return A reference to a StorageSystemRestRep
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemRestRep getStorageSystem(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
    StorageSystem system = queryResource(id);
    StorageSystemRestRep restRep = map(system);
    restRep.setNumResources(getNumResources(system, _dbClient));
    return restRep;
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 22 with StorageSystemRestRep

use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.

the class BlockProvider method getApplicationSnapshotVirtualArrays.

@Asset("applicationSnapshotVirtualArray")
@AssetDependencies("application")
public List<AssetOption> getApplicationSnapshotVirtualArrays(AssetOptionsContext ctx, URI applicationId) {
    final ViPRCoreClient client = api(ctx);
    List<NamedRelatedResourceRep> volList = client.application().listVolumes(applicationId);
    List<AssetOption> options = new ArrayList<AssetOption>();
    boolean isVplex = false;
    boolean isRP = false;
    URI sourceVarrayId = null;
    List<VolumeRestRep> allRPSourceVols = null;
    if (volList != null && !volList.isEmpty()) {
        VolumeRestRep vol = client.blockVolumes().get(volList.get(0));
        StorageSystemRestRep sys = client.storageSystems().get(vol.getStorageController());
        if (sys.getSystemType().equals("vplex")) {
            isVplex = true;
            sourceVarrayId = vol.getVirtualArray().getId();
        }
        if (BlockProviderUtils.isVolumeRP(vol)) {
            isRP = true;
            allRPSourceVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.SOURCE);
            if (allRPSourceVols != null && !allRPSourceVols.isEmpty()) {
                VolumeRestRep rpvol = allRPSourceVols.get(0);
                sourceVarrayId = rpvol.getVirtualArray().getId();
            }
        }
    } else {
        return options;
    }
    // if it's neither RP nor vplex, it's just a simple block volume application; site is not needed
    if (!isVplex && !isRP) {
        options.add(newAssetOption(URI.create("none"), "None"));
    }
    // if the volumes are vplex or RP display source as an option
    if (isVplex || isRP) {
        options.add(newAssetOption(sourceVarrayId, "protection.site.type.source"));
    }
    // if the volumes are RP (vplex or not) add the RP targets as options
    if (isRP) {
        Set<URI> targetVarrayIds = new HashSet<URI>();
        List<AssetOption> targetOptions = new ArrayList<AssetOption>();
        List<VolumeRestRep> allRPTargetVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.TARGET);
        for (VolumeRestRep targetVol : allRPTargetVols) {
            targetVarrayIds.add(targetVol.getVirtualArray().getId());
        }
        List<VirtualArrayRestRep> targetVarrays = client.varrays().getByIds(targetVarrayIds);
        for (VirtualArrayRestRep targetVarray : targetVarrays) {
            targetOptions.add(newAssetOption(String.format("tgt:%s", targetVarray.getId().toString()), "protection.site.type.target", targetVarray.getName()));
        }
        // sort the targets
        AssetOptionsUtils.sortOptionsByLabel(targetOptions);
        options.addAll(targetOptions);
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 23 with StorageSystemRestRep

use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.

the class DiscoverUnmanagedVolumesService method execute.

@Override
public void execute() throws Exception {
    List<URI> uris = uris(storageSystems);
    List<StorageSystemRestRep> systemRestReps = execute(new GetStorageSystems(uris));
    // remove any VPLEX systems and add them back at the end of the systems list
    List<StorageSystemRestRep> vplexSystems = new ArrayList<StorageSystemRestRep>();
    Iterator<StorageSystemRestRep> it = systemRestReps.iterator();
    while (it.hasNext()) {
        StorageSystemRestRep system = it.next();
        if (BlockProviderUtils.isVplex(system)) {
            vplexSystems.add(system);
            it.remove();
        }
    }
    systemRestReps.addAll(vplexSystems);
    for (StorageSystemRestRep storageSystem : systemRestReps) {
        logInfo("discover.unmanaged.volume.service.discovering", storageSystem.getName());
        execute(new DiscoverUnmanagedVolumes(storageSystem.getId().toString()));
        int postCount = countUnmanagedVolumes(storageSystem.getId().toString());
        logInfo("discover.unmanaged.volume.service.discovered", postCount, storageSystem.getName());
    }
    List<ProtectionSystemRestRep> protectionSystemRestReps = execute(new GetProtectionSystems());
    for (ProtectionSystemRestRep protectionSystem : protectionSystemRestReps) {
        logInfo("discover.unmanaged.volume.service.discoveringcgs", protectionSystem.getName());
        execute(new DiscoverUnmanagedCGs(protectionSystem.getId().toString(), DiscoverUnmanagedCGs.UnmanagedNamespace.UNMANAGED_CGS));
        logInfo("discover.unmanaged.volume.service.discoveredcgs", protectionSystem.getName());
    }
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) GetStorageSystems(com.emc.sa.service.vipr.tasks.GetStorageSystems) ArrayList(java.util.ArrayList) DiscoverUnmanagedVolumes(com.emc.sa.service.vipr.block.tasks.DiscoverUnmanagedVolumes) GetProtectionSystems(com.emc.sa.service.vipr.tasks.GetProtectionSystems) URI(java.net.URI) ProtectionSystemRestRep(com.emc.storageos.model.protection.ProtectionSystemRestRep) DiscoverUnmanagedCGs(com.emc.sa.service.vipr.tasks.DiscoverUnmanagedCGs)

Example 24 with StorageSystemRestRep

use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method createAllFlash.

public static void createAllFlash() {
    // This method should only list available storage type discovered
    Set<String> typesList = new HashSet<String>();
    JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
    JsonArray storage_systems = dataObject.getAsJsonArray(STORAGE_SYSTEMS);
    if (storage_systems != null) {
        for (Object storageobject : storage_systems) {
            JsonObject storage = (JsonObject) storageobject;
            String storageid = storage.get("id").getAsString();
            StorageSystemRestRep storagesys = StorageSystemUtils.getStorageSystem(storageid);
            if (storagesys != null && !storagesys.getRegistrationStatus().equals("UNREGISTERED")) {
                typesList.add(storagesys.getSystemType());
            }
        }
    }
    renderArgs.put("types", typesList);
    render();
}
Also used : JsonArray(com.google.gson.JsonArray) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) HashSet(java.util.HashSet)

Example 25 with StorageSystemRestRep

use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.

the class StorageSystems method edit.

@FlashException("list")
public static void edit(String id) {
    addReferenceData();
    StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
    if (storageSystem != null) {
        StorageSystemForm storageArray = new StorageSystemForm(storageSystem);
        if (storageArray.type.equals(SCALEIO)) {
            renderArgs.put("storageArrayTypeList", StorageProviderTypes.getProviderOption());
        }
        if (storageArray.type.equals("xtremio")) {
            renderArgs.put("storageArrayTypeList", StorageProviderTypes.getProviderOption());
        }
        if (storageArray.unregistered) {
            flash.put("warning", MessagesUtils.get(NOT_REGISTERED, storageArray.name));
        }
        if (storageArray.type.equals(VMAX)) {
            @SuppressWarnings("unchecked") List<StringOption> options = (List<StringOption>) renderArgs.get("storageArrayTypeList");
            options.add(new StringOption(VMAX, MessagesUtils.get(SMIS_VMAX)));
            @SuppressWarnings("unchecked") List<StringOption> smisOptions = (List<StringOption>) renderArgs.get("smisStorageSystemTypeList");
            smisOptions.add(new StringOption(VMAX, MessagesUtils.get(SMIS_VMAX)));
        }
        render(storageArray);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : StringOption(util.StringOption) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) List(java.util.List) ArrayList(java.util.ArrayList) FlashException(controllers.util.FlashException)

Aggregations

StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)44 URI (java.net.URI)11 ArrayList (java.util.ArrayList)10 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)7 HashSet (java.util.HashSet)7 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)6 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)5 Asset (com.emc.sa.asset.annotation.Asset)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)3 StorageProviderRestRep (com.emc.storageos.model.smis.StorageProviderRestRep)3 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 HashMap (java.util.HashMap)3 GetStorageSystems (com.emc.sa.service.vipr.tasks.GetStorageSystems)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)2