Search in sources :

Example 11 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method checkDisconnectedStoragePools.

public static void checkDisconnectedStoragePools(@As(",") String[] ids) {
    List<BlockVirtualPoolRestRep> virtualpools = VirtualPoolUtils.getBlockVirtualPools();
    Set<String> connectedstoragepools = new HashSet<String>();
    List<String> failedArrays = new ArrayList<String>();
    for (BlockVirtualPoolRestRep virtualpool : virtualpools) {
        if (virtualpool.getUseMatchedPools()) {
            for (RelatedResourceRep pool : virtualpool.getMatchedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        } else {
            for (RelatedResourceRep pool : virtualpool.getAssignedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        }
    }
    for (String id : ids) {
        StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
        if (storageSystem != null && !storageSystem.getRegistrationStatus().equals("UNREGISTERED")) {
            boolean found = false;
            List<StoragePoolRestRep> storagepools = StoragePoolUtils.getStoragePools(id);
            for (StoragePoolRestRep storagepool : storagepools) {
                if (connectedstoragepools.contains(storagepool.getId().toString())) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                failedArrays.add(storageSystem.getName());
            }
        }
    }
    renderJSON(failedArrays);
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) HashSet(java.util.HashSet)

Example 12 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class VirtualArrays method storagePoolsJson.

/**
 * Renders the list of storage pools for a given virtual array as JSON.
 *
 * @param id
 *            the virtual array ID.
 */
public static void storagePoolsJson(String id) {
    List<StoragePoolInfo> items = Lists.newArrayList();
    CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
    for (StoragePoolRestRep storagePool : StoragePoolUtils.getStoragePoolsAssignedToVirtualArray(id)) {
        StoragePoolInfo item = new StoragePoolInfo(storagePool, storageSystems);
        item.assigned = VirtualArrayUtils.isAssigned(storagePool, id);
        items.add(item);
    }
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : StoragePoolInfo(models.datatable.StoragePoolDataTable.StoragePoolInfo) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep)

Example 13 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method createBaseVPool.

private static void createBaseVPool(String vpoolName, String storageType, List<String> virtualarrayIds, String vpdesc, JsonArray vpools) {
    BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
    // defaults
    vpool.provisioningType = ProvisioningTypes.THIN;
    vpool.protocols = Sets.newHashSet(BlockProtocols.FC);
    vpool.minPaths = 1;
    vpool.maxPaths = 1;
    vpool.initiatorPaths = 1;
    vpool.expandable = true;
    vpool.rpJournalSizeUnit = SizeUnit.x;
    vpool.rpJournalSize = RPCopyForm.JOURNAL_DEFAULT_MULTIPLIER;
    vpool.rpRpoValue = Long.valueOf(25);
    vpool.rpRpoType = RpoType.SECONDS;
    vpool.protectSourceSite = true;
    vpool.enableAutoCrossConnExport = true;
    vpool.poolAssignment = PoolAssignmentTypes.AUTOMATIC;
    vpool.maxSnapshots = 10;
    vpool.name = vpoolName;
    vpool.systemType = storageType;
    vpool.virtualArrays = virtualarrayIds;
    vpool.description = vpdesc;
    vpool.enableCompression = false;
    // Check if creating a vmax AFA virtual pool, need to set auto-tiering
    if (StringUtils.equals(VMAX, storageType)) {
        vpool.uniqueAutoTierPolicyNames = true;
        boolean isAutoTier = false;
        AutoTierPolicyNamesCall auto_tiering = vpool.autoTierPolicyNames();
        List<String> autoPolicyList = auto_tiering.call();
        for (String policy : autoPolicyList) {
            if (StringUtils.equals(DEFAULT_AUTO_TIER, policy)) {
                vpool.autoTierPolicy = policy;
                isAutoTier = true;
                break;
            }
        }
        if (!isAutoTier) {
            // This means we did not find the pattern, set random
            for (String policy : autoPolicyList) {
                vpool.autoTierPolicy = policy;
                break;
            }
        }
        for (String virtualArrayId : virtualarrayIds) {
            List<StoragePoolRestRep> spList = StoragePoolUtils.getStoragePoolsAssignedToVirtualArray(virtualArrayId);
            for (StoragePoolRestRep sp : spList) {
                if (sp.getCompressionEnabled() != null && sp.getCompressionEnabled()) {
                    vpool.enableCompression = true;
                    // rename with compression enable
                    vpool.name = VP_VMAX_DIAMOND_COMPRESSED;
                    break;
                }
            }
            if (vpool.enableCompression) {
                break;
            }
        }
    }
    BlockVirtualPoolRestRep vpoolTask = vpool.save();
    if (vpoolTask != null) {
        buildVpoolCookies(vpoolTask.getId().toString(), vpool.name, vpools);
    }
}
Also used : AutoTierPolicyNamesCall(jobs.vipr.AutoTierPolicyNamesCall) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) BlockVirtualPoolForm(models.virtualpool.BlockVirtualPoolForm)

Example 14 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method listStoragePoolsbyIdJson.

public static void listStoragePoolsbyIdJson(String id) {
    BlockVirtualPoolRestRep virtualPool = VirtualPoolUtils.getBlockVirtualPool(id);
    if (virtualPool == null) {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        backToReferrer();
    }
    BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
    vpool.load(virtualPool);
    List<StoragePoolInfo> items = Lists.newArrayList();
    if (vpool != null && vpool.protocols != null && !vpool.protocols.isEmpty()) {
        vpool.deserialize();
        Map<URI, String> storageSystemNames = StorageSystemUtils.getStorageSystemNames();
        List<StoragePoolRestRep> pools = getMatchingStoragePools(vpool);
        for (StoragePoolRestRep pool : pools) {
            String storageSystemName = storageSystemNames.get(id(pool.getStorageSystem()));
            items.add(new StoragePoolInfo(pool, storageSystemName));
        }
    }
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : StoragePoolInfo(models.datatable.StoragePoolDataTable.StoragePoolInfo) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) URI(java.net.URI) BlockVirtualPoolForm(models.virtualpool.BlockVirtualPoolForm)

Example 15 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep 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)

Aggregations

StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)17 StoragePoolInfo (models.datatable.StoragePoolDataTable.StoragePoolInfo)7 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 URI (java.net.URI)5 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 BlockVirtualPoolForm (models.virtualpool.BlockVirtualPoolForm)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StringMapAdapter (com.emc.storageos.model.adapters.StringMapAdapter)1 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)1 StoragePoolBulkRep (com.emc.storageos.model.pools.StoragePoolBulkRep)1 StoragePoolUpdate (com.emc.storageos.model.pools.StoragePoolUpdate)1 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)1 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)1 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 Task (com.emc.vipr.client.Task)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 IdFilter (com.emc.vipr.client.core.filters.IdFilter)1 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)1