Search in sources :

Example 11 with UnsignedInteger16

use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.

the class SRDFOperations method getReplicationSettingDataInstance.

/**
 * Gets the replication setting data instance.
 *
 * @param sourceSystem the source system
 * @param modeValue the mode value
 * @param nonEmptyRDFGroup indicates whether to pass CONSISTENCY_EXEMPT flag or not
 *            CONSISTENCY_EXEMPT does not need to be set if the RDF group is empty
 *            CONSISTENCY_EXEMPT should only be specified if the devices in the RDF group are in ASYNC mode
 * @param formatVolumeFlagNeeded
 * @return the replication setting data instance
 */
private CIMInstance getReplicationSettingDataInstance(final StorageSystem sourceSystem, int modeValue, boolean nonEmptyRDFGroup, boolean formatVolumeFlagNeeded) throws Exception {
    CIMInstance modifiedInstance = null;
    CIMObjectPath replicationSettingCapabilities = cimPath.getReplicationServiceCapabilitiesPath(sourceSystem);
    int replicationType = Mode.ASYNCHRONOUS.getMode() == modeValue ? ASYNC_MIRROR_REMOTE_REPLICATION_TYPE : SYNC_MIRROR_REMOTE_REPLICATION_TYPE;
    CIMArgument[] inArgs = helper.getReplicationSettingDataInstance(replicationType);
    CIMArgument[] outArgs = new CIMArgument[5];
    helper.invokeMethod(sourceSystem, replicationSettingCapabilities, "GetDefaultReplicationSettingData", inArgs, outArgs);
    for (CIMArgument<?> outArg : outArgs) {
        if (null == outArg) {
            continue;
        }
        if (outArg.getName().equalsIgnoreCase(DEFAULT_INSTANCE)) {
            CIMInstance repInstance = (CIMInstance) outArg.getValue();
            if (null != repInstance) {
                List<CIMProperty<?>> propList = new ArrayList<CIMProperty<?>>();
                if (Mode.ASYNCHRONOUS.getMode() == modeValue && nonEmptyRDFGroup) {
                    CIMProperty<?> existingProp = repInstance.getProperty(EMC_CONSISTENCY_EXEMPT);
                    CIMProperty<?> prop = null;
                    if (existingProp == null) {
                        // ConsistencyExempt property is now part of the smi-s standard. Available in providers 8.0+ (VMAX3 arrays)
                        // EMCConsistencyExempt property in ReplicationSettingData is removed
                        existingProp = repInstance.getProperty(CONSISTENCY_EXEMPT);
                        prop = new CIMProperty<Object>(CONSISTENCY_EXEMPT, existingProp.getDataType(), true);
                    } else {
                        prop = new CIMProperty<Object>(EMC_CONSISTENCY_EXEMPT, existingProp.getDataType(), true);
                    }
                    propList.add(prop);
                }
                // Use force flag only if the RDF Group is not empty AND if the source volume doesn't have any data on it.
                // Through ViPR only if its change virtual pool operation, the source volume will have data, hence
                // formatVolumeFlagNeeded flag will be set to false only during ChangeVirtualPool
                log.info("NonEmptyRDFGroup : {}, formatFlagNeeded {} ", nonEmptyRDFGroup, formatVolumeFlagNeeded);
                if (nonEmptyRDFGroup && Mode.ACTIVE.getMode() == modeValue && formatVolumeFlagNeeded) {
                    log.info("Adding format flag to replication Group Instance...");
                    // NOTE: Format flag will wipe out the data.
                    // he FORMAT property is not available as part of the default Replication Instance.
                    // We will be on our own adding this property..
                    CIMProperty<?> formatData = new CIMProperty<Object>(FORMAT, BOOLEAN_T, true);
                    List<CIMProperty<?>> dupPropList = new ArrayList<CIMProperty<?>>();
                    dupPropList.addAll(Arrays.asList(repInstance.getProperties()));
                    dupPropList.add(formatData);
                    CIMInstance duplicateRepInstance = new CIMInstance(repInstance.getObjectPath(), dupPropList.toArray(new CIMProperty<?>[] {}));
                    // Re-assigning
                    repInstance = duplicateRepInstance;
                }
                // Set target supplier to Implementation Decides so that the supplied targets can be used
                CIMProperty<?> targetElementSupplier = new CIMProperty<Object>(TARGET_ELEMENT_SUPPLIER, UINT16_T, new UnsignedInteger16(IMPLEMENTATION_DECIDES));
                propList.add(targetElementSupplier);
                modifiedInstance = repInstance.deriveInstance(propList.toArray(new CIMProperty<?>[] {}));
                break;
            }
        }
    }
    return modifiedInstance;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) CustomQueryUtility.queryActiveResourcesByConstraint(com.emc.storageos.db.client.util.CustomQueryUtility.queryActiveResourcesByConstraint) UnsignedInteger16(javax.cim.UnsignedInteger16) CIMProperty(javax.cim.CIMProperty) BlockObject(com.emc.storageos.db.client.model.BlockObject) CIMArgument(javax.cim.CIMArgument)

