use of com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper in project coprhd-controller by CoprHD.
the class BlockStorageDeviceTest method performOperation.
private void performOperation(Operation operation) {
String taskId = UUID.randomUUID().toString();
if (Operation.Create.equals(operation)) {
List<Volume> volumes = createVolumes();
VirtualPoolCapabilityValuesWrapper capabilities = new VirtualPoolCapabilityValuesWrapper();
TaskCompleter taskCompleter = new VolumeCreateCompleter(volumes.get(0).getId(), taskId);
_deviceController.doCreateVolumes(_storageSystem, _storagePool, taskId, volumes, capabilities, taskCompleter);
// TODO - assert vols are created
// update vol labels with real label
} else if (Operation.Expand.equals(operation)) {
List<Volume> volumes = getVolumes(_storageSystem);
Volume volume = volumes.get(0);
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, volume.getPool());
long size = volume.getProvisionedCapacity() * 2;
TaskCompleter taskCompleter = new VolumeExpandCompleter(volume.getId(), size, taskId);
_deviceController.doExpandVolume(_storageSystem, storagePool, volume, size, taskCompleter);
// TODO - assert original vol's size (provisionedCapacity or
// capacity??) are changed
} else if (Operation.Delete.equals(operation)) {
List<Volume> volumes = getVolumes(_storageSystem);
List<URI> ids = new ArrayList<URI>(volumes.size());
List<VolumeTaskCompleter> volumeTaskCompleters = new ArrayList<>(volumes.size());
for (Volume volume : volumes) {
URI uri = volume.getId();
ids.add(uri);
volumeTaskCompleters.add(new VolumeCreateCompleter(uri, taskId));
}
MultiVolumeTaskCompleter multiTaskCompleter = new MultiVolumeTaskCompleter(ids, volumeTaskCompleters, taskId);
_deviceController.doDeleteVolumes(_storageSystem, taskId, volumes, multiTaskCompleter);
// TODO - assert vols are deleted from db
}
}
use of com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper in project coprhd-controller by CoprHD.
the class VPlexDeviceController method createDescriptorForBlockVolumeCreation.
/**
* Create a descriptor for the passed volume.
*
* @param storagePoolURI
* URI of the storage pool.
* @param volumeURI
* URI of the volume.
* @param storageSystemMap
* An OUT parameters specifying the list of storage
* systems on which volumes are created.
* @param volumeMap
* An OUT parameter specifying the full list volumes to be
* created.
*
* @return The descriptor for the pool volume.
*
* @throws IOException
* When an error occurs.
* @throws WorkflowException
*/
private VolumeDescriptor createDescriptorForBlockVolumeCreation(URI storagePoolURI, URI volumeURI, Map<URI, StorageSystem> storageSystemMap, Map<URI, Volume> volumeMap) throws IOException, WorkflowException {
// Get the storage pool to hold the backend block volumes.
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, storagePoolURI);
// Get the storage system for this pool. Check the map
// as we cache the storage systems in the passed map, so
// we don't retrieve them multiple times from the database.
URI storageSystemURI = storagePool.getStorageDevice();
StorageSystem storageSystem = null;
if (storageSystemMap.containsKey(storageSystemURI)) {
storageSystem = storageSystemMap.get(storageSystemURI);
} else {
storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
storageSystemMap.put(storageSystemURI, storageSystem);
}
// Get the volume.
Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
// Cache the volumes, like the storage systems, in the
// passed volume map so that we don't access the database
// multiple time.
volumeMap.put(volumeURI, volume);
// Create a descriptor for the volume.
URI cgURI = null;
if (!NullColumnValueGetter.isNullURI(volume.getConsistencyGroup())) {
cgURI = volume.getConsistencyGroup();
}
VirtualPoolCapabilityValuesWrapper capabilities = new VirtualPoolCapabilityValuesWrapper();
capabilities.put(VirtualPoolCapabilityValuesWrapper.SIZE, volume.getCapacity());
capabilities.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, new Integer(1));
return new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA, storageSystemURI, volumeURI, storagePoolURI, cgURI, capabilities);
}
use of com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper in project coprhd-controller by CoprHD.
the class VPlexDeviceController method prepareVolumeDescriptor.
/**
* Create a volume instance and VolumeDescriptor using the characteristics of the passed in source volume.
*
* @param source
* - The volume will be used to create the volume instance
* @param name
* - The new volume label
* @param type
* - VolumeDescriptor type
* @param size
* - The volume size
* @param isInternal
* -If the volume is internal
* @return - The newly created VolumeDescriptor
*/
private VolumeDescriptor prepareVolumeDescriptor(Volume source, String name, VolumeDescriptor.Type type, long size, boolean isInternal) {
Volume volume = new Volume();
volume.setId(URIUtil.createId(Volume.class));
volume.setLabel(name);
volume.setCapacity(size);
URI vpoolUri = source.getVirtualPool();
VirtualPool vpool = getDataObject(VirtualPool.class, vpoolUri, _dbClient);
volume.setThinlyProvisioned(VirtualPool.ProvisioningType.Thin.toString().equalsIgnoreCase(vpool.getSupportedProvisioningType()));
volume.setVirtualPool(vpool.getId());
URI projectId = source.getProject().getURI();
Project project = getDataObject(Project.class, projectId, _dbClient);
volume.setProject(new NamedURI(projectId, volume.getLabel()));
volume.setTenant(new NamedURI(project.getTenantOrg().getURI(), volume.getLabel()));
volume.setVirtualArray(source.getVirtualArray());
volume.setPool(source.getPool());
volume.setProtocol(source.getProtocol());
volume.setStorageController(source.getStorageController());
volume.setSystemType(source.getSystemType());
if (isInternal) {
volume.addInternalFlags(Flag.INTERNAL_OBJECT);
}
_dbClient.createObject(volume);
VirtualPoolCapabilityValuesWrapper capabilities = getCapabilities(source, size);
return new VolumeDescriptor(type, volume.getStorageController(), volume.getId(), volume.getPool(), capabilities);
}
use of com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper in project coprhd-controller by CoprHD.
the class ExportUtilsTestUtils method createCapabilities.
public static VirtualPoolCapabilityValuesWrapper createCapabilities(String size, int count, BlockConsistencyGroup cg) {
VirtualPoolCapabilityValuesWrapper capabilities = new VirtualPoolCapabilityValuesWrapper();
Long volumeSize = SizeUtil.translateSize(size);
capabilities.put(VirtualPoolCapabilityValuesWrapper.SIZE, volumeSize);
capabilities.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, count);
capabilities.put(VirtualPoolCapabilityValuesWrapper.THIN_PROVISIONING, Boolean.TRUE);
Set<String> protocols = new HashSet<>();
protocols.add("FC");
capabilities.put(VirtualPoolCapabilityValuesWrapper.PROTOCOLS, protocols);
if (cg != null) {
capabilities.put(VirtualPoolCapabilityValuesWrapper.BLOCK_CONSISTENCY_GROUP, cg.getId());
}
return capabilities;
}
use of com.emc.storageos.volumecontroller.impl.utils.VirtualPoolCapabilityValuesWrapper 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());
}
}
Aggregations