Search in sources :

Example 6 with SRDFRecommendation

use of com.emc.storageos.volumecontroller.SRDFRecommendation in project coprhd-controller by CoprHD.

the class SRDFScheduler method getRecommendationsForCopy.

/**
 * This routine retrieves recommendations for the SRDF_COPY from previously generated SRDF Source
 * recommendations. The SRDF scheduler generates them together, but upper layers of code need
 * them separately so they can be encapsulated in higher level recommendations such as Vplex.
 * @param vArray - Virtual Array object
 * @param project - Project object
 * @param vPool - Virtual Pool object
 * @param capabilities - VirtualPoolCapabilitiesWrapper contains parameters
 * @param currentRecommendations - Contains the current recommendations that would include SRDFRecommendations.
 * The SrdfCopyRecommendations are generated from them
 * @return - List of Recommendations, specifically, SRDFCopyRecommendations
 */
private List<Recommendation> getRecommendationsForCopy(VirtualArray vArray, Project project, VirtualPool vPool, VirtualPoolCapabilityValuesWrapper capabilities, List<Recommendation> currentRecommendations) {
    List<Recommendation> recommendations = new ArrayList<Recommendation>();
    if (currentRecommendations == null) {
        throw WorkflowException.exceptions.workflowConstructionError("Required parameter currentRecommendations is null");
    }
    // that has has matching varray and vpool.
    for (Recommendation recommendation : currentRecommendations) {
        Recommendation rec = recommendation;
        while (rec != null) {
            if (rec instanceof SRDFRecommendation) {
                SRDFRecommendation srdfrec = (SRDFRecommendation) rec;
                if (srdfrec.getVirtualArrayTargetMap().containsKey(vArray.getId())) {
                    SRDFRecommendation.Target target = srdfrec.getVirtualArrayTargetMap().get(vArray.getId());
                    _log.info(String.format("Found SRDF target recommendation for va %s vpool %s", vArray.getLabel(), vPool.getLabel()));
                    SRDFCopyRecommendation targetRecommendation = new SRDFCopyRecommendation();
                    targetRecommendation.setVirtualArray(vArray.getId());
                    targetRecommendation.setVirtualPool(vPool);
                    targetRecommendation.setSourceStorageSystem(target.getTargetStorageDevice());
                    targetRecommendation.setSourceStoragePool(target.getTargetStoragePool());
                    targetRecommendation.setResourceCount(srdfrec.getResourceCount());
                    targetRecommendation.setRecommendation(srdfrec);
                    recommendations.add(targetRecommendation);
                }
            }
            // Check child recommendations, if any
            rec = rec.getRecommendation();
        }
    }
    return recommendations;
}
Also used : SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) ArrayList(java.util.ArrayList) Target(com.emc.storageos.volumecontroller.SRDFRecommendation.Target) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) MetaVolumeRecommendation(com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation)

Example 7 with SRDFRecommendation

use of com.emc.storageos.volumecontroller.SRDFRecommendation in project coprhd-controller by CoprHD.

the class PlacementTests method testVPlexLocalSRDFBasicPlacement.

