Search in sources :

Example 1 with CIMPropertyFactory

use of com.emc.storageos.volumecontroller.impl.smis.CIMPropertyFactory in project coprhd-controller by CoprHD.

the class VmaxExportOperations method setVSAFlagForIG.

private void setVSAFlagForIG(StorageSystem storage, CIMObjectPath initiatorGroupPath, boolean VSAFlag) throws Exception {
    WBEMClient client = _helper.getConnection(storage).getCimClient();
    CIMPropertyFactory factoryRef = (CIMPropertyFactory) ControllerServiceImpl.getBean("CIMPropertyFactory");
    CIMInstance toUpdate = new CIMInstance(initiatorGroupPath, new CIMProperty[] { factoryRef.bool(SmisConstants.CP_EMC_VSA_ENABLED, VSAFlag) });
    client.modifyInstance(toUpdate, SmisConstants.PS_EMC_VSA_ENABLED);
}
Also used : CIMPropertyFactory(com.emc.storageos.volumecontroller.impl.smis.CIMPropertyFactory) WBEMClient(javax.wbem.client.WBEMClient) CIMInstance(javax.cim.CIMInstance)

Example 2 with CIMPropertyFactory

use of com.emc.storageos.volumecontroller.impl.smis.CIMPropertyFactory in project coprhd-controller by CoprHD.

the class SmisCreateMaskingViewJob method enableRecoverPointTag.

/**
 * Method will set the EMCRecoverPointEnabled flag on the device masking group for VMAX.
 *
 * @param dbClient [in] - Client instance for reading/writing from/to DB
 * @param client [in] - WBEMClient used for reading/writing from/to SMI-S
 * @param deviceGroupPath [in] - CIMObjectPath referencing the volume
 */
private void enableRecoverPointTag(DbClient dbClient, WBEMClient client, CIMObjectPath deviceGroupPath) {
    try {
        boolean isRPTagNeeded = false;
        // Check if the volumes being protected are RP volumes
        for (VolumeURIHLU volUriHlu : _volumeURIHLUs) {
            URI volumeURI = volUriHlu.getVolumeURI();
            BlockObject bo = null;
            if (URIUtil.isType(volumeURI, BlockSnapshot.class)) {
                bo = dbClient.queryObject(BlockSnapshot.class, volumeURI);
            } else if (URIUtil.isType(volumeURI, Volume.class)) {
                bo = dbClient.queryObject(Volume.class, volumeURI);
            }
            if (bo != null && BlockObject.checkForRP(dbClient, bo.getId())) {
                isRPTagNeeded = true;
                break;
            }
        }
        // Do nothing and return from if none of the volumes are RP protected
        if (isRPTagNeeded) {
            _log.info("Attempting to enable RecoverPoint tag on Device Group : " + deviceGroupPath.toString());
            CIMPropertyFactory factoryRef = (CIMPropertyFactory) ControllerServiceImpl.getBean("CIMPropertyFactory");
            CIMInstance toUpdate = new CIMInstance(deviceGroupPath, new CIMProperty[] { factoryRef.bool(SmisConstants.EMC_RECOVERPOINT_ENABLED, true) });
            _log.debug("Params: " + toUpdate.toString());
            client.modifyInstance(toUpdate, SmisConstants.CP_EMC_RECOVERPOINT_ENABLED);
            _log.info(String.format("Device group has been successfully set with RecoverPoint tag "));
        }
    } catch (WBEMException e) {
        _log.error("Encountered an error while trying to set the RecoverPoint tag", e);
    } catch (DatabaseException e) {
        _log.error("Encountered an error while trying to set the RecoverPoint tag", e);
    }
}
Also used : CIMPropertyFactory(com.emc.storageos.volumecontroller.impl.smis.CIMPropertyFactory) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) WBEMException(javax.wbem.WBEMException) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BlockObject(com.emc.storageos.db.client.model.BlockObject) CIMInstance(javax.cim.CIMInstance) VolumeURIHLU(com.emc.storageos.volumecontroller.impl.VolumeURIHLU)

Aggregations

CIMPropertyFactory (com.emc.storageos.volumecontroller.impl.smis.CIMPropertyFactory)2 CIMInstance (javax.cim.CIMInstance)2 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 Volume (com.emc.storageos.db.client.model.Volume)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 VolumeURIHLU (com.emc.storageos.volumecontroller.impl.VolumeURIHLU)1 URI (java.net.URI)1 WBEMException (javax.wbem.WBEMException)1 WBEMClient (javax.wbem.client.WBEMClient)1