Search in sources :

Example 16 with InvalidArgument

use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.

the class SOSManager method queryArrays.

/**
 * Returns the storage array details for the given storage array Ids
 *
 * @param arrayId
 * @return array of <code>StorageArray</code> objects. Each having details
 *         of profiles the storage array supports
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 */
public synchronized StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
    // Mandatory function
    final String methodName = "queryArrays(): ";
    log.debug(methodName + "Entry");
    List<StorageArray> storageArrayList = null;
    StorageArray[] arrays = null;
    if (!Util.isEmpty(arrayId)) {
        log.debug(methodName + "input array ids: " + Arrays.asList(arrayId));
    } else {
        log.debug(methodName + "input array ids: " + arrayId);
    }
    try {
        String sosArrayId = this.getArrayId();
        if (!Util.isEmpty(arrayId)) {
            storageArrayList = new ArrayList<StorageArray>();
            for (String inputArrayId : arrayId) {
                if (!inputArrayId.startsWith(STORAGEARRAY_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given array Id is invalid:[" + arrayId + "]");
                }
                if (sosArrayId.equals(inputArrayId)) {
                    StorageArray storageArray = this.getSOSStorageArray();
                    storageArray.setUniqueIdentifier(inputArrayId);
                    storageArrayList.add(storageArray);
                }
            }
            return storageArrayList.toArray(new StorageArray[0]);
        }
        arrays = new StorageArray[1];
        StorageArray array = this.getSOSStorageArray();
        arrays[0] = array;
    } catch (StorageFault e) {
        log.error("StorageFault occured", e);
        throw e;
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    }
    log.debug(methodName + "Exit returning arrays of size[" + arrays.length + "]");
    return arrays;
}
Also used : InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) StorageFault(com.vmware.vim.vasa._1_0.StorageFault) StorageArray(com.vmware.vim.vasa._1_0.data.xsd.StorageArray)

Example 17 with InvalidArgument

use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.

the class ServiceImpl method handleExceptionsAsStorageFault.

protected void handleExceptionsAsStorageFault(Exception e) throws InvalidArgument, InvalidSession, StorageFault {
    if (e instanceof InvalidArgument) {
        throw (InvalidArgument) e;
    } else if (e instanceof InvalidSession) {
        throw (InvalidSession) e;
    } else if (e instanceof StorageFault) {
        throw (StorageFault) e;
    } else {
        StorageFault sfe = FaultUtil.StorageFault(e);
        sfe.setStackTrace(e.getStackTrace());
        throw sfe;
    }
}
Also used : InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) StorageFault(com.vmware.vim.vasa._1_0.StorageFault) InvalidSession(com.vmware.vim.vasa._1_0.InvalidSession)

Example 18 with InvalidArgument

use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.

the class ServiceImpl method queryArrays.

/**
 * Returns array details of the requested arrayIds
 *
 * @param arrayId
 *            array of arrayIds
 * @return array of StorageArray objects having storage array details
 *         respectively
 * @throws InvalidArgument
 *             if usage context is incorrect
 * @throws InvalidSession
 *             if session Id is invalid
 * @throws StorageFault
 *             if there is a failure in the underlying storage
 */
public StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
    // Mandatory function
    final String methodName = "queryArrays(): ";
    log.info(methodName + "Entry");
    if (arrayId != null) {
        log.info(methodName + "input array Ids: " + Arrays.asList(arrayId));
    }
    // verify valid SSL and VASA Sessions.
    sslUtil.checkHttpRequest(true, true);
    UsageContext uc = contextManager.getUsageContext();
    if (Util.isEmpty(uc.getHostInitiator())) {
        StorageArray[] arrays = new StorageArray[0];
        log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
        return arrays;
    }
    SOSManager sosManager = contextManager.getSOSManager();
    StorageArray[] arrays = sosManager.queryArrays(arrayId);
    log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
    return arrays;
}
Also used : UsageContext(com.vmware.vim.vasa._1_0.data.xsd.UsageContext) StorageArray(com.vmware.vim.vasa._1_0.data.xsd.StorageArray)

Aggregations

InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)14 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)10 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)8 ArrayList (java.util.ArrayList)8 StorageFault (com.vmware.vim.vasa._1_0.StorageFault)5 BaseStorageEntity (com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity)5 VasaAssociationObject (com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject)5 FileShare (com.emc.storageos.vasa.data.internal.FileShare)3 Volume (com.emc.storageos.vasa.data.internal.Volume)3 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)2 InvalidSession (com.vmware.vim.vasa._1_0.InvalidSession)2 StorageArray (com.vmware.vim.vasa._1_0.data.xsd.StorageArray)2 CertificateExpiredException (java.security.cert.CertificateExpiredException)2 CertificateNotYetValidException (java.security.cert.CertificateNotYetValidException)2 List (java.util.List)2 CoS (com.emc.storageos.vasa.data.internal.CoS)1 Event (com.emc.storageos.vasa.data.internal.Event)1 AssociatedPool (com.emc.storageos.vasa.data.internal.Volume.AssociatedPool)1 HighAvailabilityVolumes (com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolumes)1 SessionContext (com.emc.storageos.vasa.util.SessionContext)1