@Test
public void testVPlexLocalSRDFBasicPlacement() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vplexFE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplexBE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    // Create 2 Virtual Arrays
    VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
    VirtualArray tgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtVarray");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(srcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, vmax1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, vmax2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    // Create 2 storage systems
    StorageSystem[] storageSystems = PlacementTestUtils.createSRDFStorageSystems(_dbClient, "vmax1", network1, vmax1FE, srcVarray, "vmax2", network2, vmax2FE, tgtVarray);
    StorageSystem storageSystem1 = storageSystems[1];
    StorageSystem storageSystem2 = storageSystems[2];
    StoragePool[] storagePools = PlacementTestUtils.createStoragePoolsForTwo(_dbClient, storageSystem1, srcVarray, storageSystem2, tgtVarray);
    StorageSystem vplexSystem = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex1", srcVarray, network1, network1, vplexFE, vplexBE);
    // Create a target virtual pool
    VirtualPool tgtVpool = new VirtualPool();
    tgtVpool.setId(URI.create("tgtVpool"));
    tgtVpool.setLabel("Target Vpool");
    tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools2 = new StringSet();
    matchedPools2.add(storagePools[4].getId().toString());
    matchedPools2.add(storagePools[5].getId().toString());
    matchedPools2.add(storagePools[6].getId().toString());
    tgtVpool.setMatchedStoragePools(matchedPools2);
    tgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(tgtVarray.getId().toString());
    tgtVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(tgtVpool);
    // Make a remote copy protection setting
    VpoolRemoteCopyProtectionSettings settings = new VpoolRemoteCopyProtectionSettings();
    settings.setId(URI.create("remoteCopySettings"));
    settings.setCopyMode(VpoolRemoteCopyProtectionSettings.CopyModes.ASYNCHRONOUS.name());
    settings.setVirtualArray(tgtVarray.getId());
    settings.setVirtualPool(tgtVpool.getId());
    _dbClient.createObject(settings);
    // Create an VPLEX Local/SRDF source virtual pool
    VirtualPool srcVpool = new VirtualPool();
    srcVpool.setId(URI.create("srcVpool"));
    srcVpool.setLabel("Source Vpool");
    srcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    srcVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools1 = new StringSet();
    matchedPools1.add(storagePools[1].getId().toString());
    matchedPools1.add(storagePools[2].getId().toString());
    matchedPools1.add(storagePools[3].getId().toString());
    srcVpool.setMatchedStoragePools(matchedPools1);
    srcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(srcVarray.getId().toString());
    srcVpool.setVirtualArrays(virtualArrays1);
    StringMap remoteProtectionSettings = new StringMap();
    remoteProtectionSettings.put(tgtVarray.getId().toString(), settings.getId().toString());
    srcVpool.setProtectionRemoteCopySettings(remoteProtectionSettings);
    srcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    _dbClient.createObject(srcVpool);
    // 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("RDG1");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // 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++) {
        Map<VpoolUse, List<Recommendation>> recommendationsMap = PlacementTestUtils.invokePlacementForVpool(_dbClient, _coordinator, srcVarray, project, srcVpool, capabilities);
        List<Recommendation> recommendations = recommendationsMap.get(VpoolUse.ROOT);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplexRecommendation = (VPlexRecommendation) recommendations.get(0);
        URI srcStoragePool = vplexRecommendation.getSourceStoragePool();
        assert (srcStoragePool.equals(storagePools[1].getId()) || srcStoragePool.equals(storagePools[2].getId()));
        assert (vplexRecommendation.getRecommendation() instanceof SRDFRecommendation);
        recommendations = recommendationsMap.get(VpoolUse.SRDF_COPY);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof SRDFCopyRecommendation);
        SRDFCopyRecommendation srdfCopyRecommendation = (SRDFCopyRecommendation) recommendations.get(0);
        URI tgtStoragePool = srdfCopyRecommendation.getSourceStoragePool();
        assert (tgtStoragePool.equals(storagePools[4].getId()) || tgtStoragePool.equals(storagePools[5].getId()));
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) NamedURI(com.emc.storageos.db.client.model.NamedURI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) 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) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 8 with SRDFRecommendation

use of com.emc.storageos.volumecontroller.SRDFRecommendation in project coprhd-controller by CoprHD.

the class PlacementTests method testVPlexDistributedSRDFVPlexTargetBasicPlacement.

