Search in sources :

Example 21 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXeApiClient method setInitiatorHost.

/**
 * Modify initiator's parent host
 *
 * @param initiatorId initiator Id
 * @param hostId host Id
 */
public void setInitiatorHost(String initiatorId, String hostId) {
    HostInitiatorModifyParam initModifyParam = new HostInitiatorModifyParam();
    VNXeBase host = new VNXeBase(hostId);
    initModifyParam.setHost(host);
    HostInitiatorRequest req = new HostInitiatorRequest(_khClient);
    req.modifyHostInitiator(initModifyParam, initiatorId);
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) HostInitiatorModifyParam(com.emc.storageos.vnxe.models.HostInitiatorModifyParam) DeleteHostInitiatorRequest(com.emc.storageos.vnxe.requests.DeleteHostInitiatorRequest) HostInitiatorRequest(com.emc.storageos.vnxe.requests.HostInitiatorRequest)

Example 22 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXeApiClient method modifyHostLunHlu.

/**
 * Modify host lun HLU
 *
 * @param hostId Host Id
 * @param hostLunId HostLun Id
 * @param hlu The new hlu value
 */
public void modifyHostLunHlu(String hostId, String hostLunId, int hlu) {
    HostRequest req = new HostRequest(_khClient, hostId);
    ModifyHostLUNsParam param = new ModifyHostLUNsParam();
    HostLunModifyParam hostLunParam = new HostLunModifyParam();
    hostLunParam.setHlu(hlu);
    VNXeBase hostLun = new VNXeBase(hostLunId);
    hostLunParam.setHostLun(hostLun);
    List<HostLunModifyParam> parmList = new ArrayList<HostLunModifyParam>();
    parmList.add(hostLunParam);
    param.setHostLunModifyList(parmList);
    req.modifyHostLun(param);
}
Also used : HostLunModifyParam(com.emc.storageos.vnxe.models.HostLunModifyParam) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) ArrayList(java.util.ArrayList) ModifyHostLUNsParam(com.emc.storageos.vnxe.models.ModifyHostLUNsParam) HostRequest(com.emc.storageos.vnxe.requests.HostRequest) DeleteHostRequest(com.emc.storageos.vnxe.requests.DeleteHostRequest)

Example 23 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXeApiClient method exportLun.

/**
 * Export a lun for a given host
 *
 * @param host
 *            host
 * @param lunId
 *            lun id
 * @param newhlu
 *            HLU
 * @return
 * @throws VNXeException
 */
