use of javax.wbem.WBEMException 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 javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisCommandHelper method arraySupports.
public boolean arraySupports(StorageSystem storage, int operation) {
boolean result = false;
CIMArgument[] out = new CIMArgument[5];
try {
invokeMethod(storage, _cimPath.getReplicationServiceCapabilitiesPath(storage), GET_SUPPORTED_OPERATIONS, getSupportedOperationsForSnapshot(), out);
Object value = _cimPath.getFromOutputArgs(out, SUPPORTED_OPERATIONS);
if (value != null) {
UnsignedInteger16[] supported = (UnsignedInteger16[]) value;
for (UnsignedInteger16 it : supported) {
if (it.intValue() == operation) {
result = true;
break;
}
}
}
} catch (WBEMException e) {
_log.error("arraySupportsDissolve exception: ", e);
}
return result;
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisCommandHelper method checkVolumeAssociatedWithAnyFASTSG.
/**
* Check if volume is associated with any FAST SG, irrespective of MVs.
*
* @param volNativeId the volume native id
* @param storage the storage system
* @return true, if successful
* @throws WBEMException
*/
public boolean checkVolumeAssociatedWithAnyFASTSG(String volNativeId, StorageSystem storage) throws WBEMException {
CloseableIterator<CIMInstance> sgInstanceIr = null;
try {
_log.info("Trying to find if volume {} is associated with any FAST managed SG", volNativeId);
CIMObjectPath volumePath = _cimPath.getVolumePath(storage, volNativeId);
sgInstanceIr = getAssociatorInstances(storage, volumePath, null, SmisCommandHelper.MASKING_GROUP_TYPE.SE_DeviceMaskingGroup.name(), null, null, SmisConstants.PS_V3_STORAGE_GROUP_PROPERTIES);
while (sgInstanceIr.hasNext()) {
CIMInstance sgInstance = sgInstanceIr.next();
String gpNameFound = (String) sgInstance.getPropertyValue(SmisConstants.CP_ELEMENT_NAME);
_log.info("Volume {} available in SG {}", volNativeId, gpNameFound);
String fastSetting = getVMAX3FastSettingAssociatedWithVolumeGroup(sgInstance);
if (!Constants.NONE.equalsIgnoreCase(fastSetting)) {
_log.info("Volume {} available in other FAST SG {}. EMCFastSetting {}", volNativeId, gpNameFound, fastSetting);
return true;
}
}
} catch (WBEMException we) {
_log.error("Find volume associated with any FAST SG failed", we);
throw we;
} finally {
if (null != sgInstanceIr) {
sgInstanceIr.close();
}
}
_log.info("No FAST SG found associated for volume {}", volNativeId);
return false;
}
use of javax.wbem.WBEMException 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;
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getVolumeGroupBasedOnSLO.
/**
* Finds the storage group based on SLO
*
* @param forProvider
* The storage provider where the query executes
* @param storageSystem
* The reference to storage system
* @param slo
* The slo name for the fast setting
* @param workload
* The workload name for the fast setting
* @param srp
* The srp name for the fast setting
*
* @return returns volumeGroupPath if found else null
*/
public CIMObjectPath getVolumeGroupBasedOnSLO(StorageSystem forProvider, StorageSystem storageSystem, String slo, String workload, String srp) {
CIMObjectPath volumeGroupObjectPath = null;
StringBuffer fastSettingName = new StringBuffer();
fastSettingName = fastSettingName.append(slo).append(Constants._plusDelimiter).append(workload).append(Constants._plusDelimiter).append(srp);
try {
Map<CIMObjectPath, Set<String>> groupPaths = findAnySLOStorageGroupsCanBeReUsed(forProvider, storageSystem, fastSettingName.toString(), false);
for (CIMObjectPath groupPath : groupPaths.keySet()) {
Set<String> groupVolumes = groupPaths.get(groupPath);
if (groupVolumes == null || (groupVolumes != null && groupVolumes.size() < 4000)) {
volumeGroupObjectPath = groupPath;
break;
}
}
} catch (WBEMException e) {
_log.info(storageSystem.getSystemType() + " Problem when trying to look for existing storage group for SLO " + fastSettingName.toString(), e);
throw new DeviceControllerException(e);
}
return volumeGroupObjectPath;
}
Aggregations