Search in sources :

Example 36 with CIMProperty

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

the class SmisCommandHelper method getReplicationSettingData.

/*
     * Create ReplicationSettingData for single volume/group snapshot
     */
public CIMInstance getReplicationSettingData(StorageSystem storage, String snapSettingName, boolean isGroupConsistency) throws WBEMException {
    CIMInstance modifiedInstance = null;
    CloseableIterator<CIMInstance> repSvcCapIter = null;
    try {
        repSvcCapIter = getAssociatorInstances(storage, _cimPath.getControllerReplicationSvcPath(storage), null, _cimPath.prefixWithParamName(SmisConstants.REPLICATION_SERVICE_CAPABILTIES), null, null, null);
        if (repSvcCapIter != null && repSvcCapIter.hasNext()) {
            CIMInstance instance = repSvcCapIter.next();
            CIMArgument[] in = getDefaultReplicationSettingDataInputArgumentsForSnapshot();
            CIMArgument[] out = new CIMArgument[5];
            invokeMethod(storage, instance.getObjectPath(), SmisConstants.GET_DEFAULT_REPLICATION_SETTING_DATA, in, out);
            CIMInstance defaultInstance = (CIMInstance) _cimPath.getFromOutputArgs(out, SmisConstants.DEFAULT_INSTANCE);
            // populate properties
            List<CIMProperty> propList = new ArrayList<CIMProperty>();
            propList.add(new CIMProperty<Object>(SmisConstants.CP_ELEMENT_NAME, CIMDataType.STRING_T, snapSettingName));
            for (CIMProperty prop : defaultInstance.getProperties()) {
                if (isGroupConsistency && prop.getName().equals(SmisConstants.CP_CONSISTENT_POINT_IN_TIME)) {
                    propList.add(new CIMProperty<Object>(prop.getName(), prop.getDataType(), true));
                } else if (!prop.getName().equals(SmisConstants.CP_ELEMENT_NAME)) {
                    propList.add(prop);
                }
            }
            // ElementName is not in the defaultInstance, hence cannot be modified via
            // defaultInstance.deriveInstance
            // construct a new path, then create a new instance
            modifiedInstance = new CIMInstance(_cimPath.getReplicationSettingObjectPathFromDefault(defaultInstance), propList.toArray(new CIMProperty[] {}));
        }
    } finally {
        if (repSvcCapIter != null) {
            repSvcCapIter.close();
        }
    }
    return modifiedInstance;
}
Also used : CIMProperty(javax.cim.CIMProperty) ArrayList(java.util.ArrayList) BlockObject(com.emc.storageos.db.client.model.BlockObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) CIMInstance(javax.cim.CIMInstance) CIMArgument(javax.cim.CIMArgument)

Example 37 with CIMProperty

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

the class SmisCommandHelper method getSettingsDefineStateFromSourceGroup.

/**
 * Get SettingsDefineState instances related to the consistency group that
 * the source of the BlockSnapshot object belongs to.
 *
 * There is no association between source group and Synchronization aspects
 * (unlike source volume).
 * Steps -
 * 1. get consistency group from block snapshot
 * 2. get the CIMObjectPath of the consistency group
 * 3. query aspect instances with desired SyncType, SyncState, and array serial number in SourceElement
 * 4. check if SourceElement is the consistency group
 * 5. if yes, construct SettingsDefineState based on the source group and aspect
 *
 * @param storage
 *            StorageSystem that holds the SettingsDefineState instances
 * @param groupMember
 *            BlockObject that is part of a snapshot group
 * @return A List of CIMObjectPaths for SettingsDefineState instances
 * @throws WBEMException
 */
