Search in sources :

Example 36 with StoragePool

use of com.emc.storageos.db.client.model.StoragePool in project coprhd-controller by CoprHD.

the class AbstractBlockServiceApiImpl method verifyVolumeExpansionRequest.

/**
 * {@inheritDoc}
 */
@Override
public void verifyVolumeExpansionRequest(Volume volume, long newSize) {
    // Expansion is not supported in this case.
    if (isMetaVolumeWithMirrors(volume)) {
        throw APIException.badRequests.expansionNotSupportedForMetaVolumesWithMirrors();
    }
    // @TODO remove this condition when we add full support for thick volume expansion.
    if (isHitachiVolume(volume) && !volume.getThinlyProvisioned()) {
        throw APIException.badRequests.expansionNotSupportedForHitachThickVolumes();
    }
    // Expansion is not supported in this case.
    if (isHitachiVolume(volume) && !isHitachiVolumeExported(volume) && !volume.getThinlyProvisioned()) {
        throw APIException.badRequests.expansionNotSupportedForHitachiVolumesNotExported();
    }
    // forming a meta volume is not supported.
    if (expansionResultsInMetaWithMirrors(volume)) {
        throw APIException.badRequests.cannotExpandMirrorsUsingMetaVolumes();
    }
    // Extension of volumes in VNX Unified storage pools can be done only as
    // regular volumes (meta extension is not supported)
    // For VNX Unified pool volumes, check that volume new size is within
    // max volume size limit of its storage pool.
    long maxVolumeSizeLimitKB = getMaxVolumeSizeLimit(volume);
    StoragePool storagePool = _permissionsHelper.getObjectById(volume.getPool(), StoragePool.class);
    if (StoragePool.PoolClassNames.Clar_UnifiedStoragePool.name().equalsIgnoreCase(storagePool.getPoolClassName())) {
        // COP-30564 : Check only expansion size against maxVolumeSizeLimit, not total volume size after expansion (this is
        // specific to VNX arrays implementation).
        Long expansionSize = newSize - volume.getCapacity() > 0 ? newSize - volume.getCapacity() : 0;
        Long expansionSizeKB = (expansionSize % 1024 == 0) ? expansionSize / 1024 : expansionSize / 1024 + 1;
        if (expansionSizeKB > maxVolumeSizeLimitKB) {
            s_logger.info("VNX volume can not be expanded --- expansion size request {} exceeds maximum volume size limit in the pool {} . ", expansionSizeKB, maxVolumeSizeLimitKB);
            throw APIException.badRequests.invalidVolumeSize(newSize, maxVolumeSizeLimitKB);
        }
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool)

Example 37 with StoragePool

use of com.emc.storageos.db.client.model.StoragePool in project coprhd-controller by CoprHD.

the class BlockVirtualPoolService method getMatchingPoolsForVirtualPoolAttributes.

/**
 * Return the matching pools for a given set of VirtualPool attributes.
 * This API is useful for user to find the matching pools before creating a VirtualPool.
 *
 * @prereq none
 * @param param : VirtualPoolAttributeParam
 * @brief List matching pools for virtual pool properties
 * @return matching pools.
 */
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/matching-pools")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public StoragePoolList getMatchingPoolsForVirtualPoolAttributes(BlockVirtualPoolParam param) {
    StoragePoolList poolList = new StoragePoolList();
    Map<URI, VpoolRemoteCopyProtectionSettings> remoteSettingsMap = new HashMap<URI, VpoolRemoteCopyProtectionSettings>();
    List<VpoolProtectionVarraySettings> protectionSettings = new ArrayList<VpoolProtectionVarraySettings>();
    Map<URI, VpoolProtectionVarraySettings> protectionSettingsMap = new HashMap<URI, VpoolProtectionVarraySettings>();
    VirtualPool vpool = prepareVirtualPool(param, remoteSettingsMap, protectionSettingsMap, protectionSettings);
    List<URI> storagePoolURIs = _dbClient.queryByType(StoragePool.class, true);
    List<StoragePool> allPools = _dbClient.queryObject(StoragePool.class, storagePoolURIs);
    StringBuffer errorMessage = new StringBuffer();
    List<StoragePool> matchedPools = ImplicitPoolMatcher.getMatchedPoolWithStoragePools(vpool, allPools, protectionSettingsMap, remoteSettingsMap, null, _dbClient, _coordinator, AttributeMatcher.VPOOL_MATCHERS, errorMessage);
    for (StoragePool pool : matchedPools) {
        poolList.getPools().add(toNamedRelatedResource(pool, pool.getNativeGuid()));
    }
    return poolList;
}
Also used : StoragePoolList(com.emc.storageos.model.pools.StoragePoolList) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StoragePool(com.emc.storageos.db.client.model.StoragePool) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPoolMapper.toBlockVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toBlockVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 38 with StoragePool

