use of com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMetaVolumeHeadJob in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method createMetaVolumeHead.
/**
* Create meta volume head device. Meta volume is represented by its head.
* We create it as a regular bound volume.
*
* @param storageSystem
* @param storagePool
* @param metaHead
* @param capacity
* @param capabilities
* @param metaVolumeTaskCompleter
* @throws Exception
*/
@Override
public void createMetaVolumeHead(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, long capacity, VirtualPoolCapabilityValuesWrapper capabilities, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
String label;
_log.info(String.format("Create Meta Volume Head Start - Array: %s, Pool: %s, %n Head: %s, IsThinlyProvisioned: %s, Capacity: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel(), metaHead.getThinlyProvisioned(), capacity));
String tenantName = "";
try {
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, metaHead.getTenant().getURI());
tenantName = tenant.getLabel();
} catch (DatabaseException e) {
_log.error("Error lookup TenantOrb object", e);
}
label = _nameGenerator.generate(tenantName, metaHead.getLabel(), metaHead.getId().toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
boolean isThinlyProvisioned = metaHead.getThinlyProvisioned();
// Thin stripe meta heads should be created unbound from pool on VMAX
// Thin concatenated meta heads are created unbound from pool on vmax as well.
// This is done to preallocate capacity later when meta volume is bound to pool.
boolean isBoundToPool = !(isThinlyProvisioned && DiscoveredDataObject.Type.vmax.toString().equalsIgnoreCase(storageSystem.getSystemType()));
try {
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
CIMArgument[] inArgs;
// only for vnxBlock, we need to associate StoragePool Setting as Goal
if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(storageSystem.getSystemType())) {
inArgs = _helper.getCreateVolumesInputArgumentsOnFastEnabledPool(storageSystem, storagePool, label, capacity, 1, isThinlyProvisioned, capabilities.getAutoTierPolicyName());
} else {
inArgs = _helper.getCreateVolumesInputArguments(storageSystem, storagePool, label, capacity, 1, isThinlyProvisioned, null, isBoundToPool);
}
CIMArgument[] outArgs = new CIMArgument[5];
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
SmisCreateMetaVolumeHeadJob smisJobCompleter = new SmisCreateMetaVolumeHeadJob(null, forProvider.getId(), metaVolumeTaskCompleter, metaHead.getId());
_helper.invokeMethodSynchronously(forProvider, configSvcPath, _helper.createVolumesMethodName(forProvider), inArgs, outArgs, smisJobCompleter);
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} catch (Exception e) {
_log.error("Problem in createMetaVolumeHead: " + metaHead.getLabel(), e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createMetaVolumeHead", e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} finally {
_log.info(String.format("Create Meta Volume Head End - Array:%s, Pool: %s, %n Head: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel()));
}
}
Aggregations