public List<CIMObjectPath> getSettingsDefineStateFromSourceGroup(StorageSystem storage, BlockObject groupMember) throws WBEMException {
    List<CIMObjectPath> settingsDefineStatePaths = new ArrayList<>();
    String groupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(groupMember, _dbClient);
    CIMObjectPath groupPath = _cimPath.getReplicationGroupPath(storage, groupName);
    /*
         * Query SourceElement name with groupPath string doesn't work as it is
         * actually an object path. Since there are special chars in the
         * InstanceID of groupPath (e.g, "+", "_"), avoid using the InstanceID
         * string in the LIKE operator.
         */
    String query = String.format("SELECT %s FROM %s WHERE %s='%s' AND %s='%s' AND %s LIKE '%s'", CP_SOURCE_ELEMENT, SYMM_SYNCHRONIZATION_ASPECT_FOR_SOURCE_GROUP, CP_SYNC_TYPE, SNAPSHOT_SYNC_TYPE_STR, CP_SYNC_STATE, RESTORED_SYNC_STATE_STR, CP_SOURCE_ELEMENT, storage.getSerialNumber());
    List<CIMInstance> aspectList = executeQuery(storage, query, "wql");
    if (aspectList != null && !aspectList.isEmpty()) {
        for (CIMInstance aspectInstance : aspectList) {
            String sourceElement = CIMPropertyFactory.getPropertyValue(aspectInstance, CP_SOURCE_ELEMENT);
            if (sourceElement.equalsIgnoreCase(groupPath.toString())) {
                // class name is lower case in SourceElement
                CIMProperty[] settingsKeys = { _cimProperty.reference(CP_MANAGED_ELEMENT, groupPath), _cimProperty.reference(CP_SETTING_DATA, aspectInstance.getObjectPath()) };
                settingsDefineStatePaths.add(CimObjectPathCreator.createInstance(SYMM_SETTINGS_DEFINE_STATE_RG_SAFS, ROOT_EMC_NAMESPACE, settingsKeys));
            }
        }
    }
    return settingsDefineStatePaths;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance)

Example 38 with CIMProperty

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

the class SmisCommandHelper method getCreateMetaVolumesInputArguments.

public CIMArgument[] getCreateMetaVolumesInputArguments(StorageSystem storageDevice, StoragePool pool, String label, Long capacity, int count, boolean isThinlyProvisioned, String metaType, Integer metaMemberCount, CIMInstance poolSetting) {
    ArrayList<CIMArgument> list = new ArrayList<CIMArgument>();
    try {
        CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
        CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
        CIMObjectPath[] inPoolPaths = new CIMObjectPath[] { inPoolPath };
        // Use thick/thin volume type
        int volumeType = isThinlyProvisioned ? THIN_STORAGE_VOLUME : STORAGE_VOLUME_VALUE;
        list.add(_cimArgument.uint16(CP_ELEMENT_TYPE, volumeType));
        list.add(_cimArgument.referenceArray(CP_EMC_IN_POOLS, inPoolPaths));
        list.add(_cimArgument.uint64(CP_SIZE, capacity));
        if (count > 1) {
            list.add(_cimArgument.uint32(CP_EMC_NUMBER_OF_DEVICES, count));
        }
        if (label != null) {
            list.add(_cimArgument.string(CP_ELEMENT_NAME, label));
        }
        // Set composite type
        int compositeType = metaType.equalsIgnoreCase(Volume.CompositionType.STRIPED.toString()) ? STRIPED_META_VOLUME_TYPE : CONCATENATED_META_VOLUME_TYPE;
        list.add(_cimArgument.uint16(CP_COMPOSITE_TYPE, compositeType));
        // Set number of members
        list.add(_cimArgument.uint32(CP_EMCNUMBEROFMEMBERS, metaMemberCount));
        if (poolSetting != null) {
            list.add(_cimArgument.reference(CP_GOAL, poolSetting.getObjectPath()));
        }
    } catch (Exception e) {
        throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
    }
    CIMArgument[] result = {};
    result = list.toArray(result);
    return result;
}
Also used : CIMProperty(javax.cim.CIMProperty) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) 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) CIMArgument(javax.cim.CIMArgument)

Example 39 with CIMProperty

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

the class CimSubscriptionManager method createFilter.

/**
 * Creates an indication filter in the CIMOM for the given configuration.
 *
 * @param filterInfo The filter information.
 *
 * @return The CIM object path of the filter object.
 *
 * @throws WBEMException
 */
