Search in sources :

Example 1 with HDSVolumeExpandJob

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

the class HDSStorageDevice method doExpandVolume.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.volumecontroller.BlockStorageDevice#doExpandVolume(com.emc.storageos.db.client.model.StorageSystem,
     * com.emc.storageos.db.client.model.StoragePool, com.emc.storageos.db.client.model.Volume, java.lang.Long,
     * com.emc.storageos.volumecontroller.TaskCompleter)
     */
@Override
public void doExpandVolume(StorageSystem storageSystem, StoragePool storagePool, Volume volume, Long size, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info(String.format("Expand Volume Start - Array: %s, Pool: %s, Volume: %s, New size: %d", storageSystem.getSerialNumber(), storagePool.getNativeGuid(), volume.getLabel(), size));
    try {
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageSystem), storageSystem.getSmisUserName(), storageSystem.getSmisPassword());
        String systemObjectID = HDSUtils.getSystemObjectID(storageSystem);
        String asyncTaskMessageId = null;
        if (volume.getThinlyProvisioned()) {
            asyncTaskMessageId = hdsApiClient.modifyThinVolume(systemObjectID, HDSUtils.getLogicalUnitObjectId(volume.getNativeId(), storageSystem), size, storageSystem.getModel());
        }
        if (null != asyncTaskMessageId) {
            HDSJob expandVolumeJob = new HDSVolumeExpandJob(asyncTaskMessageId, storageSystem.getId(), storagePool.getId(), taskCompleter, "ExpandVolume");
            ControllerServiceImpl.enqueueJob(new QueueJob(expandVolumeJob));
        } else {
            throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the expand volume call");
        }
    } catch (final InternalException e) {
        log.error("Problem in doExpandVolume: ", e);
        taskCompleter.error(dbClient, e);
    } catch (final Exception e) {
        log.error("Problem in doExpandVolume: ", e);
        ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doExpandVolume", e.getMessage());
        taskCompleter.error(dbClient, serviceError);
    }
    log.info(String.format("Expand Volume End - Array: %s, Pool: %s, Volume: %s", storageSystem.getSerialNumber(), storagePool.getNativeGuid(), volume.getLabel()));
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) HDSJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob) HDSVolumeExpandJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSVolumeExpandJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Aggregations

DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 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 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 HDSJob (com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob)1 HDSVolumeExpandJob (com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSVolumeExpandJob)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1