Search in sources :

Example 1 with NotFound

use of com.vmware.vim25.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.vim25.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)

Aggregations

FileShare (com.emc.storageos.vasa.data.internal.FileShare)1 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 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)1 InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)1 NotFound (com.vmware.vim.vasa._1_0.NotFound)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 ArrayList (java.util.ArrayList)1