private CIMObjectPath createFilter(CimManagedFilterInfo filterInfo) throws WBEMException {
    StringBuilder filterNameBuilder = new StringBuilder();
    filterNameBuilder.append(_subscriptionsIdentifier);
    filterNameBuilder.append(CimConstants.PATH_NAME_DELIMITER);
    filterNameBuilder.append(filterInfo.getName());
    String filterName = filterNameBuilder.toString();
    String implNS = _connection.getImplNamespace();
    CIMProperty<?> nameProperty = new CIMProperty<String>(CimConstants.NAME_KEY, CIMDataType.STRING_T, filterName);
    CIMProperty<?> srcNamespaceProp = new CIMProperty<String>(CimConstants.FILTER_PROP_SRC_NAMESPACE, CIMDataType.STRING_T, implNS);
    CIMProperty<?> srcNamespacesProp = new CIMProperty<String[]>(CimConstants.FILTER_PROP_SRC_NAMESPACES, CIMDataType.STRING_ARRAY_T, new String[] { implNS });
    CIMProperty<?> queryLangProp = new CIMProperty<String>(CimConstants.FILTER_PROP_QUERY_LANGUAGE, CIMDataType.STRING_T, filterInfo.getQueryLanguage());
    CIMProperty<?> queryProp = new CIMProperty<String>(CimConstants.FILTER_PROP_QUERY, CIMDataType.STRING_T, filterInfo.getQuery());
    CIMProperty<?>[] filterProperties = new CIMProperty[] { nameProperty, srcNamespaceProp, srcNamespacesProp, queryLangProp, queryProp };
    CIMObjectPath filterPath = createInstance(CimConstants.CIM_FILTER_NAME, filterName, filterProperties);
    _filterPaths.add(filterPath);
    return filterPath;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath)

Example 40 with CIMProperty

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

the class CimSubscriptionManager method createHandler.

/**
 * Creates an indication handler in the CIMOM from the indication listener's
 * configuration.
 *
 * The WBEM listener interface does not provide a mechanism for getting the
 * source IP address of a received indication. To match indications with
 * connections, the connection name is put in the handler's destination URL
 * as the path component.
 *
 * @return the CIM object path of the handler
 * @throws WBEMException, ConnectionManagerException
 */
private CIMObjectPath createHandler() throws WBEMException, ConnectionManagerException {
    CimListener listener = _connection.getIndicationListener();
    URL listenerURL = listener.getURL();
    if (listenerURL == null) {
        // Verify that the listener URL has been set.
        throw new ConnectionManagerException("Listener URL is not set, Subscription handler cannot be set.");
    }
    StringBuffer handlerNameBuff = new StringBuffer();
    handlerNameBuff.append(_subscriptionsIdentifier);
    handlerNameBuff.append(CimConstants.PATH_NAME_DELIMITER);
    handlerNameBuff.append(listenerURL.getHost());
    handlerNameBuff.append(CimConstants.PATH_NAME_DELIMITER);
    handlerNameBuff.append(listenerURL.getPort());
    String handlerName = handlerNameBuff.toString();
    CIMProperty<?> destinationProperty = new CIMProperty<String>(CimConstants.HANLDER_PROP_DESTINATION, CIMDataType.STRING_T, listenerURL.toString() + '/' + _connection.getConnectionName());
    CIMProperty<?>[] handlerProperties = new CIMProperty[] { destinationProperty };
    return createInstance(CimConstants.CIM_HANDLER_NAME, handlerName, handlerProperties);
}
Also used : CIMProperty(javax.cim.CIMProperty) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) URL(java.net.URL)

Aggregations

CIMProperty (javax.cim.CIMProperty)74 CIMObjectPath (javax.cim.CIMObjectPath)57 CIMInstance (javax.cim.CIMInstance)37 ArrayList (java.util.ArrayList)26 WBEMException (javax.wbem.WBEMException)25 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)18 CIMArgument (javax.cim.CIMArgument)16 WBEMClient (javax.wbem.client.WBEMClient)14 IOException (java.io.IOException)11 Volume (com.emc.storageos.db.client.model.Volume)10 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)10 URI (java.net.URI)9 ServiceCodeException (com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException)8 UnsignedInteger16 (javax.cim.UnsignedInteger16)8 DbClient (com.emc.storageos.db.client.DbClient)7 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)7 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)6 HashMap (java.util.HashMap)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)5 Initiator (com.emc.storageos.db.client.model.Initiator)5