@Test
public void testVPlexDistributedSRDFVPlexTargetBasicPlacement() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] vplex2FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
    String[] vplex2BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
    String[] vplex3FE = { "FE:FE:FE:FE:FE:FE:FE:04", "FE:FE:FE:FE:FE:FE:FE:05" };
    String[] vplex3BE = { "BE:BE:BE:BE:BE:BE:BE:04", "BE:BE:BE:BE:BE:BE:BE:05" };
    // Create 3 Virtual Arrays
    VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
    VirtualArray tgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtVarray");
    VirtualArray haVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haVarray");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(srcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, vmax1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    network1.addEndpoints(Arrays.asList(vplex1BE), true);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, vmax2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network3 = PlacementTestUtils.createNetwork(_dbClient, vmax2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    // Create 2 storage systems in SRDF pair
    StorageSystem[] storageSystems = PlacementTestUtils.createSRDFStorageSystems(_dbClient, "vmax1", network1, vmax1FE, srcVarray, "vmax2", network2, vmax2FE, tgtVarray);
    StorageSystem storageSystem1 = storageSystems[1];
    StorageSystem storageSystem2 = storageSystems[2];
    StoragePool[] storagePools = PlacementTestUtils.createStoragePoolsForTwo(_dbClient, storageSystem1, srcVarray, storageSystem2, tgtVarray);
    // Create ha StorageSystem
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax3", network3, vmax3FE, haVarray);
    StoragePool[] haPools = PlacementTestUtils.createStoragePools(_dbClient, storageSystem3, haVarray);
    StorageSystem vplexSystem = PlacementTestUtils.createVPlexTwoCluster(_dbClient, "vplex1", srcVarray, network1, network1, vplex1FE, vplex1BE, haVarray, network3, network3, vplex3FE, vplex3BE);
    StorageSystem vplexSystem2 = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex2", tgtVarray, network2, network2, vplex2FE, vplex2BE);
    // Create HA vpool.
    VirtualPool haVpool = new VirtualPool();
    haVpool.setId(URIUtil.createId(VirtualPool.class));
    haVpool.setLabel("haVpool");
    haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    haVpool.setDriveType(SupportedDriveTypes.FC.name());
    haVpool.setType(VirtualPool.Type.block.name());
    StringSet matchedPools3 = new StringSet();
    matchedPools3.add(haPools[1].getId().toString());
    haVpool.setMatchedStoragePools(matchedPools3);
    haVpool.setUseMatchedPools(true);
    StringSet virtualArrays3 = new StringSet();
    virtualArrays3.add(haVpool.getId().toString());
    _dbClient.createObject(haVpool);
    // Create a target virtual pool
    VirtualPool tgtVpool = new VirtualPool();
    tgtVpool.setId(URI.create("tgtVpool"));
    tgtVpool.setLabel("Target Vpool");
    tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    haVpool.setType(VirtualPool.Type.block.name());
    StringSet matchedPools2 = new StringSet();
    matchedPools2.add(storagePools[4].getId().toString());
    matchedPools2.add(storagePools[5].getId().toString());
    matchedPools2.add(storagePools[6].getId().toString());
    tgtVpool.setMatchedStoragePools(matchedPools2);
    tgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(tgtVarray.getId().toString());
    tgtVpool.setVirtualArrays(virtualArrays2);
    tgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    _dbClient.createObject(tgtVpool);
    // Make a remote copy protection setting
    VpoolRemoteCopyProtectionSettings settings = new VpoolRemoteCopyProtectionSettings();
    settings.setId(URI.create("remoteCopySettings"));
    settings.setCopyMode(VpoolRemoteCopyProtectionSettings.CopyModes.ASYNCHRONOUS.name());
    settings.setVirtualArray(tgtVarray.getId());
    settings.setVirtualPool(tgtVpool.getId());
    _dbClient.createObject(settings);
    // Create an VPLEX Local/SRDF source virtual pool
    VirtualPool srcVpool = new VirtualPool();
    srcVpool.setId(URI.create("srcVpool"));
    srcVpool.setLabel("Source Vpool");
    srcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    srcVpool.setDriveType(SupportedDriveTypes.FC.name());
    haVpool.setType(VirtualPool.Type.block.name());
    StringSet matchedPools1 = new StringSet();
    matchedPools1.add(storagePools[1].getId().toString());
    matchedPools1.add(storagePools[2].getId().toString());
    matchedPools1.add(storagePools[3].getId().toString());
    srcVpool.setMatchedStoragePools(matchedPools1);
    srcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(srcVarray.getId().toString());
    srcVpool.setVirtualArrays(virtualArrays1);
    StringMap remoteProtectionSettings = new StringMap();
    remoteProtectionSettings.put(tgtVarray.getId().toString(), settings.getId().toString());
    srcVpool.setProtectionRemoteCopySettings(remoteProtectionSettings);
    srcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
    StringMap haVarrayMap = new StringMap();
    haVarrayMap.put(haVarray.getId().toString(), haVpool.getId().toString());
    srcVpool.setHaVarrayVpoolMap(haVarrayMap);
    _dbClient.createObject(srcVpool);
    // 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("RDG1");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // 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++) {
        Map<VpoolUse, List<Recommendation>> recommendationsMap = PlacementTestUtils.invokePlacementForVpool(_dbClient, _coordinator, srcVarray, project, srcVpool, capabilities);
        List<Recommendation> recommendations = recommendationsMap.get(VpoolUse.ROOT);
        assertNotNull(recommendations);
        assertTrue(recommendations.size() == 2);
        assertNotNull(recommendations.get(0));
        // Check source side recommendation
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplexRecommendation = (VPlexRecommendation) recommendations.get(0);
        URI srcStoragePool = vplexRecommendation.getSourceStoragePool();
        assert (srcStoragePool.equals(storagePools[1].getId()) || srcStoragePool.equals(storagePools[2].getId()));
        assert (vplexRecommendation.getVPlexStorageSystem().equals(vplexSystem.getId()));
        assert (vplexRecommendation.getRecommendation() instanceof SRDFRecommendation);
        // Check HA side recommendation
        vplexRecommendation = (VPlexRecommendation) recommendations.get(1);
        assert (vplexRecommendation.getSourceStoragePool().equals(haPools[1].getId()));
        assert (vplexRecommendation.getVPlexStorageSystem().equals(vplexSystem.getId()));
        recommendations = recommendationsMap.get(VpoolUse.SRDF_COPY);
        assertTrue(!recommendations.isEmpty());
        // Check SRDF recommendation
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplex2Recommendation = (VPlexRecommendation) recommendations.get(0);
        URI tgtStoragePool = vplex2Recommendation.getSourceStoragePool();
        assert (tgtStoragePool.equals(storagePools[4].getId()) || tgtStoragePool.equals(storagePools[5].getId()));
        assert (vplex2Recommendation.getVPlexStorageSystem().equals(vplexSystem2.getId()));
        assert (vplex2Recommendation.getRecommendation() instanceof SRDFCopyRecommendation);
        ;
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) NamedURI(com.emc.storageos.db.client.model.NamedURI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) 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) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 9 with SRDFRecommendation

