use of com.vmware.vim.vasa._1_0.data.xsd.StoragePort in project coprhd-controller by CoprHD.
the class SOSManager method queryStoragePorts.
/**
* Makes a call to Bourne to get the details of given storage ports
*
* @param portIds
* @return array of <code>StoragePort</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized StoragePort[] queryStoragePorts(String[] portIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
final String methodName = "queryStoragePorts(): ";
log.debug(methodName + "Entry");
List<StoragePort> retStoragePorts = 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");
}
List<com.emc.storageos.vasa.data.internal.StoragePort> portList = null;
// try {
if (Util.isEmpty(portIds)) {
portList = this.getStoragePorts();
} else {
for (String inputPortId : portIds) {
if (!inputPortId.startsWith(STORAGEPORT_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given portId is invalid: " + inputPortId);
}
}
List<String> portIdList = Arrays.asList(portIds);
portList = this.getStoragePorts(portIdList);
}
retStoragePorts = new ArrayList<StoragePort>();
for (com.emc.storageos.vasa.data.internal.StoragePort storagePortDetail : portList) {
String portType = storagePortDetail.getTransportType();
String portNetworkId = storagePortDetail.getPortNetworkId();
log.trace(methodName + "port type is [" + portType + "]");
log.trace(methodName + "port nework Id is [" + portNetworkId + "]");
StoragePort returnStoragePort = new StoragePort();
returnStoragePort.setUniqueIdentifier(storagePortDetail.getId());
returnStoragePort.addAlternateName(storagePortDetail.getPortName());
if ("FC".equalsIgnoreCase(portType)) {
log.trace(methodName + "setting port WWN as port network ID ");
returnStoragePort.setPortWwn(portNetworkId);
returnStoragePort.setPortType(BlockEnum.FC.getValue());
} else if ("ISCSI".equalsIgnoreCase(portType)) {
log.trace(methodName + "setting iSCSI identifier as port network ID ");
returnStoragePort.setIscsiIdentifier(portNetworkId);
returnStoragePort.setPortType(BlockEnum.ISCSI.getValue());
} else if ("IP".equalsIgnoreCase(portType)) {
log.trace(methodName + "setting node WWN as port network ID ");
returnStoragePort.setNodeWwn(portNetworkId);
returnStoragePort.setPortType(BlockEnum.Other.getValue());
}
retStoragePorts.add(returnStoragePort);
}
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured", e);
throw e;
} catch (NotImplemented e) {
log.error(methodName + "NotImplemented occured", e);
throw e;
}
log.debug(methodName + "Exit returning storage ports of size[" + retStoragePorts.size() + "]");
return retStoragePorts.toArray(new StoragePort[0]);
}
use of com.vmware.vim.vasa._1_0.data.xsd.StoragePort in project coprhd-controller by CoprHD.
the class SOSManager method queryStorageFileSystems.
/**
* Makes a call to Bourne to get the details of given file system Ids
*
* @param filesystemIds
* @return array of <code>StorageFileSystem</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
* @throws NotFound
*/
public synchronized StorageFileSystem[] queryStorageFileSystems(String[] fsUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
final String methodName = "queryStorageFileSystems(): ";
log.debug(methodName + "Entry");
List<StorageFileSystem> list = null;
try {
Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
if (!supportsFile) {
log.error(methodName + " This function is not implemented");
throw FaultUtil.NotImplemented("This function is not implemented");
}
if (Util.isEmpty(fsUniqueIds)) {
throw FaultUtil.InvalidArgument("Given file system Ids are invalid");
}
for (String fsId : fsUniqueIds) {
if (!Util.isEmpty(fsId)) {
if (!fsId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given filesytem Id is invalid: " + fsId);
}
} else {
throw FaultUtil.InvalidArgument("Given filesytem Id is invalid: " + fsId);
}
}
this.setFileSystemIds();
List<String> existingFsIdList = new ArrayList<String>();
for (String inputFSId : fsUniqueIds) {
if (_reportedFileSystemIdList.contains(inputFSId)) {
existingFsIdList.add(inputFSId);
}
}
list = new ArrayList<StorageFileSystem>();
List<FileShare> fsList = _syncManager.getFileSystemDetailList(existingFsIdList);
for (FileShare fileshare : fsList) {
StorageFileSystem fileSystem = new StorageFileSystem();
fileSystem.setUniqueIdentifier(fileshare.getId());
if (fileshare.getProtocols().getProtocol().contains("NFS")) {
fileSystem.setFileSystem(FileSystemEnum.NFS.getValue());
} else if (fileshare.getProtocols().getProtocol().contains("NFSv4")) {
fileSystem.setFileSystem(FileSystemEnum.NFS.getValue());
} else {
fileSystem.setFileSystem(FileSystemEnum.Other.getValue());
}
fileSystem.setFileSystemVersion(FileSystemVersionEnum.NFSV3_0.getValue());
FileSystemInfo fsDetail = new FileSystemInfo();
String fsNetworkId = "";
if (fileshare.getStoragePort() != null && fileshare.getStorageController() != null) {
String storageSystemId = fileshare.getStorageController().getId();
String storagePortId = fileshare.getStoragePort().getId();
com.emc.storageos.vasa.data.internal.StoragePort storagePort = _syncManager.getStoragePort(storageSystemId, storagePortId);
fsNetworkId = storagePort.getPortNetworkId();
}
fsDetail.setIpAddress(fsNetworkId);
fsDetail.setFileServerName(fsNetworkId);
fsDetail.setFileSystemPath(fileshare.getMountPath());
fileSystem.addFileSystemInfo(fsDetail);
fileSystem.setNativeSnapshotSupported(true);
fileSystem.setThinProvisioningStatus(AlarmStatusEnum.Green.getValue());
if (log.isDebugEnabled()) {
log.debug(methodName + "filesystem: id[" + fileSystem.getUniqueIdentifier() + "] type[" + fileSystem.getFileSystem() + "] version[" + fileSystem.getFileSystemVersion() + "] thinProvisioningStatus[" + fileSystem.getThinProvisioningStatus() + "] snapShotsupported[" + fileSystem.getNativeSnapshotSupported() + "] IpAddress[" + fileSystem.getFileSystemInfo()[0].getFileServerName() + "] serverName[" + fileSystem.getFileSystemInfo()[0].getFileServerName() + "] fileSystemPath[" + fileSystem.getFileSystemInfo()[0].getFileSystemPath() + "]");
}
list.add(fileSystem);
}
} 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;
}
log.debug(methodName + "Exit returning list of file systems of size[" + list.size() + "]");
return list.toArray(new StorageFileSystem[0]);
}
use of com.vmware.vim.vasa._1_0.data.xsd.StoragePort in project coprhd-controller by CoprHD.
the class SOSManager method queryAssociatedLUNsForPort.
/**
* Makes a call to Bourne to get the associated Luns for the given storage
* port Ids
*
* @param portUniqueIds
* @return array of <code>VasaAssociationObject</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized VasaAssociationObject[] queryAssociatedLUNsForPort(String[] portUniqueIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
final String methodName = "queryAssociatedLUNsForPort(): ";
log.debug(methodName + "Entry");
List<VasaAssociationObject> returnList = null;
List<String> inputPortIdList = null;
log.info(methodName + "Input:[" + portUniqueIds + "]");
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");
}
String csvSeparatedInitiatorList = this.getCSVListOfInitiatorsFromUsageContext();
Hashtable<String, List<String>> portToVolumeTable = _syncManager.getStoragePortToVolumeTable(csvSeparatedInitiatorList);
returnList = new ArrayList<VasaAssociationObject>();
if (Util.isEmpty(portUniqueIds)) {
// Return all port associated to LUNs
for (String portId : portToVolumeTable.keySet()) {
VasaAssociationObject associationObject = new VasaAssociationObject();
BaseStorageEntity storagePort = new BaseStorageEntity();
storagePort.setUniqueIdentifier(portId);
associationObject.addEntityId(storagePort);
for (String volumeId : portToVolumeTable.get(portId)) {
BaseStorageEntity associatedVolume = new BaseStorageEntity();
associatedVolume.setUniqueIdentifier(volumeId);
associationObject.addAssociatedId(associatedVolume);
}
returnList.add(associationObject);
}
} else {
inputPortIdList = Arrays.asList(portUniqueIds);
log.debug(methodName + "Input port ids: " + inputPortIdList);
for (String inputPortId : inputPortIdList) {
if (!Util.isEmpty(inputPortId)) {
if (!inputPortId.startsWith(STORAGEPORT_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given port Id is invalid[" + inputPortId + "]");
} else {
List<String> volumeIdList = portToVolumeTable.get(inputPortId);
if (volumeIdList != null && !volumeIdList.isEmpty()) {
VasaAssociationObject associationObject = new VasaAssociationObject();
BaseStorageEntity storagePort = new BaseStorageEntity();
storagePort.setUniqueIdentifier(inputPortId);
associationObject.addEntityId(storagePort);
for (String volumeId : volumeIdList) {
BaseStorageEntity associatedVolume = new BaseStorageEntity();
associatedVolume.setUniqueIdentifier(volumeId);
associationObject.addAssociatedId(associatedVolume);
}
returnList.add(associationObject);
}
}
}
// }
}
}
return returnList.toArray(new VasaAssociationObject[0]);
} catch (SOSFailure e) {
log.error("StorageOSFailure occured", e);
throw FaultUtil.StorageFault("StorageOSFailure occured", e);
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured ", e);
throw e;
} catch (NotImplemented e) {
log.error(methodName + "NotImplemented occured ", e);
throw e;
}
}
Aggregations