use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.
the class ValidateVolumeIdentity method validate.
@Override
public boolean validate() throws Exception {
getLogger().setLog(log);
for (Volume volume : volumes) {
CIMObjectPath volumePath = getCimPath().getBlockObjectPath(system, volume);
CimConnection connection = getHelper().getConnection(system);
WBEMClient cimClient = connection.getCimClient();
CIMInstance instance = cimClient.getInstance(volumePath, false, false, PROP_KEYS);
checkForDifferences(instance, volume);
}
return getLogger().hasErrors();
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.
the class SmisCreateMaskingViewJob method updateStatus.
@Override
public void updateStatus(JobContext jobContext) throws Exception {
CloseableIterator<CIMObjectPath> iterator = null;
DbClient dbClient = jobContext.getDbClient();
JobStatus jobStatus = getJobStatus();
_log.info("Updating status of SmisCreateMaskingViewJob");
try {
if (jobStatus == JobStatus.SUCCESS) {
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, getStorageSystemURI());
CimConnection cimConnection = jobContext.getCimConnectionFactory().getConnection(storageSystem);
CIMConnectionFactory cimConnectionFactory = jobContext.getCimConnectionFactory();
WBEMClient client = getWBEMClient(dbClient, cimConnectionFactory);
List<CIMObjectPath> maskingViews = new ArrayList<CIMObjectPath>();
iterator = client.associatorNames(getCimJob(), null, SYMM_LUNMASKINGVIEW, null, null);
while (iterator.hasNext()) {
CIMObjectPath cimObjectPath = iterator.next();
maskingViews.add(cimObjectPath);
ExportMask mask = dbClient.queryObject(ExportMask.class, _exportMaskURI);
// necessary for future reference to the MV.
if (mask != null) {
String deviceId = cimObjectPath.getKey(SmisConstants.CP_DEVICE_ID).getValue().toString();
mask.setNativeId(deviceId);
dbClient.persistObject(mask);
ExportOperationContext.insertContextOperation(getTaskCompleter(), VmaxExportOperationContext.OPERATION_CREATE_MASKING_VIEW, mask.getMaskName());
}
}
// Now perform RP protection tagging, if required, on the storage group
if (storageSystem.getUsingSmis80()) {
_log.info("Set RP tag on all volumes within SG for 8.0.3 Providers");
enableRecoverPointTagOn803(dbClient, client, storageSystem, jobContext);
} else {
_log.info("Set RP tag on SG for 4.6.2 Providers");
enableRecoverPointTag(dbClient, client, _deviceGroupMaskingPath);
}
// Now set the HLU on the volume URIs, if they haven't been set by user.
ExportMaskOperationsHelper.setHLUFromProtocolControllers(dbClient, cimConnection, _exportMaskURI, _volumeURIHLUs, maskingViews, getTaskCompleter());
}
} catch (Exception e) {
_log.error("Caught an exception while trying to updateStatus for SmisCreateMaskingViewJob", e);
setPostProcessingErrorStatus("Encountered an internal error during masking view create job status processing : " + e.getMessage());
} finally {
super.updateStatus(jobContext);
if (iterator != null) {
iterator.close();
}
}
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.
the class SmisMaskingViewAddVolumeJob method updateStatus.
@Override
public void updateStatus(JobContext jobContext) throws Exception {
DbClient dbClient = jobContext.getDbClient();
JobStatus jobStatus = getJobStatus();
_log.info("Updating status of SmisMaskingViewAddVolumeJob");
try {
if (jobStatus == JobStatus.SUCCESS) {
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, getStorageSystemURI());
CimConnection cimConnection = jobContext.getCimConnectionFactory().getConnection(storageSystem);
List<URI> volumeUriList = new ArrayList<URI>();
// Now perform RP protection tagging, if required for the
// objects being added.
SmisCommandHelper helper = jobContext.getSmisCommandHelper();
for (VolumeURIHLU volumeUriHlu : _volumeURIHLUs) {
BlockObject bo = Volume.fetchExportMaskBlockObject(dbClient, volumeUriHlu.getVolumeURI());
if (bo != null && bo instanceof Volume) {
Volume volume = (Volume) bo;
if (volume != null && volume.checkForRp()) {
List<CIMObjectPath> volumePathList = new ArrayList<CIMObjectPath>();
volumePathList.add(helper.getVolumeMember(storageSystem, volume));
helper.setRecoverPointTag(storageSystem, volumePathList, true);
}
}
volumeUriList.add(volumeUriHlu.getVolumeURI());
}
// for proper roll back , that is volume removal, if exception is thrown during update
if (_newCreatedGroup != null) {
helper.setHostIOLimits(cimConnection.getCimClient(), _newCreatedGroup, _volumeURIHLUs);
}
String[] volumeNames = ExportMaskUtils.getBlockObjectAlternateNames(volumeUriList, dbClient);
CIMObjectPath[] volumes = _cimPath.getVolumePaths(storageSystem, volumeNames);
_log.info("{} volumes processed for HLU updation", volumes.length);
// Now set the HLU on the volume URIs, if they haven't been set// by user.
ExportMaskOperationsHelper.setHLUFromProtocolControllersOnAddVolume(dbClient, cimConnection, _exportMaskURI, _volumeURIHLUs, volumes, getTaskCompleter());
}
} catch (WBEMException e) {
_log.error(String.format("updateHostIOLimits failed - new created group: %s", _newCreatedGroup.toString()), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
getTaskCompleter().error(dbClient, serviceError);
} catch (Exception e) {
_log.error("Caught an exception while trying to updateStatus for SmisMaskingViewAddVolumeJob", e);
setPostProcessingErrorStatus("Encountered an internal error during add volume to masking view job status processing : " + e.getMessage());
} finally {
super.updateStatus(jobContext);
}
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.
the class SmisCommandHelper method executeQuery.
/**
* Executes query for component of a given storage system (volume, pool, etc...)
*
* @param storageSystem
* @param query
* @param queryLanguage
* @return
* @throws WBEMException
*/
public List<CIMInstance> executeQuery(StorageSystem storageSystem, String query, String queryLanguage) throws WBEMException {
CloseableIterator<CIMInstance> iterator = null;
CimConnection connection = _cimConnection.getConnection(storageSystem);
WBEMClient client = connection.getCimClient();
CIMObjectPath objectPath = _cimPath.getStorageSystem(storageSystem);
_log.info(String.format("Executing query: %s, objectPath: %s, query language: %s", query, objectPath, queryLanguage));
List<CIMInstance> instanceList = new ArrayList<CIMInstance>();
try {
iterator = client.execQuery(objectPath, query, queryLanguage);
while (iterator.hasNext()) {
CIMInstance instance = iterator.next();
instanceList.add(instance);
}
} catch (WBEMException we) {
_log.error("Caught an error will attempting to execute query and process query result. Query: " + query, we);
} finally {
closeCIMIterator(iterator);
}
return instanceList;
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnection in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getInstance.
public CIMInstance getInstance(StorageSystem storage, CIMObjectPath objectPath, boolean propagated, boolean includeClassOrigin, String[] propertyList) throws WBEMException {
CIMInstance cimInstance = null;
CimConnection connection = _cimConnection.getConnection(storage);
WBEMClient client = connection.getCimClient();
try {
cimInstance = client.getInstance(objectPath, propagated, includeClassOrigin, propertyList);
} catch (WBEMException we) {
throw we;
}
return cimInstance;
}
Aggregations