Search in sources :

Example 16 with CIMObjectPath

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

the class DCNMDialog method addZonesStrategy.

/**
 * Given a dialog, add one or more zones to the active zoneset of the specified vsan.
 * This method is callable from with Bourne or from MDSDialogTest for stand-alone testing.
 * For now the only type of zone members supported are pwwn.
 *
 * @param zones - List of zones to be created. Zone names will be overwritten.
 * @param vsanId - Integer vsanId
 * @return list of zone names that were added
 * @throws ControllerException
 */
public List<String> addZonesStrategy(List<Zone> zones, Integer vsanId) throws Exception {
    List<String> addedZoneNames = new ArrayList<String>();
    boolean inSession = false;
    boolean commit = true;
    CIMObjectPath zonesetServicePath = getZoneService(vsanId.toString());
    if (zonesetServicePath == null) {
        throw new DeviceControllerException("Couldn't locate ZoneSetService vsan: " + vsanId);
    }
    CIMInstance zonesetService = _client.getInstance(zonesetServicePath, false, false, null);
    try {
        // Start a session.
        inSession = startSession(_client, zonesetService);
        // Get the existing zones in the active zoneset.
        // XXX FIXME: Need to account for creating the zoneset if none exists.
        List<Zoneset> zonesets = getZonesets(vsanId);
        if (zonesets == null || zonesets.isEmpty()) {
            throw new DeviceControllerException("no zonesets");
        }
        Zoneset activeZoneset = zonesets.get(0);
        if (activeZoneset.getActive() != true) {
            throw new DeviceControllerException("no active zoneset");
        }
        for (Zone zone : zones) {
            CIMObjectPath zonePath = addZone(_client, zonesetService, ((CIMObjectPath) activeZoneset.getCimObjectPath()), zone.getName());
        }
    } finally {
        // Commit session.
        if (inSession) {
            endSession(_client, zonesetService, commit);
        }
    }
    return addedZoneNames;
}
Also used : ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMInstance(javax.cim.CIMInstance)

Example 17 with CIMObjectPath

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

the class DCNMDialog method getFabricInstance.

public CIMInstance getFabricInstance(String fabricId) throws WBEMException {
    CIMObjectPath path = CimObjectPathCreator.createInstance(_fabric_path, _namespace);
    CloseableIterator<CIMInstance> fabricIter = null;
    try {
        fabricIter = _client.enumerateInstances(path, false, true, true, null);
        while (fabricIter.hasNext()) {
            CIMInstance fabricIns = fabricIter.next();
            if (fabricId.equals(cimStringProperty(fabricIns, "ElementName"))) {
                return fabricIns;
            }
        }
    } finally {
        if (fabricIter != null) {
            fabricIter.close();
        }
    }
    return null;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance)

Example 18 with CIMObjectPath

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

the class SmisDiscoveryArgsCreator method generateDeviceMaskingGroupObjectPath.

/**
 * Generate DeviceMasking Group CIMObject Path
 *
 * @param serialID
 * @param bourneCreatedDeviceGroup
 * @param keyMap
 * @return
 */
private CIMObjectPath generateDeviceMaskingGroupObjectPath(String serialID, String bourneCreatedDeviceGroup, final Map<String, Object> keyMap) {
    @SuppressWarnings("unchecked") CIMProperty<?> instanceID = new CIMProperty(Constants.INSTANCEID, CIMDataType.STRING_T, Constants.SYMMETRIX_U + Constants.PLUS + serialID + Constants.PLUS + bourneCreatedDeviceGroup, true, false, null);
    CIMProperty<?>[] keys = new CIMProperty<?>[1];
    keys[0] = instanceID;
    CIMObjectPath deviceGroupPath = CimObjectPathCreator.createInstance(Constants.SE_DEVICEMASKINGGROUP, keyMap.get(Constants._InteropNamespace).toString(), keys);
    return deviceGroupPath;
}
Also used : CIMProperty(javax.cim.CIMProperty) CIMObjectPath(javax.cim.CIMObjectPath)

Example 19 with CIMObjectPath

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

the class SmisDiscoveryArgsCreator method getFASTPolicyAssociatedWithDeviceGroup.

/**
 * get FAST policy Object path associated with DeviceGroup
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 */
private final CIMObjectPath getFASTPolicyAssociatedWithDeviceGroup(final Argument argument, final Map<String, Object> keyMap, int index) {
    @SuppressWarnings("unchecked") List<CIMObjectPath> deviceGroups = (List<CIMObjectPath>) keyMap.get(argument.getValue());
    CIMObjectPath deviceGroupPath = deviceGroups.get(index);
    String deviceGroupName = deviceGroupPath.getKey(Constants.INSTANCEID).getValue().toString();
    _logger.debug("Device Group Name associated policy :" + deviceGroupName);
    CIMObjectPath fastPolicyPath = (CIMObjectPath) keyMap.get(deviceGroupName);
    return fastPolicyPath;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) List(java.util.List)

Example 20 with CIMObjectPath

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

the class AllocatedFromStoragePoolProcessor method processInstances.

/**
 * {@inheritDoc}
 */
@Override
protected int processInstances(Iterator<CIMInstance> instances, WBEMClient client) {
    int count = 0;
    while (instances.hasNext()) {
        try {
            count++;
            CIMInstance instance = instances.next();
            CIMObjectPath volPath = (CIMObjectPath) instance.getObjectPath().getKeyValue(DEPENDENT);
            if (_symmvolume.equals(volPath.getObjectName())) {
                String spaceConsumed = getCIMPropertyValue(instance, SPACE_CONSUMED);
                _volumeToSpaceConsumedMap.put(volPath.toString(), spaceConsumed);
            }
        } catch (Exception e) {
            _logger.error("Exception on processing instances", e);
        }
    }
    return count;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

CIMObjectPath (javax.cim.CIMObjectPath)582 CIMInstance (javax.cim.CIMInstance)254 WBEMException (javax.wbem.WBEMException)236 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)208 CIMArgument (javax.cim.CIMArgument)190 ArrayList (java.util.ArrayList)139 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)118 Volume (com.emc.storageos.db.client.model.Volume)108 URI (java.net.URI)108 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)82 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)76 WBEMClient (javax.wbem.client.WBEMClient)75 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)72 HashSet (java.util.HashSet)68 HashMap (java.util.HashMap)63 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)57 CIMProperty (javax.cim.CIMProperty)57 IOException (java.io.IOException)55 BlockObject (com.emc.storageos.db.client.model.BlockObject)52 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)52