Search in sources :

Example 1 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSAlarmManager method getThinlyProvisionedStatus.

public String getThinlyProvisionedStatus(SyncManager manager, Volume volume) throws StorageFault {
    final String methodName = "getThinlyProvisioningStatus(): ";
    log.debug(methodName + "Called with input:" + volume);
    if (volume != null && volume.isThinlyProvisioned()) {
        if (volume.getAllocatedCapacityInGB() >= volume.getRequestedCapacityInGB()) {
            return AlarmStatusEnum.Green.getValue();
        }
        try {
            if (volume.getHaVolumeList() != null && volume.getHaVolumeList().getHaVolumeList() != null) {
                // This is a VPlex volume
                return getThinlyProvisionStatusOfHAVolumes(manager, volume.getHaVolumeList().getHaVolumeList());
            } else {
                // This is a normal volume
                AssociatedPool associatedPool = manager.fetchAssociatedPoolOfVolume(volume.getId());
                StoragePool storagePool = manager.fetchStoragePoolByHref(associatedPool.getStoragepool().getLink().getHref());
                return this.getThinlyProvisionStatusOfStoragePool(storagePool);
            }
        } catch (SOSFailure e) {
            log.error(methodName + "SOSFailure failure occured", e);
            throw FaultUtil.StorageFault(e);
        }
    }
    return AlarmStatusEnum.Green.getValue();
}
Also used : AssociatedPool(com.emc.storageos.vasa.data.internal.Volume.AssociatedPool) StoragePool(com.emc.storageos.vasa.data.internal.StoragePool) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 2 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure 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 3 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSManager method queryAssociatedCapabilityForLun.