use of com.emc.storageos.db.client.model.StoragePool in project coprhd-controller by CoprHD.

the class FilePolicyService method getAssociatedStorageSystemsByVPool.

private List<URI> getAssociatedStorageSystemsByVPool(VirtualPool vpool) {
    Set<URI> storageSystemURISet = new HashSet<URI>();
    StringSet storagePoolURISet = null;
    if (vpool.getUseMatchedPools()) {
        storagePoolURISet = vpool.getMatchedStoragePools();
    } else {
        storagePoolURISet = vpool.getAssignedStoragePools();
    }
    if (storagePoolURISet != null && !storagePoolURISet.isEmpty()) {
        for (Iterator<String> iterator = storagePoolURISet.iterator(); iterator.hasNext(); ) {
            URI storagePoolURI = URI.create(iterator.next());
            StoragePool spool = _dbClient.queryObject(StoragePool.class, storagePoolURI);
            if (spool != null && !spool.getInactive()) {
                storageSystemURISet.add(spool.getStorageDevice());
            }
        }
    }
    return new ArrayList<URI>(storageSystemURISet);
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StringSet(com.emc.storageos.db.client.model.StringSet) ArrayList(java.util.ArrayList) URI(java.net.URI) HashSet(java.util.HashSet)

Example 39 with StoragePool

use of com.emc.storageos.db.client.model.StoragePool in project coprhd-controller by CoprHD.

the class PlacementTests method testPlacementRpXIONoVplex.

/**
 * RP placement tests with XIO (no VPLEX)
 */
@Test
public void testPlacementRpXIONoVplex() {
    String[] xio1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] xio2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] xio3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] xio4FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] xio5FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] xio6FE = { "55:FE:FE:FE:FE:FE:FE:00", "55:FE:FE:FE:FE:FE:FE:01" };
    String[] rp1FE = { "56:FE:FE:FE:FE:FE:FE:00", "56:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "57:FE:FE:FE:FE:FE:FE:00", "57:FE:FE:FE:FE:FE:FE:01" };
    // Create 2 Virtual Arrays
    VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(varray1.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, rp1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    connVA = new StringSet();
    connVA.add(varray2.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, rp2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    // Create 6 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio3");
    StorageSystem storageSystem4 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio4");
    StorageSystem storageSystem5 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio5");
    StorageSystem storageSystem6 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio6");
    // Create two front-end storage ports XIO1
    List<StoragePort> xio1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio1FE.length; i++) {
        xio1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network1, xio1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio1" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports XIO2
    List<StoragePort> xio2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio2FE.length; i++) {
        xio2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network1, xio2FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio2" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports XIO3
    List<StoragePort> xio3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio3FE.length; i++) {
        xio3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network1, xio3FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1xio3" + i, "E0+FC0" + i));
    }
    // Create two front-end storage ports XIO4
    List<StoragePort> xio4Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio4FE.length; i++) {
        xio4Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem4, network2, xio4FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio4" + i, "F0+FC0" + i));
    }
    // Create two front-end storage ports XIO5
    List<StoragePort> xio5Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio5FE.length; i++) {
        xio5Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem5, network2, xio5FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio5" + i, "G0+FC0" + i));
    }
    // Create two front-end storage ports XIO6
    List<StoragePort> xio6Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio6FE.length; i++) {
        xio6Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem6, network2, xio6FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2xio6" + i, "H0+FC0" + i));
    }
    // Create RP system
    AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
    for (int i = 0; i < rp1FE.length; i++) {
        wwnSite1.add(rp1FE[i]);
    }
    StringSetMap initiatorsSiteMap = new StringSetMap();
    initiatorsSiteMap.put("site1", wwnSite1);
    AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
    for (int i = 0; i < rp2FE.length; i++) {
        wwnSite2.add(rp2FE[i]);
    }
    initiatorsSiteMap.put("site2", wwnSite2);
    StringSet storSystems = new StringSet();
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem1.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem2.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", storageSystem3.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem4.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem5.getSerialNumber()));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", storageSystem6.getSerialNumber()));
    StringMap siteVolCap = new StringMap();
    siteVolCap.put("site1", "3221225472");
    siteVolCap.put("site2", "3221225472");
    StringMap siteVolCnt = new StringMap();
    siteVolCnt.put("site1", "10");
    siteVolCnt.put("site2", "10");
    ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", null, "IP", initiatorsSiteMap, storSystems, null, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
    // RP Site Array objects
    RPSiteArray rpSiteArray1 = new RPSiteArray();
    rpSiteArray1.setId(URI.create("rsa1"));
    rpSiteArray1.setStorageSystem(URI.create("xtremio1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("xtremio2"));
    rpSiteArray2.setRpInternalSiteName("site1");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    RPSiteArray rpSiteArray3 = new RPSiteArray();
    rpSiteArray3.setId(URI.create("rsa3"));
    rpSiteArray3.setStorageSystem(URI.create("xtremio3"));
    rpSiteArray3.setRpInternalSiteName("site1");
    rpSiteArray3.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray3);
    RPSiteArray rpSiteArray4 = new RPSiteArray();
    rpSiteArray4.setId(URI.create("rsa4"));
    rpSiteArray4.setStorageSystem(URI.create("xtremio4"));
    rpSiteArray4.setRpInternalSiteName("site2");
    rpSiteArray4.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray4);
    RPSiteArray rpSiteArray5 = new RPSiteArray();
    rpSiteArray5.setId(URI.create("rsa5"));
    rpSiteArray5.setStorageSystem(URI.create("xtremio5"));
    rpSiteArray5.setRpInternalSiteName("site2");
    rpSiteArray5.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray5);
    RPSiteArray rpSiteArray6 = new RPSiteArray();
    rpSiteArray6.setId(URI.create("rsa6"));
    rpSiteArray6.setStorageSystem(URI.create("xtremio6"));
    rpSiteArray6.setRpInternalSiteName("site2");
    rpSiteArray6.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray6);
    // Create a storage pool for xio1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for xio2
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem2, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for xio3
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem3, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for xio4
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem4, "pool4", "Pool4", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for xio5
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem5, "pool5", "Pool5", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for xio6
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem6, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a RP virtual pool
    VirtualPool rpVpool = new VirtualPool();
    rpVpool.setId(URI.create("rpVpool"));
    rpVpool.setLabel("rpVpool");
    rpVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpVpool.setDriveType(SupportedDriveTypes.FC.name());
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(URI.create("vpool"));
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(varray2.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpVpool.setProtectionVarraySettings(protectionVarray);
    rpVpool.setRpCopyMode("SYNCHRONOUS");
    rpVpool.setRpRpoType("MINUTES");
    rpVpool.setRpRpoValue(Long.valueOf("5"));
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    rpVpool.setMatchedStoragePools(matchedPools);
    rpVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(varray1.getId().toString());
    rpVpool.setVirtualArrays(virtualArrays1);
    _dbClient.createObject(rpVpool);
    // Create a virtual pool
    VirtualPool vpool = new VirtualPool();
    vpool.setId(URI.create("vpool"));
    vpool.setLabel("vpool");
    vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vpool.setDriveType(SupportedDriveTypes.FC.name());
    matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    vpool.setMatchedStoragePools(matchedPools);
    vpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(varray2.getId().toString());
    vpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(vpool);
    // Create Tenant
    TenantOrg tenant = new TenantOrg();
    tenant.setId(URI.create("tenant"));
    _dbClient.createObject(tenant);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create block consistency group
    BlockConsistencyGroup cg = new BlockConsistencyGroup();
    cg.setProject(new NamedURI(project.getId(), project.getLabel()));
    cg.setId(URI.create("blockCG"));
    _dbClient.createObject(cg);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, cg);
    // Run single volume placement: Run 10 times to make sure pool3 never comes up for source and pool6 for target.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray1, project, rpVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceRecommendations());
        assertTrue(!rec.getSourceRecommendations().isEmpty());
        assertNotNull(rec.getProtectionDevice());
        assertNotNull(rec.getPlacementStepsCompleted().name());
        assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
        for (RPRecommendation sourceRec : rec.getSourceRecommendations()) {
            assertNotNull(sourceRec);
            assertNotNull(sourceRec.getInternalSiteName());
            assertNotNull(sourceRec.getSourceStorageSystem());
            assertNotNull(sourceRec.getSourceStoragePool());
            assertTrue(sourceRec.getVirtualArray().toString().equals("varray1"));
            assertTrue("site1".equals(sourceRec.getInternalSiteName()));
            assertTrue("xtremio2".equals(sourceRec.getSourceStorageSystem().toString()));
            assertTrue(("pool2".equals(sourceRec.getSourceStoragePool().toString())) || ("pool1".equals(sourceRec.getSourceStoragePool().toString())));
            assertNotNull(sourceRec.getTargetRecommendations());
            assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getSourceStoragePool());
                assertTrue("xtremio4".equals(targetRec.getSourceStorageSystem().toString()));
                assertTrue("site2".equals(targetRec.getInternalSiteName()));
                assertTrue(targetRec.getVirtualArray().toString().equals("varray2"));
                assertTrue("pool4".equals(targetRec.getSourceStoragePool().toString()) || "pool5".equals(targetRec.getSourceStoragePool().toString()));
            }
        }
        // source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
        assertTrue(("pool2".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
        // target journal
        assertNotNull(rec.getTargetJournalRecommendations());
        assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec.getSourceStoragePool());
            assertTrue(targetJournalRec.getVirtualArray().toString().equals("varray2"));
            assertTrue("pool4".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool5".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool6".equals(targetJournalRec.getSourceStoragePool().toString()));
            assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
            assertTrue("xtremio4".equals(targetJournalRec.getSourceStorageSystem().toString()) || "xtremio5".equals(targetJournalRec.getSourceStorageSystem().toString()) || "xtremio6".equals(targetJournalRec.getSourceStorageSystem().toString()));
        }
        _log.info(rec.toString(_dbClient));
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 40 with StoragePool

