use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class CreatePoolSettingProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
String tierMethodologyToBeUsedForThisCreatedSetting = null;
try {
if (resultObj instanceof CIMArgument<?>[]) {
CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
CIMObjectPath path = (CIMObjectPath) outputArguments[0].getValue();
// always set
int index = (Integer) _args.get(1);
@SuppressWarnings("unchecked") List<String> poolSettingsList = (List<String>) keyMap.get(Constants.VNXPOOLCAPABILITIES_TIER);
String poolSettingToTierMethodology = poolSettingsList.get(index);
tierMethodologyToBeUsedForThisCreatedSetting = poolSettingToTierMethodology.substring(poolSettingToTierMethodology.lastIndexOf(Constants.HYPHEN) + 1, poolSettingToTierMethodology.length());
String poolCapabilitiesPathAssociatedWiththisSetting = poolSettingToTierMethodology.substring(0, poolSettingToTierMethodology.lastIndexOf(Constants.HYPHEN));
keyMap.put(path.toString(), poolCapabilitiesPathAssociatedWiththisSetting);
keyMap.put(path.toString() + Constants.HYPHEN + Constants.TIERMETHODOLOGY, tierMethodologyToBeUsedForThisCreatedSetting);
addPath(keyMap, operation.getResult(), path);
}
} catch (Exception e) {
_logger.error("Error processing Create Pool Setting with Initial Storage Tiering Methodology : {} : ", tierMethodologyToBeUsedForThisCreatedSetting, e);
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class FEPortStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws SMIPluginException {
try {
CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
List<String> metricSequence = (List<String>) keyMap.get(Constants.STORAGEOS_FEPORT_MANIFEST);
String[] feportsMetricValues = ((String[]) outputArguments[0].getValue())[0].split("\n");
List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(dbClient, profile.getSystemId());
_logger.debug("FEPort metricNames Sequence {}", metricSequence);
// process the results.
if (null != metricSequence && !metricSequence.isEmpty()) {
// Step2: For each feport metric record
for (String fePortMetricValue : feportsMetricValues) {
if (fePortMetricValue.isEmpty()) {
_logger.debug("Empty FEPort stats returned as part of Statistics Response");
continue;
}
String[] metrics = fePortMetricValue.split(Constants.SEMI_COLON);
// Step 3: For each port in db for a given system.
for (StoragePort port : systemPorts) {
// Step 4: if port in db is null just continue.
if (null == port) {
continue;
} else if (!port.getInactive() && metrics[0].endsWith(port.getPortName())) {
// Step 5: Check whether provider returned port
// exists in db or not. if port exists in db,
// then create a PortStat object for it.
_logger.debug("found FEPort in db for {}", port.getPortName());
createPortStatMetric(metricSequence, port, keyMap, metricsObjList, metrics);
}
}
}
//
// compute port metric to trigger if any port allocation qualification changed. If there is
// changes, run vpool matcher
//
portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(profile.getSystemId(), systemPorts);
//
// compute storage system's average of port metrics. Then, persist it into storage system object.
//
portMetricsProcessor.computeStorageSystemAvgPortMetrics(profile.getSystemId());
// Compute port group's port metrics for vmax only
portMetricsProcessor.computePortGroupMetrics(profile.getSystemId());
} else {
_logger.error("failed processing FEPOrt Metric values as metric sequence is null.");
}
} catch (Exception e) {
_logger.error("Failed while extracting stats for FEPorts: ", e);
}
resultObj = null;
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method detachGroupMirrors.
@Override
public void detachGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean deleteGroup, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("START detach group mirror operation");
if (!storage.getUsingSmis80()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, mirrorList);
CIMObjectPath groupSynchronized = ReplicationUtils.getMirrorGroupSynchronizedPath(storage, mirrorList.get(0), _dbClient, _helper, _cimPath);
if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
CIMArgument[] detachCGMirrorInput = _helper.getDetachSynchronizationInputArguments(groupSynchronized);
// Invoke method to detach local mirrors
UnsignedInteger32 result = (UnsignedInteger32) _helper.callModifyReplica(storage, detachCGMirrorInput, new CIMArgument[5]);
if (JOB_COMPLETED_NO_ERROR.equals(result)) {
List<BlockMirror> mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
if (deleteGroup) {
ReplicationUtils.deleteReplicationGroup(storage, mirrors.get(0).getReplicationGroupInstance(), _dbClient, _helper, _cimPath);
}
// Set mirrors replication group to null
for (BlockMirror mirror : mirrors) {
if (deleteGroup) {
mirror.setConsistencyGroup(NullColumnValueGetter.getNullURI());
mirror.setReplicationGroupInstance(NullColumnValueGetter.getNullStr());
}
mirror.setSyncState(NullColumnValueGetter.getNullStr());
}
_dbClient.persistObject(mirrors);
taskCompleter.ready(_dbClient);
} else {
String msg = String.format("SMI-S call returned unsuccessfully: %s", result);
taskCompleter.error(_dbClient, DeviceControllerException.errors.smis.jobFailed(msg));
}
} else {
_log.error("Unable to find group synchronized {}", groupSynchronized.toString());
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(mirror.getReplicationGroupInstance());
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, error);
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method establishVolumeNativeContinuousCopyGroupRelation.
@Override
public void establishVolumeNativeContinuousCopyGroupRelation(StorageSystem storage, URI sourceVolume, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("establishVolumeNativeContinuousCopyGroupRelation operation START");
try {
/**
* get groupPath for source volume
* get groupPath for mirror
* get mirrors belonging to the same Replication Group
* get Element synchronizations between volumes and mirrors
* call CreateGroupReplicaFromElementSynchronizations
*/
BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
Volume volumeObj = _dbClient.queryObject(Volume.class, sourceVolume);
CIMObjectPath srcRepSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
String volumeGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(volumeObj, _dbClient);
CIMObjectPath volumeGroupPath = _cimPath.getReplicationGroupPath(storage, volumeGroupName);
CIMObjectPath mirrorGroupPath = _cimPath.getReplicationGroupPath(storage, mirrorObj.getReplicationGroupInstance());
CIMObjectPath groupSynchronizedPath = _cimPath.getGroupSynchronized(volumeGroupPath, mirrorGroupPath);
CIMInstance syncInstance = _helper.checkExists(storage, groupSynchronizedPath, false, false);
if (syncInstance == null) {
// List<Volume> volumes = ControllerUtils.getVolumesPartOfCG(sourceVolume.getConsistencyGroup(), _dbClient);
// get all mirrors belonging to a Replication Group. There may be multiple mirrors available for a Volume
List<BlockMirror> mirrors = ControllerUtils.getMirrorsPartOfReplicationGroup(mirrorObj.getReplicationGroupInstance(), _dbClient);
List<CIMObjectPath> elementSynchronizations = new ArrayList<CIMObjectPath>();
for (BlockMirror mirrorObject : mirrors) {
Volume volume = _dbClient.queryObject(Volume.class, mirrorObject.getSource());
elementSynchronizations.add(_cimPath.getStorageSynchronized(storage, volume, storage, mirrorObject));
}
_log.info("Creating Group synchronization between volume group and mirror group");
CIMArgument[] inArgs = _helper.getCreateGroupReplicaFromElementSynchronizationsForSRDFInputArguments(volumeGroupPath, mirrorGroupPath, elementSynchronizations);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, srcRepSvcPath, SmisConstants.CREATE_GROUP_REPLICA_FROM_ELEMENT_SYNCHRONIZATIONS, inArgs, outArgs);
// No Job returned
} else {
_log.info("Link already established..");
}
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.error("Failed to establish group relation between volume group and mirror group. Volume: {}, Mirror: {}", sourceVolume, mirror);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method activateSingleVolumeSnapshot.
/**
* This interface is for the snapshot active. The createSnapshot may have done
* whatever is necessary to setup the snapshot for this call. The goal is to
* make this a quick operation and the create operation has already done a lot
* of the "heavy lifting".
*
* @param storage [required] - StorageSystem object representing the array
* @param snapshot [required] - BlockSnapshot URI representing the previously created
* snap for the volume
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
public void activateSingleVolumeSnapshot(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
if (snapshotObj.getIsSyncActive()) {
_log.warn("Trying to activate snapshot, which is already active", snapshotObj.getId().toString());
return;
}
_log.info("activateSingleVolumeSnapshot operation START");
CIMArgument[] inArgs = _helper.getActivateSnapshotInputArguments(storage, snapshotObj);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storage, inArgs, outArgs);
setIsSyncActive(snapshotObj, true);
snapshotObj.setRefreshRequired(true);
_dbClient.persistObject(snapshotObj);
// Success -- Update status
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
} finally {
_log.info("activateSingleVolumeSnapshot operation END");
}
}
Aggregations