Search in sources :

Example 36 with StringMap

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

the class VolumeIngestionUtil method checkUnManagedResourceAddedToConsistencyGroup.

/**
 * Checks if the unmanaged resource is part of a consistency group
 *
 * @param unManagedVolume - the resource being examined
 * @return boolean indicating if the resource is part of a consistency group
 */
public static boolean checkUnManagedResourceAddedToConsistencyGroup(UnManagedVolume unManagedVolume) {
    _logger.info("Determining if the unmanaged volume {} belongs to an unmanaged consistency group", unManagedVolume.getLabel());
    StringMap unManagedVolumeCharacteristics = unManagedVolume.getVolumeCharacterstics();
    String isVolumeAddedToConsistencyGroup = unManagedVolumeCharacteristics.get(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString());
    if (null != isVolumeAddedToConsistencyGroup && Boolean.parseBoolean(isVolumeAddedToConsistencyGroup)) {
        _logger.info("The unmanaged volume {} belongs to an unmanaged consistency group", unManagedVolume.getLabel());
        return true;
    }
    _logger.info("The unmanaged volume {} does not belong to an unmanaged consistency group", unManagedVolume.getLabel());
    return false;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap)

Example 37 with StringMap

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

the class VirtualPoolChangeAnalyzer method getHaVpool.

/**
 * Gets the HA virtual pool for a VPLEX volume, if any, given the volume's
 * virtual pool.
 *
 * @param vpool A reference to the volume's virtual pool.
 * @param dbClient A reference to a DB client.
 *
 * @return The HA virtual pool for a VPLEX volume, if any, given the
 *         volume's virtual pool. Will be null if the volume's virtual pool
 *         does not specify VPLEX distributed HA.
 */
