use of com.vmware.vim.vasa._1_0.data.xsd.StorageProcessor in project coprhd-controller by CoprHD.
the class SOSManager method queryStorageProcessors.
/**
* Makes a call to Bourne to get the details of given storage processor Ids
*
* @param processorId
* @return array of <code>StorageProcessor</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized StorageProcessor[] queryStorageProcessors(String[] processorId) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
final String methodName = "queryStorageProcessors(): ";
log.debug(methodName + "Entry");
List<StorageProcessor> processorList = null;
try {
Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
if (!supportsBlock) {
log.error(methodName + " This function is not implemented");
throw FaultUtil.NotImplemented("This function is not implemented");
}
if (processorId != null) {
log.debug(methodName + "input processor Ids " + Arrays.asList(processorId));
} else {
log.debug(methodName + "input processor Ids " + processorId);
}
String storageProcessorId = this.getProcessorId();
if (!Util.isEmpty(processorId)) {
for (String inputProcessorId : processorId) {
if (Util.isEmpty(inputProcessorId) == true || inputProcessorId.startsWith(STORAGEPROCESSOR_IDENTIFIER_PREFIX) == false) {
throw FaultUtil.InvalidArgument("Given processor Id(s) are invalid");
}
}
}
processorList = new ArrayList<StorageProcessor>();
if (Util.isEmpty(processorId)) {
StorageProcessor processor = new StorageProcessor();
log.debug(methodName + " adding storage processor id[" + storageProcessorId + "]");
processor.setUniqueIdentifier(storageProcessorId);
processor.addSpIdentifier(storageProcessorId);
processorList.add(processor);
} else {
for (String inputProcessorId : processorId) {
if (inputProcessorId != null && storageProcessorId.equals(inputProcessorId)) {
StorageProcessor processor = new StorageProcessor();
log.debug(methodName + " adding storage processor id[" + storageProcessorId + "]");
processor.addSpIdentifier(storageProcessorId);
processor.setUniqueIdentifier(storageProcessorId);
processorList.add(processor);
}
}
}
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured", e);
throw (e);
} catch (NotImplemented e) {
log.error(methodName + "NotImplemented occured", e);
throw FaultUtil.StorageFault(e);
} catch (Exception e) {
log.error(methodName + "Unexpected exception occured", e);
throw FaultUtil.StorageFault(e);
}
log.debug(methodName + "Exit returning processors of size[" + processorList.size() + "]");
return processorList.toArray(new StorageProcessor[0]);
}
use of com.vmware.vim.vasa._1_0.data.xsd.StorageProcessor in project coprhd-controller by CoprHD.
the class SOSManager method queryAssociatedProcessorsForArray.
/**
* Makes a call to Bourne to get the associated processors for the given
* storage array Ids
*
* @param arrayUniqueIds
* @return array of <code>VasaAssociationObject</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized VasaAssociationObject[] queryAssociatedProcessorsForArray(String[] arrayUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
final String methodName = "queryAssociatedProcessorsForArray(): ";
List<VasaAssociationObject> returnList = null;
String bourneArrayId = this.getArrayId();
log.debug(methodName + "Entry");
Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
try {
if (!supportsBlock) {
log.error(methodName + " This function is not implemented");
throw FaultUtil.NotImplemented("This function is not implemented");
}
if (!Util.isEmpty(arrayUniqueIds)) {
List<String> inputArrayIdList = Arrays.asList(arrayUniqueIds);
log.debug(methodName + "input array ids: " + inputArrayIdList);
for (String inputArrayId : inputArrayIdList) {
if (!Util.isEmpty(inputArrayId) && !inputArrayId.startsWith(STORAGEARRAY_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given array Id is invalid:[" + inputArrayId + "]");
}
}
}
returnList = new ArrayList<VasaAssociationObject>();
VasaAssociationObject associationObject = new VasaAssociationObject();
BaseStorageEntity entity = new BaseStorageEntity();
entity.setUniqueIdentifier(bourneArrayId);
BaseStorageEntity associatedEntity = new BaseStorageEntity();
associatedEntity.setUniqueIdentifier(this.getProcessorId());
associationObject.addEntityId(entity);
associationObject.addAssociatedId(associatedEntity);
if (Util.isEmpty(arrayUniqueIds)) {
log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
returnList.add(associationObject);
// return returnList.toArray(new VasaAssociationObject[0]);
} else {
/*
* StorageProcessor[] processorList = this
* .queryStorageProcessors(null);
*/
for (String arrayID : arrayUniqueIds) {
if (bourneArrayId.equals(arrayID)) {
/*
* VasaAssociationObject associationObject = new
* VasaAssociationObject(); BaseStorageEntity entityObj
* = new BaseStorageEntity();
* entityObj.setUniqueIdentifier(arrayID);
* associationObject.addEntityId(entityObj);
*/
// for (StorageProcessor proc : processorList) {
log.debug(methodName + "array[" + entity.getUniqueIdentifier() + "] is associated to processor[" + associatedEntity.getUniqueIdentifier() + "]");
returnList.add(associationObject);
}
// returnList.add(associationObject);
// }
}
}
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured ", e);
throw e;
} catch (NotImplemented e) {
log.error(methodName + "NotImplemented occured ", e);
throw e;
} catch (StorageFault e) {
log.error(methodName + "StorageFault occured ", e);
throw e;
}
log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
return returnList.toArray(new VasaAssociationObject[0]);
}
Aggregations