Search in sources :

Example 6 with VNXeCommandResult

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

the class SnapRequests method deleteSnap.

/**
 * Delete lun snap
 *
 * @param snapId
 * @return
 * @throws VNXeException
 */
public VNXeCommandResult deleteSnap(String snapId) throws VNXeException {
    _url = URL_INSTANCE + snapId;
    setQueryParameters(null);
    deleteRequest(null);
    VNXeCommandResult result = new VNXeCommandResult();
    result.setSuccess(true);
    return result;
}
Also used : VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

Example 7 with VNXeCommandResult

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

the class ApiClientTest method createConsistencyGroup.

// @Test
public void createConsistencyGroup() {
    VNXeCommandResult result = apiClient.createConsistencyGroup("testGroup1");
    System.out.println(result.getStorageResource().getId());
}
Also used : VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

Example 8 with VNXeCommandResult

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

the class ApiClientTest method createLunGroup.

// @Test
public void createLunGroup() {
    VNXeCommandResult result = apiClient.createLunGroup("testGroup1");
    System.out.println(result.getStorageResource().getId());
}
Also used : VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

Example 9 with VNXeCommandResult

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

the class DeleteStorageResourceRequestTest method deleteFileSystem.

// @Test
public void deleteFileSystem() {
    DeleteStorageResourceRequest req = new DeleteStorageResourceRequest(_client);
    VNXeCommandResult response = null;
    response = req.deleteFileSystemSync("fs_25", true);
    System.out.println(response.getSuccess());
}
Also used : VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

Example 10 with VNXeCommandResult

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

the class VNXeApiClient method prepareHostsForExport.

/**
 * given host name and initiators, find/create hosts/initiators in the
 *
 * @param hostInitiators
 * @return
 */
public VNXeBase prepareHostsForExport(Collection<VNXeHostInitiator> hostInitiators) throws VNXeException {
    String hostId = null;
    Set<VNXeHostInitiator> notExistingInits = new HashSet<VNXeHostInitiator>();
    Set<VNXeHostInitiator> existingNoHostInits = new HashSet<VNXeHostInitiator>();
    String hostOsType = null;
    String hostName = null;
    for (VNXeHostInitiator init : hostInitiators) {
        VNXeHostInitiator existingInit = getInitiatorByWWN(init.getInitiatorId());
        if (existingInit != null && existingInit.getParentHost() != null) {
            if (hostId == null) {
                hostId = existingInit.getParentHost().getId();
            } else if (!hostId.equals(existingInit.getParentHost().getId())) {
                _logger.error("Initiators belong to different hosts");
                throw VNXeException.exceptions.vnxeCommandFailed("Initiators belong to different hosts");
            }
        } else if (existingInit != null) {
            existingNoHostInits.add(existingInit);
        } else {
            notExistingInits.add(init);
        }
        if (hostOsType == null) {
            hostOsType = init.getHostOsType();
        }
        if (hostName == null) {
            hostName = init.getName();
        }
    }
    if (hostId == null) {
        // create host and hostInitiator
        HostListRequest hostReq = new HostListRequest(_khClient);
        HostCreateParam hostCreateParm = new HostCreateParam();
        hostCreateParm.setName(hostName);
        hostCreateParm.setType(HostTypeEnum.HOSTMANUAL.getValue());
        if (isUnityClient() && hostOsType != null) {
            hostCreateParm.setOsType(hostOsType);
        }
        VNXeCommandResult result = hostReq.createHost(hostCreateParm);
        hostId = result.getId();
    }
    for (VNXeHostInitiator newInit : notExistingInits) {
        HostInitiatorCreateParam initCreateParam = new HostInitiatorCreateParam();
        VNXeBase host = new VNXeBase(hostId);
        initCreateParam.setHost(host);
        if (newInit.getType() == HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI) {
            initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI.getValue());
            initCreateParam.setInitiatorWWNorIqn(newInit.getChapUserName());
            initCreateParam.setChapUser(newInit.getChapUserName());
        } else {
            initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_FC.getValue());
            initCreateParam.setInitiatorWWNorIqn(newInit.getInitiatorId());
        }
        HostInitiatorRequest req = new HostInitiatorRequest(_khClient);
        try {
            req.createHostInitiator(initCreateParam);
        } catch (VNXeException e) {
            // For ESX hosts, even if we could not get the initiators when we query them, when we try to create the host
            // initiator with the created host, it would throw error, saying the initiator exists. ignore the error.
            String message = e.getMessage();
            if (message != null && message.contains(VNXeConstants.INITIATOR_EXISITNG)) {
                _logger.info("The initiator exists. Ignore the error.");
            } else {
                throw e;
            }
        }
    }
    for (VNXeHostInitiator exitInit : existingNoHostInits) {
        setInitiatorHost(exitInit.getId(), hostId);
    }
    return new VNXeBase(hostId);
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) HostListRequest(com.emc.storageos.vnxe.requests.HostListRequest) HostCreateParam(com.emc.storageos.vnxe.models.HostCreateParam) VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult) HostInitiatorCreateParam(com.emc.storageos.vnxe.models.HostInitiatorCreateParam) DeleteHostInitiatorRequest(com.emc.storageos.vnxe.requests.DeleteHostInitiatorRequest) HostInitiatorRequest(com.emc.storageos.vnxe.requests.HostInitiatorRequest) VNXeHostInitiator(com.emc.storageos.vnxe.models.VNXeHostInitiator) HashSet(java.util.HashSet)

Aggregations

VNXeCommandResult (com.emc.storageos.vnxe.models.VNXeCommandResult)23 HostCreateParam (com.emc.storageos.vnxe.models.HostCreateParam)4 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)3 HostListRequest (com.emc.storageos.vnxe.requests.HostListRequest)3 Test (org.junit.Test)3 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)2 VNXeException (com.emc.storageos.vnxe.VNXeException)2 HostIpPortCreateParam (com.emc.storageos.vnxe.models.HostIpPortCreateParam)2 VNXeHostInitiator (com.emc.storageos.vnxe.models.VNXeHostInitiator)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 ArrayList (java.util.ArrayList)2 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)1 DeleteStorageResourceParam (com.emc.storageos.vnxe.models.DeleteStorageResourceParam)1 FileSystemQuotaConfigParam (com.emc.storageos.vnxe.models.FileSystemQuotaConfigParam)1 FileSystemQuotaCreateParam (com.emc.storageos.vnxe.models.FileSystemQuotaCreateParam)1 HostInitiatorCreateParam (com.emc.storageos.vnxe.models.HostInitiatorCreateParam)1