use of com.emc.storageos.volumecontroller.impl.job.QueueJob 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.job.QueueJob in project coprhd-controller by CoprHD.
the class HDSCloneOperations method restoreFromSingleClone.
@Override
public void restoreFromSingleClone(StorageSystem storageSystem, URI cloneURI, TaskCompleter taskCompleter) {
try {
Volume cloneVolume = dbClient.queryObject(Volume.class, cloneURI);
Volume sourceVolume = dbClient.queryObject(Volume.class, cloneVolume.getAssociatedSourceVolume());
hdsProtectionOperations.modifyShadowImagePair(storageSystem, sourceVolume.getNativeId(), cloneVolume.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.restore);
ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageSystem.getId(), sourceVolume.getNativeId(), cloneVolume.getNativeId(), ReplicationStatus.PAIR, taskCompleter)));
log.info("FINISH restoreFromSingleClone for {}", cloneURI);
} catch (Exception e) {
String errorMsg = String.format(RESTORE_ERROR_MSG_FORMAT, cloneURI);
log.error(errorMsg, e);
taskCompleter.error(dbClient, DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class AbstractCloneOperations method resyncSingleClone.
@Override
@SuppressWarnings("rawtypes")
public void resyncSingleClone(StorageSystem storageSystem, URI cloneVolume, TaskCompleter taskCompleter) {
_log.info("START resyncSingleClone operation");
Volume clone = null;
try {
callEMCRefreshIfRequired(_dbClient, _helper, storageSystem, Arrays.asList(cloneVolume));
clone = _dbClient.queryObject(Volume.class, cloneVolume);
URI sourceUri = clone.getAssociatedSourceVolume();
Volume sourceObj = _dbClient.queryObject(Volume.class, sourceUri);
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceObj.getStorageController());
CIMObjectPath syncObject = _cimPath.getStorageSynchronized(sourceSystem, sourceObj, storageSystem, clone);
CIMInstance instance = _helper.checkExists(storageSystem, syncObject, false, false);
if (instance != null) {
CIMArgument[] inArgs = _helper.getResyncReplicaInputArguments(syncObject);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storageSystem, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(job, storageSystem.getId(), taskCompleter)));
}
} else {
String errorMsg = "The clone is already detached. resync will not be performed.";
_log.info(errorMsg);
ServiceError error = DeviceControllerErrors.smis.methodFailed("resyncSingleClone", errorMsg);
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
String errorMsg = String.format(RESYNC_ERROR_MSG_FORMAT, cloneVolume);
_log.error(errorMsg, e);
taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class AbstractMirrorOperations method deleteSingleVolumeMirror.
@Override
public void deleteSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("deleteSingleVolumeMirror operation START");
try {
BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
if (storage.checkIfVmax3()) {
_helper.removeVolumeFromParkingSLOStorageGroup(storage, new String[] { mirrorObj.getNativeId() }, false);
_log.info("Done invoking remove volume {} from parking SLO storage group", mirrorObj.getNativeId());
}
CIMObjectPath mirrorPath = _cimPath.getBlockObjectPath(storage, mirrorObj);
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
CIMArgument[] inArgs = _helper.getDeleteMirrorInputArguments(storage, mirrorPath);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, configSvcPath, SmisConstants.RETURN_TO_STORAGE_POOL, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockDeleteMirrorJob(job, storage.getId(), taskCompleter)));
}
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class AbstractMirrorOperations method createSingleVolumeMirror.
@Override
public void createSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("createSingleVolumeMirror operation START");
try {
BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
StoragePool targetPool = _dbClient.queryObject(StoragePool.class, mirrorObj.getPool());
Volume source = _dbClient.queryObject(Volume.class, mirrorObj.getSource());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, source.getTenant().getURI());
String tenantName = tenant.getLabel();
String targetLabelToUse = _nameGenerator.generate(tenantName, mirrorObj.getLabel(), mirror.toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = null;
if (storage.checkIfVmax3()) {
CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, source, targetPool);
CIMInstance replicaSettingData = getDefaultReplicationSettingData(storage);
inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse, volumeGroupPath, replicaSettingData);
} else {
inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse);
}
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateMirrorJob(job, storage.getId(), !createInactive, taskCompleter)));
// Resynchronizing state applies to the initial copy as well as future
// re-synchronization's.
mirrorObj.setSyncState(SynchronizationState.RESYNCHRONIZING.toString());
_dbClient.persistObject(mirrorObj);
}
} catch (final InternalException e) {
_log.info("Problem making SMI-S call: ", e);
taskCompleter.error(_dbClient, e);
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, serviceError);
}
}
Aggregations