Search in sources :

Example 1 with NotFound

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;
}
Also used : HighAvailabilityVolumes(com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolumes) AssociatedPool(com.emc.storageos.vasa.data.internal.Volume.AssociatedPool) ArrayList(java.util.ArrayList) FileShare(com.emc.storageos.vasa.data.internal.FileShare) Volume(com.emc.storageos.vasa.data.internal.Volume) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) NotFound(com.vmware.vim.vasa._1_0.NotFound)

Example 2 with NotFound

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);
    }
}
Also used : HostStorageSystem(com.vmware.vim25.mo.HostStorageSystem) HostMultipathInfoLogicalUnitPolicy(com.vmware.vim25.HostMultipathInfoLogicalUnitPolicy) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) HostConfigFault(com.vmware.vim25.HostConfigFault) NotFound(com.vmware.vim25.NotFound)

Example 3 with NotFound

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]);
}
Also used : ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) FileShare(com.emc.storageos.vasa.data.internal.FileShare) StorageFileSystem(com.vmware.vim.vasa._1_0.data.xsd.StorageFileSystem) FileSystemInfo(com.vmware.vim.vasa._1_0.data.xsd.FileSystemInfo) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Aggregations

FileShare (com.emc.storageos.vasa.data.internal.FileShare)2 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)2 InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)2 ArrayList (java.util.ArrayList)2 Volume (com.emc.storageos.vasa.data.internal.Volume)1 AssociatedPool (com.emc.storageos.vasa.data.internal.Volume.AssociatedPool)1 HighAvailabilityVolumes (com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolumes)1 NotFound (com.vmware.vim.vasa._1_0.NotFound)1 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)1 FileSystemInfo (com.vmware.vim.vasa._1_0.data.xsd.FileSystemInfo)1 StorageFileSystem (com.vmware.vim.vasa._1_0.data.xsd.StorageFileSystem)1 HostConfigFault (com.vmware.vim25.HostConfigFault)1 HostMultipathInfoLogicalUnitPolicy (com.vmware.vim25.HostMultipathInfoLogicalUnitPolicy)1 NotFound (com.vmware.vim25.NotFound)1 RuntimeFault (com.vmware.vim25.RuntimeFault)1 HostStorageSystem (com.vmware.vim25.mo.HostStorageSystem)1 RemoteException (java.rmi.RemoteException)1