Search in sources :

Example 56 with StoragePort

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

the class PlacementTests method testPlacementVPlexXIO.

/**
 * Simple VPLEX local XIO block placement.
 */
@Test
public void testPlacementVPlexXIO() {
    String[] vplexFE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
    String[] vplexBE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
    String[] xio1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
    String[] xio2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
    String[] xio3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
    // Create a Network
    Network networkFE = PlacementTestUtils.createNetwork(_dbClient, vplexFE, "VSANFE", "FC+BROCADE+FE", null);
    Network networkBE = PlacementTestUtils.createNetwork(_dbClient, vplexBE, "VSANBE", "FC+BROCADE+BE", null);
    // Create a Virtual Array
    VirtualArray varray = PlacementTestUtils.createVirtualArray(_dbClient, "varray1");
    // Create 3 storage systems for xio
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio1");
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio2");
    StorageSystem storageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "xtremio", "xtremio3");
    // Create two front-end storage ports xio1
    List<StoragePort> xio1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio1FE.length; i++) {
        xio1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem1, networkBE, xio1FE[i], varray, StoragePort.PortType.frontend.name(), "portGroupXio1" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports xio2
    List<StoragePort> xio2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio2FE.length; i++) {
        xio2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem2, networkBE, xio2FE[i], varray, StoragePort.PortType.frontend.name(), "portGroupXio2" + i, "D0+FC0" + i));
    }
    // Create two front-end storage ports xio3
    List<StoragePort> xio3Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < xio3FE.length; i++) {
        xio3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, storageSystem3, networkBE, xio3FE[i], varray, StoragePort.PortType.frontend.name(), "portGroupXio3" + i, "E0+FC0" + i));
    }
    // Create a VPLEX storage system
    StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
    // Create two front-end storage ports VPLEX
    List<StoragePort> fePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexFE.length; i++) {
        fePorts.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem, networkFE, vplexFE[i], varray, StoragePort.PortType.frontend.name(), "portGroupFE" + i, "A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX
    List<StoragePort> bePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexBE.length; i++) {
        bePorts.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem, networkBE, vplexBE[i], varray, StoragePort.PortType.backend.name(), "portGroupBE" + i, "B0+FC0" + i));
    }
    // Create a storage pool on xio1
    StoragePool pool1 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem1, "pool1", "Pool1", Long.valueOf(1024 * 1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool on xio2
    StoragePool pool2 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem2, "pool2", "Pool2", Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a storage pool on xio3
    StoragePool pool3 = PlacementTestUtils.createStoragePool(_dbClient, varray, storageSystem3, "pool3", "Pool3", Long.valueOf(1024 * 10), Long.valueOf(1024 * 1024 * 10), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
    // Create a virtual pool
    VirtualPool vpool = new VirtualPool();
    vpool.setId(URI.create("vpool"));
    vpool.setLabel("vpool");
    vpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vpool.setDriveType(SupportedDriveTypes.FC.name());
    StringSet matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    vpool.setMatchedStoragePools(matchedPools);
    vpool.setUseMatchedPools(true);
    _dbClient.createObject(vpool);
    // Create a VPLEX virtual pool
    VirtualPool vplexVpool = new VirtualPool();
    vplexVpool.setId(URI.create("vplexVpool"));
    vplexVpool.setLabel("vplexVpool");
    vplexVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
    vplexVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
    // 
    vplexVpool.setDriveType(SupportedDriveTypes.FC.name());
    matchedPools = new StringSet();
    matchedPools.add(pool1.getId().toString());
    matchedPools.add(pool2.getId().toString());
    matchedPools.add(pool3.getId().toString());
    vplexVpool.setMatchedStoragePools(matchedPools);
    vplexVpool.setUseMatchedPools(true);
    _dbClient.createObject(vplexVpool);
    // Create a project object
    Project project = new Project();
    project.setId(URI.create("project"));
    project.setLabel("project");
    _dbClient.createObject(project);
    VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("2GB", 1, null);
    // Run single volume placement: Run 10 times to make sure pool2 nRever comes up.
    for (int i = 0; i < 10; i++) {
        List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, varray, project, vplexVpool, capabilities);
        assertNotNull(recommendations);
        assertTrue(!recommendations.isEmpty());
        assertNotNull(recommendations.get(0));
        VPlexRecommendation rec = (VPlexRecommendation) recommendations.get(0);
        assertNotNull(rec.getSourceStoragePool());
        assertNotNull(rec.getSourceStorageSystem());
        assertNotNull(rec.getVPlexStorageSystem());
        assertTrue(("xtremio3".equals(rec.getSourceStorageSystem().toString())) || ("xtremio1".equals(rec.getSourceStorageSystem().toString())));
        assertTrue("vplex1".equals(rec.getVPlexStorageSystem().toString()));
        assertTrue(("pool3".equals(rec.getSourceStoragePool().toString())) || ("pool1".equals(rec.getSourceStoragePool().toString())));
        _log.info("Recommendation " + i + ": " + recommendations.size() + ", Pool Chosen: " + rec.getSourceStoragePool().toString());
        _log.info(rec.toString());
    }
}
Also used : VirtualPoolCapabilityValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) 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) List(java.util.List) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) Test(org.junit.Test)

