Search in sources :

Example 11 with VPlexRecommendation

use of com.emc.storageos.volumecontroller.VPlexRecommendation 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 12 with VPlexRecommendation

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

the class PlacementTests method testPlacementVPlexHARemote.

/**
 * VPLEX HA remote block placement.
 */
@Test
public void testPlacementVPlexHARemote() {
    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[] 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" };
    // Create a Virtual Array
    VirtualArray varray1 = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    VirtualArray varray2 = PlacementTestUtils.createVirtualArray(_dbClient, "varray2");
    // Create Networks
    StringSet connVA = new StringSet();
    connVA.add(varray1.getId().toString());
    Network networkFE1 = PlacementTestUtils.createNetwork(_dbClient, vplex1FE, "VSANFE1", "FC+BROCADE+FE", connVA);
    Network networkBE1 = PlacementTestUtils.createNetwork(_dbClient, vplex1BE, "VSANBE1", "FC+BROCADE+BE", connVA);
    connVA = new StringSet();
    connVA.add(varray2.getId().toString());
    Network networkFE2 = PlacementTestUtils.createNetwork(_dbClient, vplex2FE, "VSANFE2", "FC+CISCO+FE", connVA);
    Network networkBE2 = PlacementTestUtils.createNetwork(_dbClient, vplex2BE, "VSANBE2", "FC+CISCO+BE", connVA);
    // Create a storage system
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
    // 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, networkBE1, 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, networkBE2, vmax2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
    }
    // Create 2 VPLEX storage systems
    StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    // 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, networkFE1, vplex1FE[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE1" + i, "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, networkBE1, vplex1BE[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE1" + i, "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, networkFE2, vplex2FE[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE2" + i, "E0+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, networkBE2, vplex2BE[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE2" + i, "F0+FC0" + i));
    }
    // Create a storage pool
    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
    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
    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
    StoragePool pool4 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool4", "Pool4", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    StoragePool pool5 = PlacementTestUtils.createStoragePool(_dbClient, varray2, storageSystem2, "pool5", "Pool5", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool
    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 virtual pool
    VirtualPool vpool = new VirtualPool();
    vpool.setId(URI.create(haVpoolUri));
    vpool.setLabel("vpool");
    vpool.setType("block");
    vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool4.getId().toString());
    matchedPools.add(pool5.getId().toString());
    matchedPools.add(pool6.getId().toString());
    vpool.setMatchedStoragePools(matchedPools);
    StringSet virtualArrays2 = new StringSet();
    virtualArrays2.add(varray2.getId().toString());
    vpool.setVirtualArrays(virtualArrays2);
    vpool.setUseMatchedPools(true);
    _dbClient.createObject(vpool);
    // Create a VPLEX virtual pool
    VirtualPool vplexVpool = new VirtualPool();
    vplexVpool.setId(URI.create("vplexVpool"));
    vplexVpool.setLabel("vplexVpool");
    vplexVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vplexVpool.setDriveType(SupportedDriveTypes.FC.name());
    vplexVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
    StringMap vavpMap = new StringMap();
    vavpMap.put(varray2.getId().toString(), vpool.getId().toString());
    vplexVpool.setHaVarrayVpoolMap(vavpMap);
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    vplexVpool.setMatchedStoragePools(matchedPools);
    StringSet virtualArrays1 = new StringSet();
    virtualArrays1.add(varray1.getId().toString());
    vplexVpool.setVirtualArrays(virtualArrays1);
    vplexVpool.setUseMatchedPools(true);
    _dbClient.createObject(vplexVpool);
    // 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);
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // Run single volume placement: Run 10 times to make sure pool3 and pool6 never come up.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray1, project, vplexVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        assertNotNull(recommendations.get(1));
        VPlexRecommendation srcRec = (VPlexRecommendation) recommendations.get(0);
        _log.info("##################################" + srcRec.toString());
        VPlexRecommendation HARec = (VPlexRecommendation) recommendations.get(1);
        assertNotNull(srcRec.getSourceStoragePool());
        assertNotNull(srcRec.getSourceStorageSystem());
        assertNotNull(srcRec.getVPlexStorageSystem());
        assertNotNull(srcRec.getVirtualArray());
        assertNotNull(srcRec.getVirtualPool());
        assertNotNull(HARec.getSourceStoragePool());
        assertNotNull(HARec.getSourceStorageSystem());
        assertNotNull(HARec.getVPlexStorageSystem());
        assertNotNull(HARec.getVirtualArray());
        assertNotNull(HARec.getVirtualPool());
        assertTrue(("pool1".equals(srcRec.getSourceStoragePool().toString())) || ("pool2".equals(srcRec.getSourceStoragePool().toString())));
        assertTrue("vmax1".equals(srcRec.getSourceStorageSystem().toString()));
        assertTrue("vplex1".equals(srcRec.getVPlexStorageSystem().toString()));
        assertTrue("varray1".equals(srcRec.getVirtualArray().toString()));
        assertTrue("vplexVpool".equals(srcRec.getVirtualPool().getId().toString()));
        assertTrue(("pool4".equals(HARec.getSourceStoragePool().toString())) || ("pool5".equals(HARec.getSourceStoragePool().toString())));
        assertTrue("vmax2".equals(HARec.getSourceStorageSystem().toString()));
        assertTrue("vplex1".equals(HARec.getVPlexStorageSystem().toString()));
        assertTrue("varray2".equals(HARec.getVirtualArray().toString()));
        assertTrue(haVpoolUri.equals(HARec.getVirtualPool().getId().toString()));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Src Pool Chosen: " + srcRec.getSourceStoragePool().toString() + ", HA Pool Chosen: " + HARec.getSourceStoragePool().toString());
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringMap(com.emc.storageos.db.client.model.StringMap) StoragePool(com.emc.storageos.db.client.model.StoragePool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) NamedURI(com.emc.storageos.db.client.model.NamedURI) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Project(com.emc.storageos.db.client.model.Project) Network(com.emc.storageos.db.client.model.Network) StringSet(com.emc.storageos.db.client.model.StringSet) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Test(org.junit.Test)

