use of com.emc.storageos.vasa.data.internal.CoS in project coprhd-controller by CoprHD.
the class SyncManager method fetchDetailsOfAllBlockCos.
/**
* Returns list of all active Block related CoSes with their details
*
* @return list of all active Block related CoSes with their details
* @throws SOSFailure
*/
private List<CoS> fetchDetailsOfAllBlockCos() throws SOSFailure {
final String methodName = "fetchDetailsOfAllBlockCos(): ";
log.trace(methodName + "Entry");
final String BLOCK_COS_DETAIL_URI = "/block/vpools/%s";
List<CoS> blockCosIdList = new ArrayList<CoS>();
try {
for (String cosId : _blockCosIdList) {
CoS.BlockCoS cos = _client.queryObject(String.format(BLOCK_COS_DETAIL_URI, cosId), CoS.BlockCoS.class);
if (cos.isInactive() == false && cos.getId() != null) {
blockCosIdList.add(cos);
log.trace(methodName + cos);
}
}
log.trace(methodName + "Exit returning cos list of size[" + blockCosIdList.size() + "]");
return blockCosIdList;
} catch (NoSuchAlgorithmException e) {
log.error(methodName + "NoSuchAlgorithmException occured", e);
throw new SOSFailure(e);
} catch (UniformInterfaceException e) {
log.error(methodName + "UniformInterfaceException occured", e);
throw new SOSFailure(e);
}
}
use of com.emc.storageos.vasa.data.internal.CoS in project coprhd-controller by CoprHD.
the class SyncManager method fetchDetailsOfAllFileCos.
/**
* Returns list of all active Block related CoSes with their details
*
* @return list of all active Block related CoSes with their details
* @throws SOSFailure
*/
private List<CoS> fetchDetailsOfAllFileCos() throws SOSFailure {
final String methodName = "fetchDetailsOfAllFileCos(): ";
log.trace(methodName + "Entry");
final String FILE_COS_DETAIL_URI = "/file/vpools/%s";
List<CoS> fileCosIdList = new ArrayList<CoS>();
try {
for (String cosId : _fileCosIdList) {
CoS.FileCoS cos = _client.queryObject(String.format(FILE_COS_DETAIL_URI, cosId), CoS.FileCoS.class);
if (cos.isInactive() == false && cos.getId() != null) {
fileCosIdList.add(cos);
log.trace(methodName + cos);
}
}
log.trace(methodName + "Exit returning cos list of size[" + fileCosIdList.size() + "]");
return fileCosIdList;
} catch (NoSuchAlgorithmException e) {
log.error(methodName + "NoSuchAlgorithmException occured", e);
throw new SOSFailure(e);
} catch (UniformInterfaceException e) {
log.error(methodName + "UniformInterfaceException occured", e);
throw new SOSFailure(e);
}
}
use of com.emc.storageos.vasa.data.internal.CoS in project coprhd-controller by CoprHD.
the class SOSManager method getCosIds.
/**
* Makes a call to Bourne and returns list of storage capability Ids
*
* @return list of storage capability Ids
* @throws StorageFault
*/
public List<String> getCosIds() throws StorageFault {
final String methodName = "getCosIds(): ";
log.debug(methodName + "Entry");
List<String> idList = new ArrayList<String>();
try {
for (CoS cos : _syncManager.getCosDetailList()) {
idList.add(cos.getId());
}
} catch (SOSFailure e) {
log.error(methodName + "StorageOSFailure occured", e);
throw FaultUtil.StorageFault(e);
}
log.debug(methodName + "Exit returning capability Ids of size[" + idList.size() + "]");
return idList;
}
use of com.emc.storageos.vasa.data.internal.CoS in project coprhd-controller by CoprHD.
the class SOSManager method queryStorageCapabilities.
/**
* Makes a call to Bourne to get the details of given storage capability Ids
*
* @param capId
* @return array of <code>StorageCapability</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized StorageCapability[] queryStorageCapabilities(String[] capIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
final String methodName = "queryStorageCapabilities(): ";
log.debug(methodName + "Entry");
List<StorageCapability> returnList = null;
List<CoS> cosList = null;
try {
Boolean supportsCapability = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
if (!supportsCapability) {
log.error(methodName + " This function is not implemented");
throw FaultUtil.NotImplemented("This function is not implemented");
}
if (Util.isEmpty(capIds)) {
log.debug(methodName + "input capability Ids: " + capIds);
cosList = _syncManager.getCosDetailList();
} else {
for (String inputCapId : capIds) {
if (!Util.isEmpty(inputCapId)) {
if (!inputCapId.startsWith(COS_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Storage capability Id is invalid: " + inputCapId);
}
} else {
throw FaultUtil.InvalidArgument("Storage capability Id is empty: " + inputCapId);
}
}
List<String> inputCapIdList = Arrays.asList(capIds);
log.debug(methodName + "input capability Ids: " + inputCapIdList);
cosList = _syncManager.getCosDetailList(inputCapIdList);
}
returnList = new ArrayList<StorageCapability>();
for (CoS cos : cosList) {
StorageCapability capability = new StorageCapability();
capability.setUniqueIdentifier(cos.getId());
capability.setCapabilityName(cos.getLabel() + ":" + cos.getType());
capability.setCapabilityDetail(cos.getDescription());
if (log.isDebugEnabled()) {
log.debug(methodName + "Capability detail: id[" + capability.getUniqueIdentifier() + "] name[" + capability.getCapabilityName() + "] detail[" + capability.getCapabilityDetail() + "]");
}
returnList.add(capability);
}
} catch (SOSFailure e) {
log.error(methodName + "StorageOSFailure occured ", e);
throw FaultUtil.StorageFault(e);
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured ", e);
throw e;
} catch (NotImplemented e) {
log.error(methodName + "NotImplemented occured ", e);
throw e;
}
return returnList.toArray(new StorageCapability[0]);
}
use of com.emc.storageos.vasa.data.internal.CoS in project coprhd-controller by CoprHD.
the class SyncManager method getCosDetailList.
/**
* Returns list of all active CoSes with their details based on given CoS
* Ids
*
* @param list
* of cosIds
* @return List of <code>CoS</code> objects
* @throws SOSFailure
* if call(s) to Bourne fails
*/
public List<CoS> getCosDetailList(List<String> cosIds) throws SOSFailure {
final String methodName = "getCosDetailList(): ";
log.trace(methodName + "Entry with cos Ids:" + cosIds);
List<CoS> returnList = new ArrayList<CoS>();
List<CoS> cosList = getCosDetailList();
Comparator<CoS> c = new Comparator<CoS>() {
@Override
public int compare(CoS cos1, CoS cos2) {
return cos1.getId().compareTo(cos2.getId());
}
};
int index = -1;
Collections.sort(cosList, c);
for (String givenCosId : cosIds) {
CoS cos = new CoS(givenCosId);
index = Collections.binarySearch(cosList, cos, c);
if (index >= 0) {
log.trace(methodName + "givenCosId[" + givenCosId + "] is found at cosList[" + index + "]");
returnList.add(cosList.get(index));
}
}
log.trace(methodName + "Exit returning cos list of size[" + returnList.size() + "]");
return returnList;
}
Aggregations