use of com.emc.storageos.volumecontroller.SRDFRecommendation in project coprhd-controller by CoprHD.

the class PlacementTests method testVPlexLocalSRDFVPlexTargetBasicPlacement.

@Test
public void testVPlexLocalSRDFVPlexTargetBasicPlacement() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] vplex2FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
    String[] vplex2BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
    // Create 2 Virtual Arrays
    VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
    VirtualArray tgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtVarray");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(srcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, vmax1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    network1.addEndpoints(Arrays.asList(vplex1FE), true);
    network1.addEndpoints(Arrays.asList(vplex1BE), true);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, vmax2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    network2.addEndpoints(Arrays.asList(vplex2FE), true);
    network2.addEndpoints(Arrays.asList(vplex2BE), true);
    // Create 2 storage systems
    StorageSystem[] storageSystems = PlacementTestUtils.createSRDFStorageSystems(_dbClient, "vmax1", network1, vmax1FE, srcVarray, "vmax2", network2, vmax2FE, tgtVarray);
    StorageSystem storageSystem1 = storageSystems[1];
    StorageSystem storageSystem2 = storageSystems[2];
    StoragePool[] storagePools = PlacementTestUtils.createStoragePoolsForTwo(_dbClient, storageSystem1, srcVarray, storageSystem2, tgtVarray);
    StorageSystem vplexSystem = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex1", srcVarray, network1, network1, vplex1FE, vplex1BE);
    StorageSystem vplexSystem2 = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex2", tgtVarray, network2, network2, vplex2FE, vplex2BE);
    // Create a target virtual pool
    VirtualPool tgtVpool = new VirtualPool();
    tgtVpool.setId(URI.create("tgtVpool"));
    tgtVpool.setLabel("Target Vpool");
    tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools2 = new StringSet();
    matchedPools2.add(storagePools[4].getId().toString());
    matchedPools2.add(storagePools[5].getId().toString());
    matchedPools2.add(storagePools[6].getId().toString());
    tgtVpool.setMatchedStoragePools(matchedPools2);
    tgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(tgtVarray.getId().toString());
    tgtVpool.setVirtualArrays(virtualArrays2);
    tgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    _dbClient.createObject(tgtVpool);
    // Make a remote copy protection setting
    VpoolRemoteCopyProtectionSettings settings = new VpoolRemoteCopyProtectionSettings();
    settings.setId(URI.create("remoteCopySettings"));
    settings.setCopyMode(VpoolRemoteCopyProtectionSettings.CopyModes.ASYNCHRONOUS.name());
    settings.setVirtualArray(tgtVarray.getId());
    settings.setVirtualPool(tgtVpool.getId());
    _dbClient.createObject(settings);
    // Create an VPLEX Local/SRDF source virtual pool
    VirtualPool srcVpool = new VirtualPool();
    srcVpool.setId(URI.create("srcVpool"));
    srcVpool.setLabel("Source Vpool");
    srcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    srcVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools1 = new StringSet();
    matchedPools1.add(storagePools[1].getId().toString());
    matchedPools1.add(storagePools[2].getId().toString());
    matchedPools1.add(storagePools[3].getId().toString());
    srcVpool.setMatchedStoragePools(matchedPools1);
    srcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(srcVarray.getId().toString());
    srcVpool.setVirtualArrays(virtualArrays1);
    StringMap remoteProtectionSettings = new StringMap();
    remoteProtectionSettings.put(tgtVarray.getId().toString(), settings.getId().toString());
    srcVpool.setProtectionRemoteCopySettings(remoteProtectionSettings);
    srcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    _dbClient.createObject(srcVpool);
    // 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("RDG1");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // 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++) {
        Map<VpoolUse, List<Recommendation>> recommendationsMap = PlacementTestUtils.invokePlacementForVpool(_dbClient, _coordinator, srcVarray, project, srcVpool, capabilities);
        List<Recommendation> recommendations = recommendationsMap.get(VpoolUse.ROOT);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplexRecommendation = (VPlexRecommendation) recommendations.get(0);
        URI srcStoragePool = vplexRecommendation.getSourceStoragePool();
        assert (srcStoragePool.equals(storagePools[1].getId()) || srcStoragePool.equals(storagePools[2].getId()));
        assert (vplexRecommendation.getVPlexStorageSystem().equals(vplexSystem.getId()));
        assert (vplexRecommendation.getRecommendation() instanceof SRDFRecommendation);
        recommendations = recommendationsMap.get(VpoolUse.SRDF_COPY);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplex2Recommendation = (VPlexRecommendation) recommendations.get(0);
        URI tgtStoragePool = vplex2Recommendation.getSourceStoragePool();
        assert (tgtStoragePool.equals(storagePools[4].getId()) || tgtStoragePool.equals(storagePools[5].getId()));
        assert (vplex2Recommendation.getVPlexStorageSystem().equals(vplexSystem2.getId()));
        assert (vplex2Recommendation.getRecommendation() instanceof SRDFCopyRecommendation);
        ;
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) NamedURI(com.emc.storageos.db.client.model.NamedURI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) 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) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Example 10 with SRDFRecommendation

