use of com.vmware.vim.vasa._1_0.NotFound 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.vmware.vim.vasa._1_0.NotFound in project coprhd-controller by CoprHD.
the class HostStorageAPI method setMultipathPolicy.
/**
* Sets the multipath policy on the given lun
*
* @param lun the lun to set the policy on
* @param multipathPolicy name of the multipath policy
*/
public void setMultipathPolicy(HostScsiDisk lun, String multipathPolicy) {
try {
HostStorageSystem storageSystem = getStorageSystem();
HostMultipathInfoLogicalUnitPolicy policy = createMultipathPolicy(multipathPolicy);
storageSystem.setMultipathLunPolicy(lun.getUuid(), policy);
} catch (HostConfigFault e) {
throw new VMWareException(e);
} catch (NotFound e) {
throw new VMWareException(e);
} catch (RuntimeFault e) {
throw new VMWareException(e);
} catch (RemoteException e) {
throw new VMWareException(e);
}
}
use of com.vmware.vim.vasa._1_0.NotFound 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