public VNXeExportResult exportLun(VNXeBase host, String lunId, Integer newhlu) throws VNXeException {
    _logger.info("Exporting lun: {}", lunId);
    VNXeLun lun = getLun(lunId);
    if (lun == null) {
        _logger.info("Could not find lun in the vxne: {}", lunId);
        throw VNXeException.exceptions.vnxeCommandFailed("Could not find lun : " + lunId);
    }
    List<BlockHostAccess> hostAccesses = lun.getHostAccess();
    boolean lunHostAccessExists = false;
    if (hostAccesses == null) {
        hostAccesses = new ArrayList<BlockHostAccess>();
    } else {
        // already defined for the given host with a different access mask.
        for (BlockHostAccess hostAccess : hostAccesses) {
            String hostId = hostAccess.getHost().getId();
            if (hostId.equals(host.getId())) {
                if (hostAccess.getAccessMask() == HostLUNAccessEnum.SNAPSHOT.getValue()) {
                    hostAccess.setAccessMask(HostLUNAccessEnum.BOTH.getValue());
                    lunHostAccessExists = true;
                    break;
                } else if (hostAccess.getAccessMask() == HostLUNAccessEnum.NOACCESS.getValue()) {
                    hostAccess.setAccessMask(HostLUNAccessEnum.PRODUCTION.getValue());
                    lunHostAccessExists = true;
                    break;
                }
            }
        }
    }
    if (!lunHostAccessExists) {
        BlockHostAccess access = new BlockHostAccess();
        access.setHost(host);
        access.setAccessMask(BlockHostAccess.HostLUNAccessEnum.PRODUCTION.getValue());
        hostAccesses.add(access);
    }
    LunParam lunParam = new LunParam();
    lunParam.setHostAccess(hostAccesses);
    LunModifyParam exportParam = new LunModifyParam();
    exportParam.setLunParameters(lunParam);
    int type = lun.getType();
    if (type == VNXeLun.LUNTypeEnum.Standalone.getValue()) {
        // if standalone lun
        BlockLunRequests lunReq = new BlockLunRequests(_khClient);
        lunReq.modifyLunSync(exportParam, lun.getStorageResource().getId());
    } else {
        // lun in a lun group
        exportParam.setLun(new VNXeBase(lunId));
        List<LunModifyParam> list = new ArrayList<LunModifyParam>();
        list.add(exportParam);
        LunGroupModifyParam groupParam = new LunGroupModifyParam();
        groupParam.setLunModify(list);
        if (!_khClient.isUnity()) {
            LunGroupRequests lunGroupReq = new LunGroupRequests(_khClient);
            lunGroupReq.modifyLunGroupSync(lun.getStorageResource().getId(), groupParam);
        } else {
            ConsistencyGroupRequests cgReq = new ConsistencyGroupRequests(_khClient);
            cgReq.modifyConsistencyGroupSync(lun.getStorageResource().getId(), groupParam);
        }
    }
    // get hlu
    HostLunRequests hostLunReq = new HostLunRequests(_khClient);
    HostLun hostLun = hostLunReq.getHostLun(lunId, host.getId(), HostLunRequests.ID_SEQUENCE_LUN);
    int hluResult = hostLun.getHlu();
    if (isUnityClient() && newhlu != null && newhlu.intValue() != -1) {
        _logger.info("Modify hlu");
        modifyHostLunHlu(host.getId(), hostLun.getId(), newhlu);
        hluResult = newhlu;
    }
    VNXeExportResult result = new VNXeExportResult();
    result.setHlu(hluResult);
    result.setLunId(lunId);
    result.setHostId(host.getId());
    result.setNewAccess(!lunHostAccessExists);
    _logger.info("Done exporting lun: {}", lunId);
    return result;
}
Also used : HostLunRequests(com.emc.storageos.vnxe.requests.HostLunRequests) ArrayList(java.util.ArrayList) LunGroupModifyParam(com.emc.storageos.vnxe.models.LunGroupModifyParam) HostLun(com.emc.storageos.vnxe.models.HostLun) ConsistencyGroupRequests(com.emc.storageos.vnxe.requests.ConsistencyGroupRequests) VNXeExportResult(com.emc.storageos.vnxe.models.VNXeExportResult) BlockHostAccess(com.emc.storageos.vnxe.models.BlockHostAccess) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) LunParam(com.emc.storageos.vnxe.models.LunParam) BlockLunRequests(com.emc.storageos.vnxe.requests.BlockLunRequests) LunGroupRequests(com.emc.storageos.vnxe.requests.LunGroupRequests) VNXeLun(com.emc.storageos.vnxe.models.VNXeLun) HostLunModifyParam(com.emc.storageos.vnxe.models.HostLunModifyParam) LunModifyParam(com.emc.storageos.vnxe.models.LunModifyParam)

Example 24 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXeApiClient method createFileSystemSnap.

/**
 * Create file system snapshot
 *
 * @param fsId
 *            file system id
 * @param name
 *            snapshot name
 * @return VNXeCommandJob
 */
public VNXeCommandJob createFileSystemSnap(String fsId, String name) {
    _logger.info("creating file system snap:" + fsId);
    String resourceId = getStorageResourceId(fsId);
    FileSystemSnapCreateParam parm = new FileSystemSnapCreateParam();
    VNXeBase resource = new VNXeBase();
    resource.setId(resourceId);
    parm.setStorageResource(resource);
    parm.setName(name);
    parm.setIsReadOnly(false);
    parm.setIsAutoDelete(false);
    FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, getBasicSystemInfo().getSoftwareVersion());
    return req.createFileSystemSnap(parm);
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) FileSystemSnapRequests(com.emc.storageos.vnxe.requests.FileSystemSnapRequests) FileSystemSnapCreateParam(com.emc.storageos.vnxe.models.FileSystemSnapCreateParam)

Example 25 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXeApiClient method createLunsInLunGroup.

/**
 * Create multiple volumes in a lun group
 *
 * @param names
 * @param poolId
 * @param size
 * @param isThin
 * @param tieringPolicy
 * @param lunGroupId
 * @return
 */
public VNXeCommandJob createLunsInLunGroup(List<String> names, String poolId, Long size, boolean isThin, String tieringPolicy, String lunGroupId) {
    _logger.info("creating luns in the lun group: {}", lunGroupId);
    LunGroupModifyParam param = new LunGroupModifyParam();
    List<LunCreateParam> lunCreates = new ArrayList<LunCreateParam>();
    boolean isPolicyOn = false;
    FastVPParam fastVP = new FastVPParam();
    if (tieringPolicy != null && !tieringPolicy.isEmpty()) {
        TieringPolicyEnum tierValue = TieringPolicyEnum.valueOf(tieringPolicy);
        if (tierValue != null) {
            fastVP.setTieringPolicy(tierValue.getValue());
            isPolicyOn = true;
        }
    }
    for (String lunName : names) {
        LunParam lunParam = new LunParam();
        lunParam.setIsThinEnabled(isThin);
        lunParam.setSize(size);
        lunParam.setPool(new VNXeBase(poolId));
        LunCreateParam createParam = new LunCreateParam();
        createParam.setName(lunName);
        createParam.setLunParameters(lunParam);
        if (isPolicyOn) {
            lunParam.setFastVPParameters(fastVP);
        }
        lunCreates.add(createParam);
    }
    param.setLunCreate(lunCreates);
    LunGroupRequests req = new LunGroupRequests(_khClient);
    return req.modifyLunGroupAsync(lunGroupId, param);
}
Also used : TieringPolicyEnum(com.emc.storageos.vnxe.models.StorageResource.TieringPolicyEnum) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) FastVPParam(com.emc.storageos.vnxe.models.FastVPParam) LunParam(com.emc.storageos.vnxe.models.LunParam) LunGroupRequests(com.emc.storageos.vnxe.requests.LunGroupRequests) LunGroupModifyParam(com.emc.storageos.vnxe.models.LunGroupModifyParam) ArrayList(java.util.ArrayList) LunCreateParam(com.emc.storageos.vnxe.models.LunCreateParam)

Aggregations

VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)71 ArrayList (java.util.ArrayList)39 URI (java.net.URI)17 HashMap (java.util.HashMap)14 LunGroupModifyParam (com.emc.storageos.vnxe.models.LunGroupModifyParam)13 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)12 VNXeHostInitiator (com.emc.storageos.vnxe.models.VNXeHostInitiator)11 HashSet (java.util.HashSet)11 List (java.util.List)11 StoragePort (com.emc.storageos.db.client.model.StoragePort)9 VNXeException (com.emc.storageos.vnxe.VNXeException)9 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)9 ConsistencyGroupRequests (com.emc.storageos.vnxe.requests.ConsistencyGroupRequests)9 LunGroupRequests (com.emc.storageos.vnxe.requests.LunGroupRequests)9 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)8 BlockHostAccess (com.emc.storageos.vnxe.models.BlockHostAccess)8 LunParam (com.emc.storageos.vnxe.models.LunParam)8 ModifyFileSystemParam (com.emc.storageos.vnxe.models.ModifyFileSystemParam)8 Initiator (com.emc.storageos.db.client.model.Initiator)7 VNXeHost (com.emc.storageos.vnxe.models.VNXeHost)7