Example 57 with StoragePort

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

the class ExportUtilsTests method populateDb.

/**
 * Populate the database with ITL components
 */
public void populateDb() {
    String[] vmaxFE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01", "50:FE:FE:FE:FE:FE:FE:02", "50:FE:FE:FE:FE:FE:FE:03" };
    // Create a Network
    Network network = ExportUtilsTestUtils.createNetwork(_dbClient, vmaxFE, "VSANFE", "FC+BROCADE+FE", null);
    // Create a Virtual Array
    VirtualArray varray = ExportUtilsTestUtils.createVirtualArray(_dbClient, "varray1");
    // Create a storage system
    StorageSystem storageSystem = ExportUtilsTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
    // Create two front-end storage ports VMAX
    List<StoragePort> vmaxPorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vmaxFE.length; i++) {
        vmaxPorts.add(ExportUtilsTestUtils.createStoragePort(_dbClient, storageSystem, network, vmaxFE[i], varray, StoragePort.PortType.frontend.name(), "portGroupvmax" + i, "C0+FC0" + i));
    }
    // Create initiators
    List<Initiator> initiators = new ArrayList<Initiator>();
    for (int i = 0; i < NUM_INITIATORS; i++) {
        initiators.add(ExportUtilsTestUtils.createInitiator(_dbClient, network, i));
    }
    // Create Volumes
    List<Volume> volumes = new ArrayList<Volume>();
    for (int i = 0; i < NUM_VOLUMES; i++) {
        Volume volume = ExportUtilsTestUtils.createVolume(_dbClient, varray, i);
        volumes.add(volume);
        _volumeIds.add(volume.getId());
    }
    // Create export groups
    List<ExportGroup> egs = new ArrayList<ExportGroup>();
    for (int i = 0; i < NUM_EXPORT_GROUPS; i++) {
        egs.add(ExportUtilsTestUtils.createExportGroup(_dbClient, initiators, volumes, varray, i));
    }
    // Create export masks
    List<ExportMask> ems = new ArrayList<ExportMask>();
    for (int i = 0; i < NUM_EXPORT_MASKS; i++) {
        ems.add(ExportUtilsTestUtils.createExportMask(_dbClient, egs, initiators, volumes, vmaxPorts, i));
    }
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) ExportMask(com.emc.storageos.db.client.model.ExportMask) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) ExportGroup(com.emc.storageos.db.client.model.ExportGroup) Initiator(com.emc.storageos.db.client.model.Initiator) Volume(com.emc.storageos.db.client.model.Volume) Network(com.emc.storageos.db.client.model.Network) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 58 with StoragePort

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

the class UcsComputeDevice method getHBAToStoragePorts.