/**
 * Makes a call to Bourne to get the details of associated capability for
 * the given lun Ids
 *
 * @param lunId
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedCapabilityForLun(String[] lunIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryAssociatedCapabilityForLun(): ";
    log.debug(methodName + "Entry");
    List<Volume> volumeList = null;
    List<VasaAssociationObject> returnList = null;
    try {
        Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
        Boolean supportsCapability = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
        if (supportsBlock == false || supportsCapability == false) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        this.setVolumeIds();
        if (Util.isEmpty(lunIds)) {
            volumeList = _syncManager.getVolumeDetailList(this._reportedVolumeIdList);
        } else {
            List<String> inputLunIds = new ArrayList<String>();
            this.setVolumeIds();
            for (String inputLunId : lunIds) {
                if (!Util.isEmpty(inputLunId)) {
                    if (!inputLunId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
                        throw FaultUtil.InvalidArgument("Given StorageLun Id is invalid: " + inputLunId);
                    }
                    if (_reportedVolumeIdList.contains(inputLunId)) {
                        inputLunIds.add(inputLunId);
                    }
                } else {
                    throw FaultUtil.InvalidArgument("Given StorageLun Id is invalid: " + inputLunId);
                }
            }
            // log.debug(methodName + "input LUN ids: " + inputLunIds);
            volumeList = _syncManager.getVolumeDetailList(inputLunIds);
        }
        returnList = new ArrayList<VasaAssociationObject>();
        for (Volume volume : volumeList) {
            VasaAssociationObject associationObject = new VasaAssociationObject();
            BaseStorageEntity assoc = new BaseStorageEntity();
            assoc.setUniqueIdentifier(volume.getCos().getId());
            associationObject.addAssociatedId(assoc);
            BaseStorageEntity entity = new BaseStorageEntity();
            entity.setUniqueIdentifier(volume.getId());
            associationObject.addEntityId(entity);
            log.debug(methodName + "LUN id[" + entity.getUniqueIdentifier() + "] is associated to capability[" + assoc.getUniqueIdentifier() + "]");
            returnList.add(associationObject);
        }
    } 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 vasa association objects of size[" + returnList.size() + "]");
    return returnList.toArray(new VasaAssociationObject[0]);
}
Also used : VasaAssociationObject(com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject) ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) Volume(com.emc.storageos.vasa.data.internal.Volume) BaseStorageEntity(com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 4 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSManager method queryStorageLuns.

/**
 * Makes a call to Bourne to get the details of given storage lun Ids
 *
 * @param lunUniqueIds
 * @return array of <code>StorageLun</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized StorageLun[] queryStorageLuns(String[] lunUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
    final String methodName = "queryStorageLuns(): ";
    log.debug(methodName + "Entry");
    List<StorageLun> storageLunList = 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 (Util.isEmpty(lunUniqueIds)) {
            throw FaultUtil.InvalidArgument("Given LUN Ids are invalid");
        }
        for (String inputLunId : lunUniqueIds) {
            if (!Util.isEmpty(inputLunId)) {
                if (!inputLunId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given LUN Id is invalid: " + inputLunId);
                }
            } else {
                throw FaultUtil.InvalidArgument("Given LUN Id is invalid: " + inputLunId);
            }
        }
        // List<String> inputLunIdList = Arrays.asList(lunUniqueIds);
        List<String> existingVolIds = new ArrayList<String>();
        this.setVolumeIds();
        for (String inputLunId : lunUniqueIds) {
            if (_reportedVolumeIdList.contains(inputLunId)) {
                existingVolIds.add(inputLunId);
            }
        }
        storageLunList = new ArrayList<StorageLun>();
        List<Volume> volumeList = null;
        volumeList = _syncManager.getVolumeDetailList(existingVolIds);
        for (Volume volume : volumeList) {
            StorageLun lun = new StorageLun();
            lun.setUniqueIdentifier(volume.getId());
            Long volumeCapacityInMB = (long) (volume.getRequestedCapacityInGB() * 1024);
            Long volumeUsedCapacityInMB = (long) (volume.getAllocatedCapacityInGB() * 1024);
            lun.setCapacityInMB(volumeCapacityInMB);
            lun.setDisplayName(volume.getName());
            lun.setDrsManagementPermitted(true);
            String esxLunId = "naa.";
            if (volume.getWWN() != null) {
                esxLunId += volume.getWWN().toLowerCase();
            }
            lun.setEsxLunIdentifier(esxLunId);
            lun.setThinProvisioned(volume.isThinlyProvisioned());
            String alarmStatus = _alarmManager.getThinlyProvisionedStatus(_syncManager, volume);
            lun.setThinProvisioningStatus(alarmStatus);
            lun.setUsedSpaceInMB(volumeUsedCapacityInMB);
            if (log.isDebugEnabled()) {
                log.debug(methodName + " Lun detail: id[" + lun.getUniqueIdentifier() + "] ESXLunIdentifier[" + lun.getEsxLunIdentifier() + "] capacityInMB[" + lun.getCapacityInMB() + "] name[" + lun.getDisplayName() + "] DRSManagementPermitted[" + lun.getDrsManagementPermitted() + "] thinProvisioned[" + lun.getThinProvisioned() + "] thinProvisioningStatus[" + lun.getThinProvisioningStatus() + "] usedSpaceInMB[" + lun.getUsedSpaceInMB() + "]");
            }
            storageLunList.add(lun);
        }
    } 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 LUN list of size[" + storageLunList.size() + "]");
    return storageLunList.toArray(new StorageLun[0]);
}
Also used : ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) StorageLun(com.vmware.vim.vasa._1_0.data.xsd.StorageLun) Volume(com.emc.storageos.vasa.data.internal.Volume) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 5 with SOSFailure

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

Aggregations

SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)29 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)18 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)18 ArrayList (java.util.ArrayList)15 InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)7 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)6 FileShare (com.emc.storageos.vasa.data.internal.FileShare)5 CoS (com.emc.storageos.vasa.data.internal.CoS)4 StoragePool (com.emc.storageos.vasa.data.internal.StoragePool)4 Volume (com.emc.storageos.vasa.data.internal.Volume)4 AssociatedPool (com.emc.storageos.vasa.data.internal.Volume.AssociatedPool)4 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)3 BaseStorageEntity (com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity)3 VasaAssociationObject (com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject)3 CoSElement (com.emc.storageos.vasa.data.internal.CoS.CoSElement)2 CoSList (com.emc.storageos.vasa.data.internal.CoS.CoSList)2 FileSystemExports (com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports)2 List (java.util.List)2 Event (com.emc.storageos.vasa.data.internal.Event)1 AssociatedResource (com.emc.storageos.vasa.data.internal.FileShare.AssociatedResource)1