Search in sources :

Example 1 with ExpandVolumeDriverTask

use of com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask in project coprhd-controller by CoprHD.

the class ExpandVolumeExternalDeviceJob method doTaskSucceeded.

/**
 * {@inheritDoc}
 */
@Override
protected void doTaskSucceeded(DriverTask driverTask, DbClient dbClient) throws Exception {
    // Get the ViPR volume.
    s_logger.info(String.format("Successfully expanded volume %s:%s", _volumeURI, driverTask.getMessage()));
    Volume volume = dbClient.queryObject(Volume.class, _volumeURI);
    if (volume == null) {
        s_logger.error(String.format("Failed to find volume %s", _volumeURI));
        throw DeviceControllerException.exceptions.objectNotFound(_volumeURI);
    }
    // Update the ViPR volume with the driver volume information.
    ExpandVolumeDriverTask expandVolumeDriverTask = (ExpandVolumeDriverTask) driverTask;
    StorageVolume updatedDeviceVolume = expandVolumeDriverTask.getStorageVolume();
    ExternalDeviceUtils.updateExpandedVolume(volume, updatedDeviceVolume, dbClient);
    try {
        // Update storage pool capacity in database.
        ExternalDeviceUtils.updateStoragePoolCapacityAfterOperationComplete(volume.getPool(), _storageSystemURI, Collections.singletonList(_volumeURI), dbClient);
    } catch (Exception ex) {
        s_logger.error("Failed to update storage pool {} after volume expand operation completion.", volume.getPool(), ex);
    }
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) Volume(com.emc.storageos.db.client.model.Volume) ExpandVolumeDriverTask(com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 2 with ExpandVolumeDriverTask

use of com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask in project coprhd-controller by CoprHD.

the class ExpandVolumeSimulatorOperation method updateOnAsynchronousSuccess.

@Override
public void updateOnAsynchronousSuccess() {
    ExpandVolumeDriverTask expandVolumeTask = (ExpandVolumeDriverTask) _task;
    StorageVolume volume = expandVolumeTask.getStorageVolume();
    long newCapacity = expandVolumeTask.getExpandedCapacity();
    updateVolumeInfo(volume, newCapacity);
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) ExpandVolumeDriverTask(com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask)

Example 3 with ExpandVolumeDriverTask

use of com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask in project coprhd-controller by CoprHD.

the class ExpandVolumeSimulatorOperation method createDriverTask.

/**
 * Create the expand volume task that is returned by the request.
 *
 * @param volume A reference to the storage volume being expanded.
 * @param newCapacity The requested new capacity.
 */
private void createDriverTask(StorageVolume volume, long newCapacity) {
    String taskId = String.format("%s+%s+%s", StorageDriverSimulator.DRIVER_NAME, OP_NAME, UUID.randomUUID().toString());
    _log.info("Creating task {} for operation of type {}", taskId, OP_NAME);
    _task = new ExpandVolumeDriverTask(taskId, volume, newCapacity);
    _task.setStatus(DriverTask.TaskStatus.PROVISIONING);
}
Also used : ExpandVolumeDriverTask(com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask)

Example 4 with ExpandVolumeDriverTask

use of com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask in project coprhd-controller by CoprHD.

the class ExpandVolumeSimulatorOperation method getSuccessMessage.

@Override
public String getSuccessMessage(Object... args) {
    StorageVolume volume;
    if ((args != null) && (args.length > 0)) {
        volume = (StorageVolume) args[0];
    } else {
        // Must be asynchronous, so updated volume is in the task.
        ExpandVolumeDriverTask expandVolumeTask = (ExpandVolumeDriverTask) _task;
        volume = expandVolumeTask.getStorageVolume();
    }
    return String.format("StorageDriver: expandVolume information for storage system %s, volume nativeIds %s, new capacity %s - end", volume.getStorageSystemId(), volume.toString(), volume.getRequestedCapacity());
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) ExpandVolumeDriverTask(com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask)

Aggregations

ExpandVolumeDriverTask (com.emc.storageos.storagedriver.task.ExpandVolumeDriverTask)4 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)3 Volume (com.emc.storageos.db.client.model.Volume)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1