use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSModifyVolumeJob in project coprhd-controller by CoprHD.
the class HDSStorageDevice method doModifyVolumes.
@Override
public void doModifyVolumes(StorageSystem storage, StoragePool storagePool, String opId, List<Volume> volumes, TaskCompleter taskCompleter) throws DeviceControllerException {
StringBuilder logMsgBuilder = new StringBuilder(String.format("Modify Volume Start - Array:%s, Pool:%s", storage.getSerialNumber(), storagePool.getNativeGuid()));
String systemObjectID = HDSUtils.getSystemObjectID(storage);
for (Volume volume : volumes) {
try {
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
logMsgBuilder.append(String.format("%nVolume:%s , IsThinlyProvisioned: %s, tieringPolicy: %s", volume.getLabel(), volume.getThinlyProvisioned(), volume.getAutoTieringPolicyUri()));
LogicalUnit logicalUnit = hdsApiClient.getLogicalUnitInfo(systemObjectID, HDSUtils.getLogicalUnitObjectId(volume.getNativeId(), storage));
String policyName = ControllerUtils.getAutoTieringPolicyName(volume.getId(), dbClient);
String autoTierPolicyName = null;
if (policyName.equals(Constants.NONE)) {
autoTierPolicyName = null;
} else {
autoTierPolicyName = HitachiTieringPolicy.getPolicy(policyName.replaceAll(HDSConstants.SLASH_OPERATOR, HDSConstants.UNDERSCORE_OPERATOR)).getKey();
}
if (null != logicalUnit && null != logicalUnit.getLdevList() && !logicalUnit.getLdevList().isEmpty()) {
Iterator<LDEV> ldevItr = logicalUnit.getLdevList().iterator();
if (ldevItr.hasNext()) {
LDEV ldev = ldevItr.next();
String asyncMessageId = hdsApiClient.modifyThinVolumeTieringPolicy(systemObjectID, logicalUnit.getObjectID(), ldev.getObjectID(), autoTierPolicyName, storage.getModel());
if (null != asyncMessageId) {
HDSJob modifyHDSJob = new HDSModifyVolumeJob(asyncMessageId, volume.getStorageController(), taskCompleter, HDSModifyVolumeJob.VOLUME_MODIFY_JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(modifyHDSJob));
} else {
throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the modify volume call");
}
}
} else {
String errorMsg = String.format("No LDEV's found for volume: %s", volume.getId());
log.info(errorMsg);
ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doModifyVolumes", errorMsg);
taskCompleter.error(dbClient, serviceError);
}
} catch (final Exception e) {
log.error("Problem in doModifyVolumes: ", e);
ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doModifyVolumes", e.getMessage());
taskCompleter.error(dbClient, serviceError);
}
}
}
use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSModifyVolumeJob in project coprhd-controller by CoprHD.
the class HDSExportOperations method updateStorageGroupPolicyAndLimits.
@Override
public void updateStorageGroupPolicyAndLimits(StorageSystem storage, ExportMask exportMask, List<URI> volumeURIs, VirtualPool newVirtualPool, boolean rollback, TaskCompleter taskCompleter) throws Exception {
String message = rollback ? ("updateAutoTieringPolicy" + "(rollback)") : ("updateAutoTieringPolicy");
log.info("{} {} START...", storage.getSerialNumber(), message);
log.info("{} : volumeURIs: {}", message, volumeURIs);
try {
String newPolicyName = ControllerUtils.getFastPolicyNameFromVirtualPool(dbClient, storage, newVirtualPool);
log.info("{} : AutoTieringPolicy: {}", message, newPolicyName);
List<Volume> volumes = dbClient.queryObject(Volume.class, volumeURIs);
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
String systemObjectID = HDSUtils.getSystemObjectID(storage);
for (Volume volume : volumes) {
String luObjectId = HDSUtils.getLogicalUnitObjectId(volume.getNativeId(), storage);
LogicalUnit logicalUnit = hdsApiClient.getLogicalUnitInfo(systemObjectID, luObjectId);
if (null != logicalUnit && null != logicalUnit.getLdevList() && !logicalUnit.getLdevList().isEmpty()) {
Iterator<LDEV> ldevItr = logicalUnit.getLdevList().iterator();
if (ldevItr.hasNext()) {
LDEV ldev = ldevItr.next();
hdsApiClient.getLogicalUnitInfo(systemObjectID, luObjectId);
String tieringPolicyName = ControllerUtils.getAutoTieringPolicyName(volume.getId(), dbClient);
String policId = HitachiTieringPolicy.getPolicy(tieringPolicyName.replaceAll(HDSConstants.SLASH_OPERATOR, HDSConstants.UNDERSCORE_OPERATOR)).getKey();
String asyncMessageId = hdsApiClient.modifyThinVolumeTieringPolicy(systemObjectID, luObjectId, ldev.getObjectID(), policId, storage.getModel());
if (null != asyncMessageId) {
HDSJob modifyHDSJob = new HDSModifyVolumeJob(asyncMessageId, volume.getStorageController(), taskCompleter, HDSModifyVolumeJob.VOLUME_VPOOL_CHANGE_JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(modifyHDSJob));
} else {
throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the modify volume call");
}
}
}
}
} catch (Exception e) {
String errMsg = String.format("An error occurred while updating Auto-tiering policy for Volumes %s", volumeURIs);
log.error(errMsg, e);
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(e.getMessage(), e);
taskCompleter.error(dbClient, serviceError);
}
log.info("{} {} updateAutoTieringPolicy END...", storage.getSerialNumber(), message);
}
Aggregations