use of com.emc.storageos.db.client.model.StoragePool in project coprhd-controller by CoprHD.

the class PlacementTests method testPlacementBlock.

/**
 * Simple block placement. Give block two pools of different capacities.
 * Request a single volume, ensure you get the bigger pool as a recommendation.
 */
@Test
public void testPlacementBlock() {
    // Create a Virtual Array
    VirtualArray varray = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    // Create a storage system
    StorageSystem storageSystem = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "storageSystem1");
    // Create a storage pool
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a virtual pool
    VirtualPool vpool = new VirtualPool();
    vpool.setId(URI.create("vpool"));
    vpool.setLabel("vpool");
    vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    vpool.setMatchedStoragePools(matchedPools);
    vpool.setUseMatchedPools(true);
    _dbClient.createObject(vpool);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    _dbClient.createObject(project);
    // Make a capabilities object
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // Run single volume placement: Run 10 times to make sure pool3 never comes up.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vpool, capabilities);
        assertNotNull(recommendations);
        assertNotNull(recommendations.get(0));
        VolumeRecommendation rec = (VolumeRecommendation) recommendations.get(0);
        assertNotNull(rec.getCandidatePools());
        assertTrue(rec.getCandidatePools().size() == 1);
        assertNotNull(rec.getCandidateSystems());
        assertTrue("storageSystem1".equals(rec.getCandidateSystems().get(0).toString()));
        assertTrue(("pool2".equals(rec.getCandidatePools().get(0).toString())) || ("pool1".equals(rec.getCandidatePools().get(0).toString())));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getCandidatePools().get(0).toString());
    }
    // Make a capabilities object
    capabilities = PlacementTestUtils.createCapabilities("2GB", 2, null);
    // you get two recommendation objects with only one pool with two volumes.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vpool, capabilities);
        assertNotNull(recommendations);
        assertNotNull(recommendations.get(0));
        VolumeRecommendation rec = (VolumeRecommendation) recommendations.get(0);
        VolumeRecommendation rec2 = (VolumeRecommendation) recommendations.get(1);
        assertNotNull(rec.getCandidatePools());
        assertTrue(rec.getCandidatePools().size() == 1);
        assertNotNull(rec.getCandidateSystems());
        assertTrue("storageSystem1".equals(rec.getCandidateSystems().get(0).toString()));
        assertTrue(("pool2".equals(rec.getCandidatePools().get(0).toString())) || ("pool1".equals(rec.getCandidatePools().get(0).toString())));
        assertTrue((rec.getCandidatePools().get(0).toString()).equals(rec2.getCandidatePools().get(0).toString()));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getCandidatePools().get(0).toString());
    }
    // Make a capabilities object
    capabilities = PlacementTestUtils.createCapabilities("29GB", 2, null);
    // Make sure the two recommendation objects are for different pools since neither pool can fit both.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vpool, capabilities);
        assertNotNull(recommendations);
        assertNotNull(recommendations.get(0));
        assertNotNull(recommendations.get(1));
        VolumeRecommendation rec = (VolumeRecommendation) recommendations.get(0);
        VolumeRecommendation rec2 = (VolumeRecommendation) recommendations.get(1);
        assertNotNull(rec.getCandidatePools());
        assertTrue(rec.getCandidatePools().size() == 1);
        assertNotNull(rec.getCandidateSystems());
        assertTrue("storageSystem1".equals(rec.getCandidateSystems().get(0).toString()));
        assertTrue(("pool2".equals(rec.getCandidatePools().get(0).toString())) || ("pool1".equals(rec.getCandidatePools().get(0).toString())));
        // Ensure the recommendation objects are not pointing to the same storage pool.
        assertTrue(!(rec.getCandidatePools().get(0).toString()).equals(rec2.getCandidatePools().get(0).toString()));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getCandidatePools().get(0).toString());
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) Project(com.emc.storageos.db.client.model.Project) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Test(org.junit.Test)

Aggregations

StoragePool (com.emc.storageos.db.client.model.StoragePool)386 URI (java.net.URI)196 ArrayList (java.util.ArrayList)189 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)159 StringSet (com.emc.storageos.db.client.model.StringSet)86 HashMap (java.util.HashMap)85 List (java.util.List)80 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)77 HashSet (java.util.HashSet)75 Volume (com.emc.storageos.db.client.model.Volume)72 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)57 NamedURI (com.emc.storageos.db.client.model.NamedURI)52 StoragePort (com.emc.storageos.db.client.model.StoragePort)51 StringMap (com.emc.storageos.db.client.model.StringMap)47 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)47 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)43 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)43 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)39 IOException (java.io.IOException)35 CIMObjectPath (javax.cim.CIMObjectPath)30