Example 12 with UnsignedInteger16

use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.

the class SmisCommandHelper method arraySupports.

public boolean arraySupports(StorageSystem storage, int operation) {
    boolean result = false;
    CIMArgument[] out = new CIMArgument[5];
    try {
        invokeMethod(storage, _cimPath.getReplicationServiceCapabilitiesPath(storage), GET_SUPPORTED_OPERATIONS, getSupportedOperationsForSnapshot(), out);
        Object value = _cimPath.getFromOutputArgs(out, SUPPORTED_OPERATIONS);
        if (value != null) {
            UnsignedInteger16[] supported = (UnsignedInteger16[]) value;
            for (UnsignedInteger16 it : supported) {
                if (it.intValue() == operation) {
                    result = true;
                    break;
                }
            }
        }
    } catch (WBEMException e) {
        _log.error("arraySupportsDissolve exception: ", e);
    }
    return result;
}
Also used : BlockObject(com.emc.storageos.db.client.model.BlockObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) WBEMException(javax.wbem.WBEMException) UnsignedInteger16(javax.cim.UnsignedInteger16) CIMArgument(javax.cim.CIMArgument)

Example 13 with UnsignedInteger16

use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getAddStorageCIMArguments.

public CIMArgument[] getAddStorageCIMArguments(StorageSystem storage) throws WBEMException {
    String[] ips;
    UnsignedInteger16[] types;
    if (storage.getSecondaryIPs() == null) {
        ips = new String[] { storage.getIpAddress() };
        types = new UnsignedInteger16[] { new UnsignedInteger16(2) };
    } else {
        ips = new String[storage.getSecondaryIPs().size() + 1];
        types = new UnsignedInteger16[ips.length];
        ips[0] = storage.getIpAddress();
        types[0] = new UnsignedInteger16(2);
        int idx = 1;
        for (String ip : storage.getSecondaryIPs()) {
            ips[idx] = ip;
            types[idx] = new UnsignedInteger16(2);
            idx++;
        }
    }
    CIMArgument[] addSysArgs = new CIMArgument[] { _cimArgument.uint16("ArrayType", getArrayType(storage)), _cimArgument.stringArray("Addresses", ips), _cimArgument.uint16Array("Types", types), _cimArgument.string("User", storage.getUsername()), _cimArgument.string("Password", storage.getPassword()) };
    return addSysArgs;
}
Also used : UnsignedInteger16(javax.cim.UnsignedInteger16) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) CIMArgument(javax.cim.CIMArgument)

Example 14 with UnsignedInteger16

use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getCreateVolumesInputArgumentsasList80.