public static VirtualPool getHaVpool(VirtualPool vpool, DbClient dbClient) {
    VirtualPool haVpool = null;
    // The vpool must specify distributed HA.
    if (VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(vpool.getHighAvailability())) {
        // The HA varray is required, so there should be an entry in the
        // map. If a vpool was also specified the value in the map
        // will not be a null URI.
        StringMap haVpoolMap = vpool.getHaVarrayVpoolMap();
        URI haVpoolURI = URI.create(haVpoolMap.values().iterator().next());
        if (!NullColumnValueGetter.isNullURI(haVpoolURI)) {
            haVpool = dbClient.queryObject(VirtualPool.class, haVpoolURI);
        } else {
            // When not specified, the same vpool is used on the HA side.
            haVpool = vpool;
        }
    }
    return haVpool;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 38 with StringMap

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

the class VirtualPoolChangeAnalyzer method getNewHaVpool.

/**
 * Gets the new HA virtual pool for a VPLEX volume, if any, given the
 * volume's current virtual pool and a new virtual pool to which it is being
 * changed.
 *
 * @param currentVpool The current virtual pool for a VPLEX volume.
 * @param newVpool A new virtual pool to which the volume will be changed.
 * @param dbClient A reference to a DB client.
 *
 * @return The new HA virtual pool for a VPLEX volume, if any, that will
 *         result from changing the volume for its current virtual pool to
 *         the passed new virtual pool. Will return null if the current
 *         virtual pool does not specify VPLEX distributed HA.
 */
public static VirtualPool getNewHaVpool(VirtualPool currentVpool, VirtualPool newVpool, DbClient dbClient) {
    newVpoolDoesNotSpecifyHaVpool = false;
    VirtualPool newHaVpool = null;
    // Get the HA varray specified by the current vpool. If it's
    // null the current vpool does not specify VPLEX distributed HA.
    URI haVarrayURI = getHaVarrayURI(currentVpool);
    if (haVarrayURI != null) {
        // RP+VPLEX only
        if (NullColumnValueGetter.isNotNullValue(newVpool.getHaVarrayConnectedToRp())) {
            haVarrayURI = URI.create(newVpool.getHaVarrayConnectedToRp());
        }
        StringMap newHaVpoolMap = newVpool.getHaVarrayVpoolMap();
        // The new vpool must specify an entry for the HA varray.
        if (newHaVpoolMap.containsKey(haVarrayURI.toString())) {
            URI newHaVpoolURI = URI.create(newHaVpoolMap.get(haVarrayURI.toString()));
            if (!NullColumnValueGetter.isNullURI(newHaVpoolURI)) {
                newHaVpool = dbClient.queryObject(VirtualPool.class, newHaVpoolURI);
            } else {
                // When no HA vpool is specified in the new vpool,
                // the new HA vpool is the new vpool itself.
                newHaVpool = newVpool;
                newVpoolDoesNotSpecifyHaVpool = true;
            }
        } else {
            throw APIException.badRequests.wrongHighAvailabilityVArrayInVPool(haVarrayURI.toString());
        }
    }
    return newHaVpool;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 39 with StringMap

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

the class PlacementTests method testPlacementRpVplexAdvancedSite1toSite2.

/**
 * RP VPLEX placement -- placement decision based on RP array visibility
 */
@Test
public void testPlacementRpVplexAdvancedSite1toSite2() {
    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[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54: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 varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
    VirtualArray varray3 = PlacementTestUtils.createVirtualArray(_dbClient, "varray3");
    // Create 1 Network
    StringSet connVA = new StringSet();
    connVA.add(varray1.getId().toString());
    connVA.add(varray2.getId().toString());
    connVA.add(varray3.getId().toString());
    Network network = PlacementTestUtils.createNetwork(_dbClient, vplex1FE, "VSAN", "FC+BROCADE", connVA);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex3FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex1BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex2BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vplex3BE);
    PlacementTestUtils.addEndpoints(_dbClient, network, rp1FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, rp2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax1FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax2FE);
    PlacementTestUtils.addEndpoints(_dbClient, network, vmax3FE);
    // Create 3 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network, vmax1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports VMAX2
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network, vmax2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports VMAX3
    List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax3FE.length; i++) {
        vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network, vmax3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
    }
    // Create 2 VPLEX storage systems
    StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    StorageSystem vplexStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex2");
    // Create two front-end storage ports VPLEX1
    List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1FE.length; i++) {
        fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX1
    List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex1BE.length; i++) {
        bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
    }
    // Create two front-end storage ports VPLEX2
    List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex2FE.length; i++) {
        fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX2
    List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex2BE.length; i++) {
        bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, network, vplex2BE[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
    }
    // Create two front-end storage ports VPLEX3
    List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex3FE.length; i++) {
        fePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3FE[i], varray3, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX3
    List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
    for (int i = 0; i < vplex3BE.length; i++) {
        bePorts3.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, network, vplex3BE[i], varray3, StoragePort.PortType.backend.name(), "portGroupBE3-" + (i + 1), "I0+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", "vplex1cluster1"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster2"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster1"));
    storSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex2cluster2"));
    StringSetMap rpVisibleSystems = new StringSetMap();
    StringSet storageIds = new StringSet();
    storageIds.add(vplexStorageSystem1.getId().toString());
    rpVisibleSystems.put("site1", storageIds);
    StringSet storageIds2 = new StringSet();
    storageIds2.add(vplexStorageSystem2.getId().toString());
    rpVisibleSystems.put("site2", storageIds2);
    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, rpVisibleSystems, 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("vplex1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vplex2"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    // Create a storage pool for vmax1
    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 vmax1
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray1, storageSystem1, "pool3", "Pool3", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 50), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool6", "Pool6", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool7 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool7", "Pool7", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool8 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool8", "Pool8", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax3
    StoragePool pool9 = PlacementTestUtils.createStoragePool(_dbClient, varray3, storageSystem3, "pool9", "Pool9", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create HA virtual pool
    VirtualPool haVpool = new VirtualPool();
    haVpool.setId(URI.create(haVpoolUri));
    haVpool.setLabel("haVpool");
    haVpool.setType("block");
    haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    haVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    haVpool.setMatchedStoragePools(matchedPools);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(varray1.getId().toString());
    haVpool.setVirtualArrays(virtualArrays1);
    haVpool.setUseMatchedPools(true);
    _dbClient.createObject(haVpool);
    // Create RP target vpool
    VirtualPool rpTgtVpool = new VirtualPool();
    rpTgtVpool.setId(URI.create("rpTgtVpool"));
    rpTgtVpool.setLabel("rpTgtVpool");
    rpTgtVpool.setType("block");
    rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    rpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    matchedPools = new StringSet();
    matchedPools.add(pool7.getId().toString());
    matchedPools.add(pool8.getId().toString());
    matchedPools.add(pool9.getId().toString());
    rpTgtVpool.setMatchedStoragePools(matchedPools);
    rpTgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays3 = new StringSet();
    virtualArrays3.add(varray3.getId().toString());
    rpTgtVpool.setVirtualArrays(virtualArrays3);
    _dbClient.createObject(rpTgtVpool);
    // Create a RP VPLEX source virtual pool
    VirtualPool rpVplexSrcVpool = new VirtualPool();
    rpVplexSrcVpool.setId(URI.create(dummyVpoolUri));
    rpVplexSrcVpool.setLabel("rpVplexSrcVpool");
    rpVplexSrcVpool.setType("block");
    rpVplexSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpVplexSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    rpVplexSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
    StringMap vavpMap = new StringMap();
    vavpMap.put(varray1.getId().toString(), haVpool.getId().toString());
    rpVplexSrcVpool.setHaVarrayVpoolMap(vavpMap);
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(rpTgtVpool.getId());
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(varray3.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpVplexSrcVpool.setProtectionVarraySettings(protectionVarray);
    rpVplexSrcVpool.setRpCopyMode("SYNCHRONOUS");
    rpVplexSrcVpool.setRpRpoType("MINUTES");
    rpVplexSrcVpool.setRpRpoValue(Long.valueOf("5"));
    matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    rpVplexSrcVpool.setMatchedStoragePools(matchedPools);
    rpVplexSrcVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(varray2.getId().toString());
    rpVplexSrcVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(rpVplexSrcVpool);
    // 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 pool6 never comes up for source and pool9 for target.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray2, project, rpVplexSrcVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceRecommendations());
        assertNotNull(!rec.getSourceRecommendations().isEmpty());
        assertNotNull(rec.getProtectionDevice());
        assertTrue("rp1".equals(rec.getProtectionDevice().toString()));
        for (RPRecommendation sourceRec : rec.getSourceRecommendations()) {
            assertNotNull(sourceRec.getInternalSiteName());
            assertNotNull(sourceRec.getVirtualArray());
            assertNotNull(sourceRec.getVirtualPool());
            assertNotNull(sourceRec.getVirtualVolumeRecommendation());
            assertNotNull(sourceRec.getHaRecommendation());
            assertNotNull(sourceRec.getTargetRecommendations());
            assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
            assertTrue("site1".equals(sourceRec.getInternalSiteName()));
            assertTrue("vmax2".equals(sourceRec.getSourceStorageSystem().toString()));
            assertTrue(("pool5".equals(sourceRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceRec.getSourceStoragePool().toString())));
            if (VirtualPool.vPoolSpecifiesHighAvailability(sourceRec.getVirtualPool())) {
                assertNotNull(sourceRec.getVirtualVolumeRecommendation());
            }
            assertNotNull(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation());
            assertTrue("vplex1".equals(sourceRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
            assertTrue("varray1".equals(sourceRec.getHaRecommendation().getVirtualArray().toString()));
            assertTrue(haVpoolUri.equals(sourceRec.getHaRecommendation().getVirtualPool().getId().toString()));
            assertTrue("vmax1".equals(sourceRec.getHaRecommendation().getSourceStorageSystem().toString()));
            assertTrue(("pool2".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(sourceRec.getHaRecommendation().getSourceStoragePool().toString())));
            assertNotNull(sourceRec.getTargetRecommendations());
            assertTrue(!sourceRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : sourceRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getInternalSiteName());
                assertNotNull(targetRec.getVirtualArray());
                assertNotNull(targetRec.getVirtualPool());
                if (VirtualPool.vPoolSpecifiesHighAvailability(targetRec.getVirtualPool())) {
                    assertNotNull(targetRec.getVirtualVolumeRecommendation());
                }
                assertTrue("varray3".equals(targetRec.getVirtualArray().toString()));
                assertTrue(rpTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
                assertTrue("site2".equals(targetRec.getInternalSiteName()));
                assertTrue("vmax3".equals(targetRec.getSourceStorageSystem().toString()));
                assertTrue(("pool8".equals(targetRec.getSourceStoragePool().toString())) || ("pool7".equals(targetRec.getSourceStoragePool().toString())));
            }
        }
        // source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        RPRecommendation sourceJournalRec = rec.getSourceJournalRecommendation();
        if (VirtualPool.vPoolSpecifiesHighAvailability(sourceJournalRec.getVirtualPool())) {
            assertNotNull(sourceJournalRec.getVirtualVolumeRecommendation());
        }
        assertTrue(("pool5".equals(sourceJournalRec.getSourceStoragePool().toString())) || ("pool4".equals(sourceJournalRec.getSourceStoragePool().toString())));
        // target journals
        assertNotNull(rec.getTargetJournalRecommendations());
        assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec.getInternalSiteName());
            assertNotNull(targetJournalRec.getVirtualArray());
            assertNotNull(targetJournalRec.getVirtualPool());
            if (VirtualPool.vPoolSpecifiesHighAvailability(targetJournalRec.getVirtualPool())) {
                assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
            }
            assertTrue("vmax3".equals(targetJournalRec.getSourceStorageSystem().toString()));
            assertTrue(("pool8".equals(targetJournalRec.getSourceStoragePool().toString())) || ("pool7".equals(targetJournalRec.getSourceStoragePool().toString())));
        }
        _log.info("Recommendation : " + 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 StringMap

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

the class PlacementTests method testBasicRPPlacement2.

/**
 * Simple block placement with RP
 * Basic RP Placement test - VMAX
 * In this test, Pool1 from VMAX1 and Pool3 from VMAX3 are available as candidates for source and source journal.
 * However, Pool3 doesnt have connectivity to the RP site and should not be chosen.
 * Placement also should not fail here, and Pool1 should be chosen for both source and its journal.
 */
@Test
public void testBasicRPPlacement2() {
    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 = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
    String[] rp1FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    String[] rp2FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
    // Create 2 Virtual Arrays
    VirtualArray rpSrcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpSrcVarray");
    VirtualArray rpTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "rpTgtVarray");
    // Create 2 Networks
    StringSet connVA = new StringSet();
    connVA.add(rpSrcVarray.getId().toString());
    Network network1 = PlacementTestUtils.createNetwork(_dbClient, rp1FE, "VSANSite1", "FC+BROCADE+FE", connVA);
    connVA = new StringSet();
    connVA.add(rpTgtVarray.getId().toString());
    Network network2 = PlacementTestUtils.createNetwork(_dbClient, rp2FE, "VSANSite2", "FC+CISCO+FE", connVA);
    // Create 2 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
    // Create two front-end storage ports VMAX1
    List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax1FE.length; i++) {
        vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, network1, vmax1FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite1vmax" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports VMAX2
    List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax2FE.length; i++) {
        vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, network2, vmax2FE[i], rpTgtVarray, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports VMAX3
    List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < vmax3FE.length; i++) {
        vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, network1, vmax3FE[i], rpSrcVarray, StoragePort.PortType.frontend.name(), "portGroupSite3vmax" + i, "E0+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("site2", storageSystem2.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("vmax1"));
    rpSiteArray1.setRpInternalSiteName("site1");
    rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray1);
    RPSiteArray rpSiteArray2 = new RPSiteArray();
    rpSiteArray2.setId(URI.create("rsa2"));
    rpSiteArray2.setStorageSystem(URI.create("vmax2"));
    rpSiteArray2.setRpInternalSiteName("site2");
    rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
    _dbClient.createObject(rpSiteArray2);
    // Create a storage pool for vmax1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool1", "Pool1", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem1, "pool2", "Pool2", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax1
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, rpSrcVarray, storageSystem3, "pool3", "Pool3", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool4", "Pool4", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool5", "Pool5", Long.valueOf(SIZE_GB * 10), Long.valueOf(SIZE_GB * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool for vmax2
    StoragePool pool6 = PlacementTestUtils.createStoragePool(_dbClient, rpTgtVarray, storageSystem2, "pool6", "Pool6", Long.valueOf(SIZE_GB * 1), Long.valueOf(SIZE_GB * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a virtual pool
    VirtualPool rpTgtVpool = new VirtualPool();
    rpTgtVpool.setId(URI.create("rpTgtVpool"));
    rpTgtVpool.setLabel("RP Target Vpool");
    rpTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    rpTgtVpool.setMatchedStoragePools(matchedPools);
    rpTgtVpool.setUseMatchedPools(true);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(rpTgtVarray.getId().toString());
    rpTgtVpool.setVirtualArrays(virtualArrays2);
    _dbClient.createObject(rpTgtVpool);
    // Create a RP virtual pool
    VirtualPool rpSrcVpool = new VirtualPool();
    rpSrcVpool.setId(URI.create("rpSrcVpool"));
    rpSrcVpool.setLabel("RP Source Vpool");
    rpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    rpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
    VpoolProtectionVarraySettings protectionSettings = new VpoolProtectionVarraySettings();
    protectionSettings.setVirtualPool(rpTgtVpool.getId());
    protectionSettings.setId(URI.create("protectionSettings"));
    _dbClient.createObject(protectionSettings);
    List<VpoolProtectionVarraySettings> protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    protectionSettingsList.add(protectionSettings);
    StringMap protectionVarray = new StringMap();
    protectionVarray.put(rpTgtVarray.getId().toString(), protectionSettingsList.get(0).getId().toString());
    rpSrcVpool.setProtectionVarraySettings(protectionVarray);
    rpSrcVpool.setRpCopyMode("SYNCHRONOUS");
    rpSrcVpool.setRpRpoType("MINUTES");
    rpSrcVpool.setRpRpoValue(Long.valueOf("5"));
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    // matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    rpSrcVpool.setMatchedStoragePools(matchedPools);
    rpSrcVpool.setUseMatchedPools(true);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(rpSrcVarray.getId().toString());
    rpSrcVpool.setVirtualArrays(virtualArrays1);
    _dbClient.createObject(rpSrcVpool);
    // 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, rpSrcVarray, project, rpSrcVpool, 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 rpRec : rec.getSourceRecommendations()) {
            assertNotNull(rpRec.getInternalSiteName());
            assertNotNull(rpRec.getSourceStorageSystem());
            assertNotNull(rpRec.getSourceStoragePool());
            assertTrue("site1".equals(rpRec.getInternalSiteName()));
            assertTrue("vmax1".equals(rpRec.getSourceStorageSystem().toString()));
            assertTrue(("pool2".equals(rpRec.getSourceStoragePool().toString())) || ("pool1".equals(rpRec.getSourceStoragePool().toString())));
            assertNotNull(rpRec.getTargetRecommendations());
            assertTrue(!rpRec.getTargetRecommendations().isEmpty());
            for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
                assertNotNull(targetRec.getSourceStoragePool());
                assertTrue("vmax2".equals(targetRec.getSourceStorageSystem().toString()));
                assertTrue("site2".equals(targetRec.getInternalSiteName()));
                assertTrue("pool5".equals(targetRec.getSourceStoragePool().toString()) || "pool4".equals(targetRec.getSourceStoragePool().toString()));
            }
        }
        // source journal
        assertNotNull(rec.getSourceJournalRecommendation());
        assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
        assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
        assertTrue(("pool2".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
        // target journal
        assertNotNull(rec.getTargetJournalRecommendations());
        assertNotNull(!rec.getTargetJournalRecommendations().isEmpty());
        for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
            assertNotNull(targetJournalRec.getSourceStoragePool());
            assertTrue("pool5".equals(targetJournalRec.getSourceStoragePool().toString()) || "pool4".equals(targetJournalRec.getSourceStoragePool().toString()));
            assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
            assertTrue("vmax2".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)

Aggregations

StringMap (com.emc.storageos.db.client.model.StringMap)257 URI (java.net.URI)108 ArrayList (java.util.ArrayList)90 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)59 StringSet (com.emc.storageos.db.client.model.StringSet)57 HashMap (java.util.HashMap)57 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)48 ExportMask (com.emc.storageos.db.client.model.ExportMask)43 Volume (com.emc.storageos.db.client.model.Volume)42 NamedURI (com.emc.storageos.db.client.model.NamedURI)41 StoragePool (com.emc.storageos.db.client.model.StoragePool)39 Initiator (com.emc.storageos.db.client.model.Initiator)38 List (java.util.List)34 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)33 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)31 HashSet (java.util.HashSet)30 Project (com.emc.storageos.db.client.model.Project)24 StoragePort (com.emc.storageos.db.client.model.StoragePort)23 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)22 Network (com.emc.storageos.db.client.model.Network)21