use of com.emc.storageos.volumecontroller.SRDFRecommendation in project coprhd-controller by CoprHD.

the class PlacementTests method testVPlexLocalSRDFVPlexTargetAdvancedPlacement.

/**
 * This tests that given multiple Vmax arrays capable of SRDF pairing, it will always
 * choose those that are Vplex protected. Below vmax1 and vmax2 are on networks with Vplex;
 * vmax3 and vmax4 are on different works in same varrays with no Vplex.
 */
@Test
public void testVPlexLocalSRDFVPlexTargetAdvancedPlacement() {
    String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] vmax4FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplex1BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] vplex2FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
    String[] vplex2BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
    // Create 2 Virtual Arrays
    VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
    VirtualArray tgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtVarray");
    // Create 4 Networks
    StringSet connVA = new StringSet();
    connVA.add(srcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, vmax1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, vmax2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    connVA = new StringSet();
    connVA.add(srcVarray.getId().toString());
    Network network3 = PlacementTestUtils.createNetwork(_dbClient, vmax3FE, "VSANSite1B", "FC+BROCADE+FEB", connVA);
    connVA = new StringSet();
    connVA.add(tgtVarray.getId().toString());
    Network network4 = PlacementTestUtils.createNetwork(_dbClient, vmax4FE, "VSANSite2B", "FC+CISCO+FEB", connVA);
    // Create 2 storage systems
    StorageSystem[] storageSystems = PlacementTestUtils.createSRDFStorageSystems(_dbClient, "vmax1", network1, vmax1FE, srcVarray, "vmax2", network2, vmax2FE, tgtVarray);
    StorageSystem storageSystem1 = storageSystems[1];
    StorageSystem storageSystem2 = storageSystems[2];
    StoragePool[] storagePools = PlacementTestUtils.createStoragePoolsForTwo(_dbClient, storageSystem1, srcVarray, storageSystem2, tgtVarray);
    StorageSystem[] storageSystemsB = PlacementTestUtils.createSRDFStorageSystems(_dbClient, "vmax3", network3, vmax3FE, srcVarray, "vmax4", network4, vmax4FE, tgtVarray);
    StorageSystem storageSystem3 = storageSystemsB[1];
    StorageSystem storageSystem4 = storageSystemsB[2];
    StoragePool[] storagePoolsB = PlacementTestUtils.createStoragePoolsForTwo(_dbClient, storageSystem3, srcVarray, storageSystem4, tgtVarray);
    StorageSystem vplexSystem = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex1", srcVarray, network1, network1, vplex1FE, vplex1BE);
    StorageSystem vplexSystem2 = PlacementTestUtils.createVPlexOneCluster(_dbClient, "vplex2", tgtVarray, network2, network2, vplex2FE, vplex2BE);
    // Create a target virtual pool
    VirtualPool tgtVpool = new VirtualPool();
    tgtVpool.setId(URI.create("tgtVpool"));
    tgtVpool.setLabel("Target Vpool");
    tgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    tgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    tgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(tgtVarray.getId().toString());
    tgtVpool.setVirtualArrays(virtualArrays2);
    tgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    List<StoragePool> targetStoragePools = new ArrayList<StoragePool>();
    targetStoragePools.add(storagePools[4]);
    targetStoragePools.add(storagePools[5]);
    targetStoragePools.add(storagePools[6]);
    targetStoragePools.add(storagePoolsB[4]);
    targetStoragePools.add(storagePoolsB[5]);
    targetStoragePools.add(storagePoolsB[6]);
    StringSet matchedPools = PlacementTestUtils.runVPlexHighAvailabilityMatcher(_dbClient, tgtVpool, targetStoragePools);
    assert (matchedPools.size() == 3);
    tgtVpool.setMatchedStoragePools(matchedPools);
    _dbClient.createObject(tgtVpool);
    // Make a remote copy protection setting
    VpoolRemoteCopyProtectionSettings settings = new VpoolRemoteCopyProtectionSettings();
    settings.setId(URI.create("remoteCopySettings"));
    settings.setCopyMode(VpoolRemoteCopyProtectionSettings.CopyModes.ASYNCHRONOUS.name());
    settings.setVirtualArray(tgtVarray.getId());
    settings.setVirtualPool(tgtVpool.getId());
    _dbClient.createObject(settings);
    // Create an VPLEX Local/SRDF source virtual pool
    VirtualPool srcVpool = new VirtualPool();
    srcVpool.setId(URI.create("srcVpool"));
    srcVpool.setLabel("Source Vpool");
    srcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    srcVpool.setDriveType(SupportedDriveTypes.FC.name());
    srcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(srcVarray.getId().toString());
    srcVpool.setVirtualArrays(virtualArrays1);
    StringMap remoteProtectionSettings = new StringMap();
    remoteProtectionSettings.put(tgtVarray.getId().toString(), settings.getId().toString());
    srcVpool.setProtectionRemoteCopySettings(remoteProtectionSettings);
    srcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    List<StoragePool> sourceStoragePools = new ArrayList<StoragePool>();
    sourceStoragePools.add(storagePools[1]);
    sourceStoragePools.add(storagePools[2]);
    sourceStoragePools.add(storagePools[3]);
    sourceStoragePools.add(storagePoolsB[1]);
    sourceStoragePools.add(storagePoolsB[2]);
    sourceStoragePools.add(storagePoolsB[3]);
    matchedPools = PlacementTestUtils.runVPlexHighAvailabilityMatcher(_dbClient, srcVpool, sourceStoragePools);
    assert (matchedPools.size() == 3);
    srcVpool.setMatchedStoragePools(matchedPools);
    _dbClient.createObject(srcVpool);
    // 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("RDG1");
    project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
    _dbClient.createObject(project);
    // Create capabilities
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // 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++) {
        Map<VpoolUse, List<Recommendation>> recommendationsMap = PlacementTestUtils.invokePlacementForVpool(_dbClient, _coordinator, srcVarray, project, srcVpool, capabilities);
        List<Recommendation> recommendations = recommendationsMap.get(VpoolUse.ROOT);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplexRecommendation = (VPlexRecommendation) recommendations.get(0);
        URI srcStoragePool = vplexRecommendation.getSourceStoragePool();
        assert (srcStoragePool.equals(storagePools[1].getId()) || srcStoragePool.equals(storagePools[2].getId()));
        assert (vplexRecommendation.getVPlexStorageSystem().equals(vplexSystem.getId()));
        assert (vplexRecommendation.getRecommendation() instanceof SRDFRecommendation);
        recommendations = recommendationsMap.get(VpoolUse.SRDF_COPY);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assert (recommendations.get(0) instanceof VPlexRecommendation);
        VPlexRecommendation vplex2Recommendation = (VPlexRecommendation) recommendations.get(0);
        URI tgtStoragePool = vplex2Recommendation.getSourceStoragePool();
        assert (tgtStoragePool.equals(storagePools[4].getId()) || tgtStoragePool.equals(storagePools[5].getId()));
        assert (vplex2Recommendation.getVPlexStorageSystem().equals(vplexSystem2.getId()));
        assert (vplex2Recommendation.getRecommendation() instanceof SRDFCopyRecommendation);
        ;
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) NamedURI(com.emc.storageos.db.client.model.NamedURI) ArrayList(java.util.ArrayList) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) 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) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) RPRecommendation(com.emc.storageos.volumecontroller.RPRecommendation) RPProtectionRecommendation(com.emc.storageos.volumecontroller.RPProtectionRecommendation) Project(com.emc.storageos.db.client.model.Project) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) Test(org.junit.Test)

Aggregations

SRDFRecommendation (com.emc.storageos.volumecontroller.SRDFRecommendation)13 ArrayList (java.util.ArrayList)13 Recommendation (com.emc.storageos.volumecontroller.Recommendation)12 SRDFCopyRecommendation (com.emc.storageos.volumecontroller.SRDFCopyRecommendation)12 URI (java.net.URI)11 NamedURI (com.emc.storageos.db.client.model.NamedURI)10 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)9 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)7 VpoolRemoteCopyProtectionSettings (com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings)7 Project (com.emc.storageos.db.client.model.Project)6 StoragePool (com.emc.storageos.db.client.model.StoragePool)6 StringSet (com.emc.storageos.db.client.model.StringSet)6 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)6 VPlexRecommendation (com.emc.storageos.volumecontroller.VPlexRecommendation)6 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)6 List (java.util.List)6 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)5 Network (com.emc.storageos.db.client.model.Network)5 StringMap (com.emc.storageos.db.client.model.StringMap)5 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)5