Example 13 with VPlexRecommendation

use of com.emc.storageos.volumecontroller.VPlexRecommendation 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 14 with VPlexRecommendation

use of com.emc.storageos.volumecontroller.VPlexRecommendation 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)

Example 15 with VPlexRecommendation

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

the class VPlexBlockServiceApiImpl method upgradeToDistributed.

/**
 * Upgrade a local VPLEX volume to a distributed VPLEX volume.
 *
 * @param vplexURI -- VPLEX System URI
 * @param vplexVolume -- VPlex volume (existing).
 * @param vpool -- Requested vpool.
 * @param taskId
 * @throws InternalException
 */
private void upgradeToDistributed(URI vplexURI, Volume vplexVolume, VirtualPool vpool, String transferSpeed, String taskId) throws InternalException {
    try {
        VirtualArray neighborhood = _dbClient.queryObject(VirtualArray.class, vplexVolume.getVirtualArray());
        Set<URI> vplexes = new HashSet<URI>();
        vplexes.add(vplexURI);
        if (null == vplexVolume.getAssociatedVolumes() || vplexVolume.getAssociatedVolumes().isEmpty()) {
            s_logger.error("VPLEX volume {} has no backend volumes.", vplexVolume.forDisplay());
            throw InternalServerErrorException.internalServerErrors.noAssociatedVolumesForVPLEXVolume(vplexVolume.forDisplay());
        }
        Iterator<String> assocIter = vplexVolume.getAssociatedVolumes().iterator();
        URI existingVolumeURI = new URI(assocIter.next());
        Volume existingVolume = _dbClient.queryObject(Volume.class, existingVolumeURI);
        if (existingVolume == null || existingVolume.getInactive() == true) {
            throw new ServiceCodeException(ServiceCode.UNFORSEEN_ERROR, "Existing volume inactive", new Object[] {});
        }
        VirtualPoolCapabilityValuesWrapper cosCapabilities = new VirtualPoolCapabilityValuesWrapper();
        cosCapabilities.put(VirtualPoolCapabilityValuesWrapper.SIZE, getVolumeCapacity(existingVolume));
        cosCapabilities.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, new Integer(1));
        cosCapabilities.put(VirtualPoolCapabilityValuesWrapper.THIN_PROVISIONING, existingVolume.getThinlyProvisioned());
        // Get a recommendation.
        // Then create the volume.
        List<VolumeDescriptor> descriptors = new ArrayList<VolumeDescriptor>();
        Volume createVolume = null;
        // Determine if the user requested a specific HA VirtualArray and an associated HA VirtualPool.
        VirtualArray requestedHaVarray = null;
        VirtualPool requestedHaVirtualPool = vpool;
        if (vpool.getHaVarrayVpoolMap() != null && !vpool.getHaVarrayVpoolMap().isEmpty()) {
            for (String haNH : vpool.getHaVarrayVpoolMap().keySet()) {
                if (haNH.equals(NullColumnValueGetter.getNullURI().toString())) {
                    continue;
                }
                requestedHaVarray = _dbClient.queryObject(VirtualArray.class, new URI(haNH));
                String haVirtualPool = vpool.getHaVarrayVpoolMap().get(haNH);
                if (haVirtualPool.equals(NullColumnValueGetter.getNullURI().toString())) {
                    continue;
                }
                requestedHaVirtualPool = _dbClient.queryObject(VirtualPool.class, new URI(haVirtualPool));
                break;
            }
        }
        // Get the recommendations and pick one.
        List<Recommendation> recommendations = getBlockScheduler().scheduleStorageForImport(neighborhood, vplexes, requestedHaVarray, requestedHaVirtualPool, cosCapabilities);
        if (recommendations.isEmpty()) {
            throw APIException.badRequests.noStorageFoundForVolumeMigration(requestedHaVirtualPool.getLabel(), requestedHaVarray.getLabel(), existingVolume.getId());
        }
        Recommendation recommendation = recommendations.get(0);
        VPlexRecommendation vplexRecommendation = (VPlexRecommendation) recommendation;
        if (false == vplexURI.equals(vplexRecommendation.getVPlexStorageSystem())) {
            APIException.badRequests.vplexPlacementError(vplexVolume.getId());
        }
        StorageSystem vplexSystem = _dbClient.queryObject(StorageSystem.class, vplexURI);
        Project vplexProject = getVplexProject(vplexSystem, _dbClient, _tenantsService);
        // Prepare the created volume.
        VirtualArray haVirtualArray = _dbClient.queryObject(VirtualArray.class, vplexRecommendation.getVirtualArray());
        createVolume = prepareVolumeForRequest(getVolumeCapacity(existingVolume), vplexProject, haVirtualArray, requestedHaVirtualPool, vplexRecommendation.getSourceStorageSystem(), vplexRecommendation.getSourceStoragePool(), vplexVolume.getLabel() + "-1", ResourceOperationTypeEnum.CREATE_BLOCK_VOLUME, taskId, _dbClient);
        createVolume.addInternalFlags(Flag.INTERNAL_OBJECT);
        _dbClient.updateObject(createVolume);
        VolumeDescriptor desc = new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA, createVolume.getStorageController(), createVolume.getId(), createVolume.getPool(), cosCapabilities);
        descriptors.add(desc);
        // Add a descriptor for the VPlex Virtual Volume.
        desc = new VolumeDescriptor(VolumeDescriptor.Type.VPLEX_VIRT_VOLUME, vplexVolume.getStorageController(), vplexVolume.getId(), vplexVolume.getPool(), cosCapabilities);
        descriptors.add(desc);
        // Now send the command to the controller.
        try {
            s_logger.info("Calling VPlex controller.");
            VPlexController controller = getController();
            controller.importVolume(vplexURI, descriptors, null, null, vpool.getId(), null, transferSpeed, Boolean.TRUE, taskId);
        // controller.importVolume(vplexURI, vpool.getId(),
        // null, null, /* no need to pass System Project/Tenant */
        // null, /* no import volume */
        // createVolume.getId(), vplexVolume.getId(), taskId);
        } catch (InternalException ex) {
            s_logger.error("ControllerException on upgradeToDistributed", ex);
            String errMsg = String.format("ControllerException: %s", ex.getMessage());
            Operation statusUpdate = new Operation(Operation.Status.error.name(), errMsg);
            _dbClient.updateTaskOpStatus(Volume.class, vplexVolume.getId(), taskId, statusUpdate);
            throw ex;
        }
    } catch (URISyntaxException ex) {
        s_logger.debug("URISyntaxException", ex);
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) VPlexController(com.emc.storageos.vplexcontroller.VPlexController) ServiceCodeException(com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Operation(com.emc.storageos.db.client.model.Operation) URISyntaxException(java.net.URISyntaxException) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) VolumeRecommendation(com.emc.storageos.api.service.impl.placement.VolumeRecommendation) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Project(com.emc.storageos.db.client.model.Project) Volume(com.emc.storageos.db.client.model.Volume) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

VPlexRecommendation (com.emc.storageos.volumecontroller.VPlexRecommendation)24 ArrayList (java.util.ArrayList)21 Recommendation (com.emc.storageos.volumecontroller.Recommendation)17 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)15 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)15 URI (java.net.URI)15 List (java.util.List)15 NamedURI (com.emc.storageos.db.client.model.NamedURI)13 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)13 Project (com.emc.storageos.db.client.model.Project)11 StoragePool (com.emc.storageos.db.client.model.StoragePool)11 SRDFCopyRecommendation (com.emc.storageos.volumecontroller.SRDFCopyRecommendation)11 VirtualPoolCapabilityValuesWrapper (com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper)11 StringSet (com.emc.storageos.db.client.model.StringSet)10 SRDFRecommendation (com.emc.storageos.volumecontroller.SRDFRecommendation)10 Volume (com.emc.storageos.db.client.model.Volume)8 FCTN_STRING_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI)8 FCTN_VPLEX_MIRROR_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI)8 RPRecommendation (com.emc.storageos.volumecontroller.RPRecommendation)8 VolumeRecommendation (com.emc.storageos.api.service.impl.placement.VolumeRecommendation)7