private Map<String, Map<String, Integer>> getHBAToStoragePorts(URI volumeId, URI hostId) {
    Host host = _dbClient.queryObject(Host.class, hostId);
    Map<String, String> initiatorToHBAMapping = getInitiatorToHBAMapping(host.getComputeElement());
    Volume volume = _dbClient.queryObject(Volume.class, volumeId);
    List<Initiator> initiators = CustomQueryUtility.queryActiveResourcesByRelation(_dbClient, hostId, Initiator.class, "host");
    Map<ExportMask, ExportGroup> exportMasks = ExportUtils.getExportMasks(volume, _dbClient);
    Map<String, Map<String, Integer>> hbaToStoragePortMapForBoot = new HashMap<String, Map<String, Integer>>();
    for (Initiator initiator : initiators) {
        for (ExportMask exportMask : exportMasks.keySet()) {
            List<URI> storagePorts = ExportUtils.getInitiatorPortsInMask(exportMask, initiator, _dbClient);
            if (storagePorts != null && !storagePorts.isEmpty()) {
                Integer volumeHLU = Integer.valueOf(exportMask.getVolumes().get(volumeId.toString()));
                for (URI storagePortUri : storagePorts) {
                    StoragePort port = _dbClient.queryObject(StoragePort.class, storagePortUri);
                    String hbaName = initiatorToHBAMapping.get(initiator.getInitiatorPort());
                    if (hbaName != null) {
                        if (hbaToStoragePortMapForBoot.get(hbaName) == null) {
                            hbaToStoragePortMapForBoot.put(hbaName, new HashMap<String, Integer>());
                        }
                        hbaToStoragePortMapForBoot.get(hbaName).put(port.getPortNetworkId(), volumeHLU);
                    }
                }
            }
        }
    }
    return hbaToStoragePortMapForBoot;
}
Also used : HashMap(java.util.HashMap) ExportMask(com.emc.storageos.db.client.model.ExportMask) StoragePort(com.emc.storageos.db.client.model.StoragePort) Host(com.emc.storageos.db.client.model.Host) URI(java.net.URI) ExportGroup(com.emc.storageos.db.client.model.ExportGroup) Volume(com.emc.storageos.db.client.model.Volume) Initiator(com.emc.storageos.db.client.model.Initiator) Map(java.util.Map) HashMap(java.util.HashMap)

Example 59 with StoragePort

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

the class PlacementTestUtils method createStoragePort.

public static StoragePort createStoragePort(DbClient dbClient, DiscoveredSystemObject storageSystem, Network network, String portNetworkId, VirtualArray varray, String portType, String portGroup, String portName) {
    StoragePort storagePort = new StoragePort();
    portName = storageSystem.getLabel() + ":" + portName;
    storagePort.setId(URI.create(portName));
    storagePort.setLabel(portName);
    storagePort.setStorageDevice(storageSystem.getId());
    storagePort.addAssignedVirtualArray(varray.getId().toString());
    storagePort.setOperationalStatus(StoragePort.OperationalStatus.OK.toString());
    storagePort.setNetwork(network.getId());
    storagePort.setPortGroup(portGroup);
    storagePort.setPortName(portName);
    storagePort.setPortNetworkId(portNetworkId);
    storagePort.setPortType(portType);
    storagePort.setNativeGuid(portName);
    storagePort.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
    dbClient.createObject(storagePort);
    return storagePort;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort)

Example 60 with StoragePort

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

the class PlacementTestUtils method createStorageSystem.

public static StorageSystem createStorageSystem(DbClient dbClient, String label, Network network, String[] portWWNs, VirtualArray varray) {
    StorageSystem storageSystem = PlacementTestUtils.createStorageSystem(dbClient, "vmax", label);
    // Create two front-end storage ports system1.
    List<StoragePort> system1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < portWWNs.length; i++) {
        system1Ports.add(PlacementTestUtils.createStoragePort(dbClient, storageSystem, network, portWWNs[i], varray, StoragePort.PortType.frontend.name(), "portGroupSite3vmax" + i, label + "_C0+FC0" + i));
    }
    return storageSystem;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StoragePort (com.emc.storageos.db.client.model.StoragePort)477 URI (java.net.URI)285 ArrayList (java.util.ArrayList)261 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)143 HashMap (java.util.HashMap)134 List (java.util.List)130 NetworkLite (com.emc.storageos.util.NetworkLite)110 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)107 StringSet (com.emc.storageos.db.client.model.StringSet)92 PortAllocationContext (com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)84 HashSet (java.util.HashSet)81 Initiator (com.emc.storageos.db.client.model.Initiator)78 Map (java.util.Map)64 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)62 StoragePool (com.emc.storageos.db.client.model.StoragePool)51 IOException (java.io.IOException)48 StringMap (com.emc.storageos.db.client.model.StringMap)45 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)43 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)42 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)34