use of com.emc.storageos.vasa.data.internal.FileShare in project coprhd-controller by CoprHD.
the class SOSManager method queryDRSMigrationCapabilityForPerformance.
public synchronized boolean queryDRSMigrationCapabilityForPerformance(String srcUniqueId, String dstUniqueId, String entityType) throws InvalidArgument, NotFound, InvalidSession, StorageFault {
final String methodName = "queryDRSMigrationCapabilityForPerformance(): ";
log.debug(methodName + "Entry with input(s) srcUniqueId[" + srcUniqueId + "] dstUniqueId[" + dstUniqueId + "] entityType[" + entityType + "]");
try {
if (Util.isEmpty(entityType)) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]");
}
List<String> validEntityTypeList = new ArrayList<String>();
validEntityTypeList.add(EntityTypeEnum.StorageFileSystem.getValue());
validEntityTypeList.add(EntityTypeEnum.StorageLun.getValue());
if (validEntityTypeList.contains(entityType) == false) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]");
}
if (Util.isEmpty(srcUniqueId) || Util.isEmpty(dstUniqueId)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
if (EntityTypeEnum.StorageFileSystem.getValue().equals(entityType)) {
if (!supportsFile) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]. It does not match with the supported array profile");
}
if (!srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) || !dstUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
}
Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
if (EntityTypeEnum.StorageLun.getValue().equals(entityType)) {
if (!supportsBlock) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]. It does not match with the supported array profile");
}
if (!srcUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX) || !dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
}
List<String> inputIdList = new ArrayList<String>();
inputIdList.add(srcUniqueId);
inputIdList.add(dstUniqueId);
if (EntityTypeEnum.StorageFileSystem.getValue().equals(entityType)) {
this.setFileSystemIds();
if (srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) && dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
return false;
} else {
if (!_reportedFileSystemIdList.contains(srcUniqueId)) {
log.error(methodName + "Source Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Source Id does not exist for the entity type[" + entityType + "]");
}
if (!_reportedFileSystemIdList.contains(dstUniqueId)) {
log.error(methodName + "Destination Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Destination Id does not exist for the entity type[" + entityType + "]");
}
}
List<FileShare> fileShareList = _syncManager.getFileSystemDetailList(inputIdList);
FileShare fileShare1 = fileShareList.get(0);
FileShare fileShare2 = fileShareList.get(1);
if (fileShare1.getPool() != null && fileShare2.getPool() != null && fileShare1.getPool().getId() != null && fileShare2.getPool().getId() != null) {
if (fileShare1.getPool().getId().equals(fileShare2.getPool().getId())) {
return false;
} else {
return true;
}
}
}
if (EntityTypeEnum.StorageLun.getValue().equals(entityType)) {
this.setVolumeIds();
if (srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) && dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
return false;
} else {
if (!_reportedVolumeIdList.contains(srcUniqueId)) {
log.error(methodName + "Source Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Source Id does not exist for the entity type[" + entityType + "]");
}
if (!_reportedVolumeIdList.contains(dstUniqueId)) {
log.error(methodName + "Destination Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Destination Id does not exist for the entity type[" + entityType + "]");
}
}
// Check if src and dest are VPLEX volumes
List<Volume> volumeDetailList = _syncManager.getVolumeDetailList(inputIdList);
for (Volume volume : volumeDetailList) {
if (volume != null) {
HighAvailabilityVolumes haVolumes = volume.getHaVolumeList();
if (haVolumes != null && haVolumes.getHaVolumeList() != null) {
return false;
}
}
}
// Regular volumes
AssociatedPool associatedPoolForVolume1 = _syncManager.fetchAssociatedPoolOfVolume(srcUniqueId);
AssociatedPool associatedPoolForVolume2 = _syncManager.fetchAssociatedPoolOfVolume(dstUniqueId);
if (associatedPoolForVolume1 != null && associatedPoolForVolume2 != null) {
if (associatedPoolForVolume1.getStoragepool().getId().equals(associatedPoolForVolume2.getStoragepool().getId())) {
return false;
} else {
return true;
}
}
}
} 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 (NotFound e) {
log.error(methodName + "NotFound occured ", e);
throw e;
}
return false;
}
use of com.emc.storageos.vasa.data.internal.FileShare in project coprhd-controller by CoprHD.
the class SOSManager method queryAssociatedCapabilityForFileSystem.
/**
* Makes a call to Bourne to get the details of associated capability for
* the given file system Ids
*
* @param fsId
* @return array of <code>VasaAssociationObject</code> objects
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
* @throws NotImplemented
*/
public synchronized VasaAssociationObject[] queryAssociatedCapabilityForFileSystem(String[] fsIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
final String methodName = "queryAssociatedCapabilityForFileSystem(): ";
log.debug(methodName + "Entry");
List<FileShare> fsList = null;
List<VasaAssociationObject> returnList = null;
Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
Boolean supportsCapability = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
try {
if (supportsFile == false || supportsCapability == false) {
log.error(methodName + " This function is not implemented");
throw FaultUtil.NotImplemented("This function is not implemented");
}
this.setFileSystemIds();
if (Util.isEmpty(fsIds)) {
fsList = _syncManager.getFileSystemDetailList(this._reportedFileSystemIdList);
} else {
List<String> inputIdList = new ArrayList<String>();
for (String inputFsId : fsIds) {
if (!Util.isEmpty(inputFsId)) {
if (!inputFsId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given FileSystem Id is invalid: " + inputFsId);
}
if (_reportedFileSystemIdList.contains(inputFsId)) {
inputIdList.add(inputFsId);
}
} else {
throw FaultUtil.InvalidArgument("Given FileSystem Id is invalid: " + inputFsId);
}
}
log.debug(methodName + "input file system ids: " + inputIdList);
fsList = _syncManager.getFileSystemDetailList(inputIdList);
}
returnList = new ArrayList<VasaAssociationObject>();
for (FileShare fileShare : fsList) {
VasaAssociationObject associationObject = new VasaAssociationObject();
BaseStorageEntity assoc = new BaseStorageEntity();
assoc.setUniqueIdentifier(fileShare.getCos().getId());
BaseStorageEntity entity = new BaseStorageEntity();
entity.setUniqueIdentifier(fileShare.getId());
associationObject.addAssociatedId(assoc);
associationObject.addEntityId(entity);
log.debug(methodName + "File system id[" + entity.getUniqueIdentifier() + "] is associated to capability[" + assoc.getUniqueIdentifier() + "]");
returnList.add(associationObject);
}
} catch (SOSFailure e1) {
log.error(methodName + "StorageOSFailure occured ", e1);
throw FaultUtil.StorageFault(e1);
} 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 vasa association objects of size[" + returnList.size() + "]");
return returnList.toArray(new VasaAssociationObject[0]);
}
use of com.emc.storageos.vasa.data.internal.FileShare in project coprhd-controller by CoprHD.
the class SyncManager method fetchFileShareDetailById.
private List<FileShare> fetchFileShareDetailById(List<String> fileSystemIdList) throws SOSFailure {
final String methodName = "fetchFileShareDetailById(): ";
log.trace(methodName + "Entry with input: " + fileSystemIdList);
List<FileShare> fileshareDetailList = new ArrayList<FileShare>();
final String FILESYSTEM_DETAIL_URI = "/file/filesystems/%s";
try {
if (fileSystemIdList != null) {
for (String fileSystemId : fileSystemIdList) {
FileShare fileshare = _client.queryObject(String.format(FILESYSTEM_DETAIL_URI, fileSystemId), FileShare.class);
if (fileshare != null) {
if (!fileshare.isInactive() && fileshare.getId() != null) {
fileshareDetailList.add(fileshare);
log.trace(methodName + fileshare);
}
}
}
}
} 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);
}
log.trace(methodName + "Exit returning file system list of size[" + fileshareDetailList.size() + "]");
return fileshareDetailList;
}
use of com.emc.storageos.vasa.data.internal.FileShare 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]);
}
Aggregations