public List<CIMArgument> getCreateVolumesInputArgumentsasList80(StorageSystem storageDevice, StoragePool pool, List<String> labels, Long capacity, int count, boolean isThinlyProvisioned) {
    ArrayList<CIMArgument> list = new ArrayList<>();
    try {
        CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
        CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
        // Use thick/thin volume type
        Integer volumeType = isThinlyProvisioned ? STORAGE_VOLUME_TYPE_THIN : STORAGE_VOLUME_VALUE;
        // Create array values
        // Adding Goal parameter if volumes need to be FAST Enabled
        list.add(_cimArgument.referenceArray(CP_IN_POOL, toMultiElementArray(count, inPoolPath)));
        list.add(_cimArgument.uint64Array(CP_SIZE, toMultiElementArray(count, new UnsignedInteger64(Long.toString(capacity)))));
        list.add(_cimArgument.uint32Array(CP_EMC_NUMBER_OF_DEVICE_FOR_EACH_CONFIG, toMultiElementArray(count, SINGLE_DEVICE_FOR_EACH_CONFIG)));
        if (labels != null) {
            // Convert labels to array
            String[] labelsArray = labels.toArray(new String[] {});
            list.add(_cimArgument.stringArray(CP_ELEMENT_NAMES, labelsArray));
        }
        // Add CIMArgument instances to the list
        if (!storageDevice.checkIfVmax3()) {
            list.add(_cimArgument.uint16Array(CP_ELEMENT_TYPE, toMultiElementArray(count, new UnsignedInteger16(volumeType))));
        }
    } catch (Exception e) {
        throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
    }
    return list;
}
Also used : UnsignedInteger64(javax.cim.UnsignedInteger64) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger16(javax.cim.UnsignedInteger16) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) ServiceCodeException(com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException) CIMProperty(javax.cim.CIMProperty) CIMArgument(javax.cim.CIMArgument)

Example 15 with UnsignedInteger16

use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getCreateVolumesInputArguments.

public CIMArgument[] getCreateVolumesInputArguments(StorageSystem storageDevice, StoragePool pool, List<String> labels, Long capacity, int count, boolean isThinlyProvisioned, boolean isBoundToPool, CIMObjectPath volumeGroupPath, boolean fullyAllocated) {
    List<CIMArgument> list = getCreateVolumesInputArgumentsasList(storageDevice, pool, labels, capacity, count, isThinlyProvisioned);
    if (!isBoundToPool) {
        if (storageDevice.getUsingSmis80()) {
            list.add(_cimArgument.boolArray(CP_EMC_BIND_ELEMENTS, toMultiElementArray(count, false)));
        } else {
            list.add(_cimArgument.bool(CP_EMC_BIND_ELEMENTS, false));
        }
    }
    if (storageDevice.checkIfVmax3()) {
        if (volumeGroupPath != null) {
            list.add(_cimArgument.referenceArray(CP_EMC_COLLECTIONS, toMultiElementArray(count, volumeGroupPath)));
        }
        // set volumeType for fully-thin or fully-allocated
        int volumeType = fullyAllocated ? STORAGE_VOLUME_FULLY_ALLOCATED : STORAGE_VOLUME_TYPE_THIN;
        if (storageDevice.getUsingSmis80()) {
            list.add(_cimArgument.uint16Array(CP_ELEMENT_TYPE, toMultiElementArray(count, new UnsignedInteger16(volumeType))));
        } else {
            list.add(_cimArgument.uint16(CP_ELEMENT_TYPE, volumeType));
        }
    }
    CIMArgument[] result = {};
    result = list.toArray(result);
    return result;
}
Also used : AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) UnsignedInteger16(javax.cim.UnsignedInteger16) CIMArgument(javax.cim.CIMArgument)

Aggregations

UnsignedInteger16 (javax.cim.UnsignedInteger16)27 CIMInstance (javax.cim.CIMInstance)13 CIMArgument (javax.cim.CIMArgument)10 CIMObjectPath (javax.cim.CIMObjectPath)9 CIMProperty (javax.cim.CIMProperty)8 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)7 ArrayList (java.util.ArrayList)7 WBEMException (javax.wbem.WBEMException)6 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)5 StringSet (com.emc.storageos.db.client.model.StringSet)5 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)5 Iterator (java.util.Iterator)5 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)4 AccessProfile (com.emc.storageos.plugins.AccessProfile)4 URI (java.net.URI)3 BlockObject (com.emc.storageos.db.client.model.BlockObject)2 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 OperationalStatus (com.emc.storageos.db.client.model.StoragePort.OperationalStatus)2