use of com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation in project coprhd-controller by CoprHD.
the class SRDFBlockServiceApiImpl method computeCapacityforSRDFV3ToV2.
/**
* SRDF between VMAX3 to VMAX2 is failing due to configuration mismatch (OPT#475186).
* As a workaround, calculate the VMAX2 volume size based on the VMAX3 cylinder size.
*
* @param targetVolume
* @param vpool
*/
private void computeCapacityforSRDFV3ToV2(Volume targetVolume, final VirtualPool vpool) {
if (targetVolume == null) {
return;
}
StorageSystem targetSystem = _dbClient.queryObject(StorageSystem.class, targetVolume.getStorageController());
StoragePool targetPool = _dbClient.queryObject(StoragePool.class, targetVolume.getPool());
Volume sourceVolume = _dbClient.queryObject(Volume.class, targetVolume.getSrdfParent());
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceVolume.getStorageController());
StoragePool sourcePool = _dbClient.queryObject(StoragePool.class, sourceVolume.getPool());
if (sourceSystem != null && targetSystem != null) {
boolean isCapacityReset = false;
if (sourcePool != null && targetPool != null) {
// Meta Versus Non Meta
MetaVolumeRecommendation sourceVolumeRecommendation = MetaVolumeUtils.getCreateRecommendation(sourceSystem, sourcePool, sourceVolume.getCapacity(), sourceVolume.getThinlyProvisioned(), vpool.getFastExpansion(), null);
MetaVolumeRecommendation targetVolumeRecommendation = MetaVolumeUtils.getCreateRecommendation(targetSystem, targetPool, targetVolume.getCapacity(), targetVolume.getThinlyProvisioned(), vpool.getFastExpansion(), null);
isCapacityReset = computeCapacityforSRDFV3ToV2Meta(sourcePool, targetPool, sourceVolume, targetVolume, sourceVolumeRecommendation, targetVolumeRecommendation);
}
// Source : VMAX3 & Target : VMAX2 case
if (sourceSystem.checkIfVmax3() && !targetSystem.checkIfVmax3() && !isCapacityReset) {
Long cylinderCount = (long) Math.ceil((double) targetVolume.getCapacity() / V3CYLINDERSIZE);
targetVolume.setCapacity(cylinderCount * V3CYLINDERSIZE);
_log.info("Cylinder Count : {}, VMAX2 volume Capacity : {}", cylinderCount, targetVolume.getCapacity());
}
}
}
use of com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation in project coprhd-controller by CoprHD.
the class VmaxCapacityCalculator method calculateAllocatedCapacity.
/**
* {@inheritDoc}
*/
@Override
public Long calculateAllocatedCapacity(Long requestedCapacity, Volume volume, DbClient dbClient) {
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, volume.getStorageController());
if (requestedCapacity != null) {
long bytesPerCylinder = 0L;
if (storageSystem != null && storageSystem.checkIfVmax3()) {
bytesPerCylinder = (tracksPerCylinder * blocksPerTrackVMAX3 * bytesPerBlock);
} else {
bytesPerCylinder = (tracksPerCylinder * blocksPerTrack * bytesPerBlock);
VirtualPool vPool = dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
StoragePool storagePool = dbClient.queryObject(StoragePool.class, volume.getPool());
// Determine if we are provisioning meta volumes. Meta volume provisioning only applies to non-VMAX3.
MetaVolumeRecommendation metaRecommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, requestedCapacity, volume.getThinlyProvisioned(), vPool.getFastExpansion(), null);
if (metaRecommendation.isCreateMetaVolumes()) {
long metaCount = metaRecommendation.getMetaMemberCount();
long metaSize = metaRecommendation.getMetaMemberSize();
long metaCylinderCount = getCylinderCount(metaSize, bytesPerCylinder);
long allocatedSingleMetaCapacity = (metaCylinderCount * bytesPerCylinder);
// Return the total meta allocation size
long allocatedMetaCapacity = (metaCount * allocatedSingleMetaCapacity);
logger.info(String.format("Determined that volume %s is being provisioned as meta volumes. Allocated capacity per meta will be %d. Total volume allocation (%d metas) will be %d.", volume.getLabel(), allocatedSingleMetaCapacity, metaCount, allocatedMetaCapacity));
return allocatedMetaCapacity;
}
}
long cyls = getCylinderCount(requestedCapacity, bytesPerCylinder);
return (cyls * bytesPerCylinder);
}
return requestedCapacity;
}
use of com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation in project coprhd-controller by CoprHD.
the class BlockDeviceController method expandVolume.
@Override
public void expandVolume(URI storage, URI pool, URI volume, Long size, String opId) throws ControllerException {
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
Volume volumeObj = _dbClient.queryObject(Volume.class, volume);
_log.info(String.format("expandVolume start - Array: %s Pool:%s Volume:%s, IsMetaVolume: %s, OldSize: %s, NewSize: %s", storage.toString(), pool.toString(), volume.toString(), volumeObj.getIsComposite(), volumeObj.getCapacity(), size));
StoragePool poolObj = _dbClient.queryObject(StoragePool.class, pool);
VolumeExpandCompleter completer = new VolumeExpandCompleter(volume, size, opId);
long metaMemberSize = volumeObj.getIsComposite() ? volumeObj.getMetaMemberSize() : volumeObj.getCapacity();
long metaCapacity = volumeObj.getIsComposite() ? volumeObj.getTotalMetaMemberCapacity() : volumeObj.getCapacity();
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volumeObj.getVirtualPool());
boolean isThinlyProvisioned = volumeObj.getThinlyProvisioned();
MetaVolumeRecommendation recommendation = MetaVolumeUtils.getExpandRecommendation(storageObj, poolObj, metaCapacity, size, metaMemberSize, isThinlyProvisioned, vpool.getFastExpansion());
if (recommendation.isCreateMetaVolumes()) {
// Also check that this is not recovery to clean dangling meta volumes with zero-capacity expansion.
if (recommendation.getMetaMemberCount() == 0 && (volumeObj.getMetaVolumeMembers() == null || volumeObj.getMetaVolumeMembers().isEmpty())) {
volumeObj.setCapacity(size);
_dbClient.updateObject(volumeObj);
_log.info(String.format("Expanded volume within its total meta volume capacity (simple case) - Array: %s Pool:%s Volume:%s, IsMetaVolume: %s, Total meta volume capacity: %s, NewSize: %s", storage.toString(), pool.toString(), volume.toString(), volumeObj.getIsComposite(), volumeObj.getTotalMetaMemberCapacity(), volumeObj.getCapacity()));
completer.ready(_dbClient);
} else {
// set meta related data in task completer
long metaMemberCount = volumeObj.getIsComposite() ? recommendation.getMetaMemberCount() + volumeObj.getMetaMemberCount() : recommendation.getMetaMemberCount() + 1;
completer.setMetaMemberSize(recommendation.getMetaMemberSize());
completer.setMetaMemberCount((int) metaMemberCount);
completer.setTotalMetaMembersSize(metaMemberCount * recommendation.getMetaMemberSize());
completer.setComposite(true);
completer.setMetaVolumeType(recommendation.getMetaVolumeType().toString());
getDevice(storageObj.getSystemType()).doExpandAsMetaVolume(storageObj, poolObj, volumeObj, size, recommendation, completer);
}
} else {
// expand as regular volume
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_080);
getDevice(storageObj.getSystemType()).doExpandVolume(storageObj, poolObj, volumeObj, size, completer);
}
_log.info(String.format("expandVolume end - Array: %s Pool:%s Volume:%s", storage.toString(), pool.toString(), volume.toString()));
} catch (Exception e) {
_log.error(String.format("expandVolume Failed - Array: %s Pool:%s Volume:%s", storage.toString(), pool.toString(), volume.toString()), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
List<URI> volumes = Arrays.asList(volume);
doFailTask(Volume.class, volumes, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation in project coprhd-controller by CoprHD.
the class BlockDeviceController method createMetaVolumes.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMetaVolumesMethod just above
* (except opId).
*/
@Override
public void createMetaVolumes(URI systemURI, URI poolURI, List<URI> volumeURIs, VirtualPoolCapabilityValuesWrapper capabilities, String opId) throws ControllerException {
boolean opCreateFailed = false;
List<Volume> volumes = new ArrayList<Volume>();
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
List<VolumeTaskCompleter> volumeCompleters = new ArrayList<VolumeTaskCompleter>();
Iterator<URI> volumeURIsIter = volumeURIs.iterator();
StringBuilder logMsgBuilder = new StringBuilder(String.format("createMetaVolumes start - Array:%s Pool:%s", systemURI.toString(), poolURI.toString()));
while (volumeURIsIter.hasNext()) {
URI volumeURI = volumeURIsIter.next();
logMsgBuilder.append(String.format("%nVolume:%s", volumeURI.toString()));
Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
volumes.add(volume);
VolumeCreateCompleter volumeCompleter = new VolumeCreateCompleter(volumeURI, opId);
volumeCompleters.add(volumeCompleter);
}
_log.info(logMsgBuilder.toString());
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, poolURI);
MultiVolumeTaskCompleter completer = new MultiVolumeTaskCompleter(volumeURIs, volumeCompleters, opId);
Volume volume = volumes.get(0);
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
// All volumes are in the same storage pool with the same capacity. Get recommendation for the first volume.
MetaVolumeRecommendation recommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, volume.getCapacity(), volume.getThinlyProvisioned(), vpool.getFastExpansion(), capabilities);
for (Volume metaVolume : volumes) {
MetaVolumeUtils.prepareMetaVolume(metaVolume, recommendation.getMetaMemberSize(), recommendation.getMetaMemberCount(), recommendation.getMetaVolumeType().toString(), _dbClient);
}
WorkflowStepCompleter.stepExecuting(completer.getOpId());
getDevice(storageSystem.getSystemType()).doCreateMetaVolumes(storageSystem, storagePool, volumes, capabilities, recommendation, completer);
logMsgBuilder = new StringBuilder(String.format("createMetaVolumes end - Array:%s Pool:%s", systemURI.toString(), poolURI.toString()));
volumeURIsIter = volumeURIs.iterator();
while (volumeURIsIter.hasNext()) {
logMsgBuilder.append(String.format("%nVolume:%s", volumeURIsIter.next().toString()));
}
_log.info(logMsgBuilder.toString());
} catch (InternalException e) {
_log.error(String.format("createMetaVolumes Failed - Array: %s Pool:%s Volume:%s", systemURI.toString(), poolURI.toString(), Joiner.on("\t").join(volumeURIs)));
doFailTask(Volume.class, volumeURIs, opId, e);
WorkflowStepCompleter.stepFailed(opId, e);
opCreateFailed = true;
} catch (Exception e) {
_log.error(String.format("createMetaVolumes Failed - Array: %s Pool:%s Volume:%s", systemURI.toString(), poolURI.toString(), Joiner.on("\t").join(volumeURIs)));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
doFailTask(Volume.class, volumeURIs, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
opCreateFailed = true;
}
if (opCreateFailed) {
for (Volume volume : volumes) {
volume.setInactive(true);
_dbClient.updateObject(volume);
}
}
}
use of com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation in project coprhd-controller by CoprHD.
the class BlockDeviceController method createMetaVolume.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMetaVolumeMethod just above
* (except opId).
*/
@Override
public void createMetaVolume(URI systemURI, URI poolURI, URI volumeURI, VirtualPoolCapabilityValuesWrapper capabilities, String opId) throws ControllerException {
try {
StringBuilder logMsgBuilder = new StringBuilder(String.format("createMetaVolume start - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
_log.info(logMsgBuilder.toString());
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, poolURI);
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
MetaVolumeRecommendation recommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, volume.getCapacity(), volume.getThinlyProvisioned(), vpool.getFastExpansion(), capabilities);
MetaVolumeUtils.prepareMetaVolume(volume, recommendation.getMetaMemberSize(), recommendation.getMetaMemberCount(), recommendation.getMetaVolumeType().toString(), _dbClient);
VolumeCreateCompleter completer = new VolumeCreateCompleter(volumeURI, opId);
WorkflowStepCompleter.stepExecuting(completer.getOpId());
getDevice(storageSystem.getSystemType()).doCreateMetaVolume(storageSystem, storagePool, volume, capabilities, recommendation, completer);
logMsgBuilder = new StringBuilder(String.format("createMetaVolume end - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
_log.info(logMsgBuilder.toString());
} catch (InternalException e) {
_log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
doFailTask(Volume.class, volumeURI, opId, e);
WorkflowStepCompleter.stepFailed(opId, e);
} catch (Exception e) {
_log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
doFailTask(Volume.class, volumeURI, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
Aggregations