Search in sources :

Example 1 with HDSCreateMetaVolumeMembersJob

use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSCreateMetaVolumeMembersJob in project coprhd-controller by CoprHD.

the class HDSMetaVolumeOperations method createMetaVolumeMembers.

/**
 * Create meta volume member devices. These devices provide capacity to meta volume.
 *
 * @param storageSystem
 * @param storagePool
 * @param metaHead
 * @param memberCount
 * @param memberCapacity
 * @param metaVolumeTaskCompleter
 * @return list of native ids of meta member devices
 * @throws Exception
 */
@Override
public List<String> createMetaVolumeMembers(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, int memberCount, long memberCapacity, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
    log.info(String.format("Create Meta Volume Members Start - Array: %s, Pool: %s, %n Volume: %s, Count:%s, Member capacity: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel(), memberCount, memberCapacity));
    try {
        String systemObjectID = HDSUtils.getSystemObjectID(storageSystem);
        String poolObjectID = HDSUtils.getPoolObjectID(storagePool);
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageSystem), storageSystem.getSmisUserName(), storageSystem.getSmisPassword());
        // commenting this to rever the fix.
        // Integer ldevIdToUse = getLDEVNumberToCreateMetaMembers(hdsApiClient, systemObjectID);
        String asyncTaskMessageId = hdsApiClient.createThickVolumes(systemObjectID, poolObjectID, memberCapacity, memberCount, "", VOLUME_FORMAT_TYPE, storageSystem.getModel(), null);
        if (asyncTaskMessageId == null) {
            throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the create volume call");
        }
        HDSCreateMetaVolumeMembersJob metaVolumeMembersJob = new HDSCreateMetaVolumeMembersJob(asyncTaskMessageId, storageSystem.getId(), metaHead, memberCount, metaVolumeTaskCompleter);
        invokeMethodSynchronously(hdsApiFactory, asyncTaskMessageId, metaVolumeMembersJob);
        return metaVolumeMembersJob.getMetaMembers();
    } catch (Exception e) {
        log.error("Problem in createMetaVolumeMembers: ", e);
        ServiceError error = DeviceControllerErrors.hds.methodFailed("createMetaVolumeMemebers", e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(dbClient, error);
        throw e;
    } finally {
        log.info(String.format("Create Meta Volume Members End - Array: %s, Pool: %s, %n Volume: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel()));
    }
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) HDSCreateMetaVolumeMembersJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSCreateMetaVolumeMembersJob) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 HDSException (com.emc.storageos.hds.HDSException)1 HDSApiClient (com.emc.storageos.hds.api.HDSApiClient)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 HDSCreateMetaVolumeMembersJob (com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSCreateMetaVolumeMembersJob)1