use of com.emc.storageos.volumecontroller.impl.smis.job.SmisAbstractCreateVolumeJob in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method createMetaVolumes.
/**
* Create meta volumes.
*
* @param storageSystem storageSystem
* @param metaHead meta head
* @param metaMembers list of native ids of meta volume members (not including meta head)
* @param metaType meta volume type to create, concatenate or stripe
* @param capabilities capabilities
* @param metaVolumeTaskCompleter task completer
*/
/**
* Create meta volumes
*
* @param storageSystem
* @param storagePool
* @param volumes
* @param capabilities
* @param taskCompleter
* @throws Exception
*/
@Override
public void createMetaVolumes(StorageSystem storageSystem, StoragePool storagePool, List<Volume> volumes, VirtualPoolCapabilityValuesWrapper capabilities, TaskCompleter taskCompleter) throws Exception {
String label = null;
Volume volume = volumes.get(0);
// We don't need a label when we are to create more than
// one volume. In fact we can't set the label in this
// case for VMAX, else the request will fail.
// TODO there is a bug in smis --- the request to element composition service fails when name is set even for a single volume.
// todo: the opt 450103 was opened on 05/30
Long capacity = volume.getTotalMetaMemberCapacity();
Integer metaMemberCount = volume.getMetaMemberCount();
String metaVolumeType = volume.getCompositionType();
boolean opCreationFailed = false;
try {
CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
boolean isThinlyProvisioned = volume.getThinlyProvisioned();
_log.info(String.format("Create Meta Volumes Start - Array: %s, Count: %s, MetaType: %s", storageSystem.getSerialNumber(), volumes.size(), metaVolumeType));
CIMArgument[] inArgs;
CIMInstance poolSetting = null;
// set preallocate size if needed
if (isThinlyProvisioned && volume.getThinVolumePreAllocationSize() > 0) {
poolSetting = _smisStorageDevicePreProcessor.createStoragePoolSetting(storageSystem, storagePool, volume.getThinVolumePreAllocationSize());
}
inArgs = _helper.getCreateMetaVolumesInputArguments(storageSystem, storagePool, label, capacity, volumes.size(), isThinlyProvisioned, metaVolumeType, metaMemberCount, poolSetting);
CIMArgument[] outArgs = new CIMArgument[5];
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, volume);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
// can not invoke async --- cimPath is not serializable
// todo: before opt 450103 is fixed always use multi-volume job
SmisAbstractCreateVolumeJob smisJobCompleter = new SmisCreateMultiVolumeJob(null, forProvider.getId(), storagePool.getId(), volumes.size(), taskCompleter);
// SmisAbstractCreateVolumeJob smisJobCompleter = volumes.size() > 1 ? new SmisCreateMultiVolumeJob(null,
// forProvider.getId(), storagePool.getId(), volumes.size(), taskCompleter)
// : new SmisCreateVolumeJob(null, forProvider.getId(), storagePool.getId(),
// taskCompleter);
smisJobCompleter.setCimPath(_cimPath);
_helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
opCreationFailed = true;
ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, serviceError);
} catch (Exception e) {
_log.error("Problem in createMetaVolumes: ", e);
opCreationFailed = true;
ServiceError serviceError = DeviceControllerErrors.smis.methodFailed("createMetaVolumes", e.getMessage());
taskCompleter.error(_dbClient, serviceError);
}
if (opCreationFailed) {
for (Volume vol : volumes) {
vol.setInactive(true);
_dbClient.persistObject(vol);
}
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create meta volumes End - Array:%s, Pool:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid()));
for (Volume vol : volumes) {
logMsgBuilder.append(String.format("%nVolume:%s", vol.getLabel()));
}
_log.info(logMsgBuilder.toString());
}
Aggregations