Search in sources :

Example 1 with VNXeCommandResult

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

the class VNXeStorageDevice method doCreateConsistencyGroup.

@Override
public void doCreateConsistencyGroup(StorageSystem storage, URI consistencyGroup, String replicationGroupName, TaskCompleter taskCompleter) throws DeviceControllerException {
    _logger.info("creating consistency group, array: {}", storage.getSerialNumber());
    BlockConsistencyGroup consistencyGroupObj = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
    VNXeApiClient apiClient = getVnxeClient(storage);
    String tenantName = "";
    try {
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, consistencyGroupObj.getTenant().getURI());
        tenantName = tenant.getLabel();
    } catch (DatabaseException e) {
        _logger.error("Error lookup TenantOrb object", e);
    }
    String label = nameGenerator.generate(tenantName, consistencyGroupObj.getLabel(), consistencyGroupObj.getId().toString(), '-', VNXeConstants.MAX_NAME_LENGTH);
    try {
        VNXeCommandResult result = apiClient.createLunGroup(label);
        if (result.getStorageResource() != null) {
            consistencyGroupObj.addSystemConsistencyGroup(storage.getId().toString(), result.getStorageResource().getId());
            consistencyGroupObj.addConsistencyGroupTypes(Types.LOCAL.name());
            if (NullColumnValueGetter.isNullURI(consistencyGroupObj.getStorageController())) {
                consistencyGroupObj.setStorageController(storage.getId());
            }
            _dbClient.persistObject(consistencyGroupObj);
            taskCompleter.ready(_dbClient);
        } else {
            _logger.error("No storage resource Id returned");
            consistencyGroupObj.setInactive(true);
            _dbClient.persistObject(consistencyGroupObj);
            ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateConsistencyGroup failed");
            taskCompleter.error(_dbClient, error);
        }
    } catch (Exception e) {
        _logger.error("Exception caught when createing consistency group ", e);
        consistencyGroupObj.setInactive(true);
        _dbClient.persistObject(consistencyGroupObj);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateConsistencyGroup", e.getMessage());
        taskCompleter.error(_dbClient, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Example 2 with VNXeCommandResult

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

the class HostIpPortRequestsTest method createHostIpPortTest.

@Test
public void createHostIpPortTest() {
    HostIpPortRequests req = new HostIpPortRequests(_client);
    HostIpPortCreateParam parm = new HostIpPortCreateParam();
    parm.setAddress("10.247.87.208");
    VNXeBase host = new VNXeBase();
    host.setId("Host_1");
    parm.setHost(host);
    VNXeCommandResult result = req.createHostIpPort(parm);
    String id = result.getId();
    System.out.println(id);
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult) HostIpPortCreateParam(com.emc.storageos.vnxe.models.HostIpPortCreateParam) Test(org.junit.Test)

Example 3 with VNXeCommandResult

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

the class VNXeApiClient method deleteInitiators.

/**
 * Delete initiators by moving initiators to a dummy host, then delete the dummy host
 *
 * This should be used if there is mapped resource on the host that the initiators are registered to.
 * It can also be used in case of no mapped resource.
 *
 * @param initiatorIds initiator Ids (IQN or WWN)
 * @return VNXeCommandResult
 */
public VNXeCommandResult deleteInitiators(List<String> initiatorIds) throws VNXeException {
    _logger.info("deleting initiators: " + Joiner.on(',').join(initiatorIds));
    // create a dummy host
    HostListRequest hostListReq = new HostListRequest(_khClient);
    HostCreateParam hostCreateParm = new HostCreateParam();
    hostCreateParm.setName(VIPR_TMP_HOST_PREFIX + initiatorIds.get(0));
    hostCreateParm.setType(HostTypeEnum.HOSTMANUAL.getValue());
    VNXeCommandResult result = hostListReq.createHost(hostCreateParm);
    String dummyHostId = result.getId();
    // get initiators
    for (String initiatorId : initiatorIds) {
        VNXeHostInitiator initiator = getInitiatorByWWN(initiatorId);
        if (initiator == null) {
            _logger.info("Could not find initiator: {}", initiatorId);
        } else {
            // move the initiator to the dummy host
            setInitiatorHost(initiator.getId(), dummyHostId);
        }
    }
    // delete the dummy host
    return deleteHost(dummyHostId);
}
Also used : HostListRequest(com.emc.storageos.vnxe.requests.HostListRequest) HostCreateParam(com.emc.storageos.vnxe.models.HostCreateParam) VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult) VNXeHostInitiator(com.emc.storageos.vnxe.models.VNXeHostInitiator)

Example 4 with VNXeCommandResult

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

the class CifsShareRequests method deleteShareForSnapshotSync.

/**
 * Delete CIFS share sync
 *
 * @param shareId
 *            cifsShare id
 * @return VNXeCommandResult
 */
public VNXeCommandResult deleteShareForSnapshotSync(String shareId) {
    VNXeCommandResult result = new VNXeCommandResult();
    _url = URL_SHARE + shareId;
    if (getShare(shareId) != null) {
        unsetQueryParameters();
        deleteRequest(null);
        result.setSuccess(true);
        return result;
    } else {
        throw VNXeException.exceptions.vnxeCommandFailed("The shareId is not found: " + shareId);
    }
}
Also used : VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

Example 5 with VNXeCommandResult

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

the class FileSystemSnapRequests method deleteFileSystemSnapSync.

public VNXeCommandResult deleteFileSystemSnapSync(String snapId, String softwareVersion) throws VNXeException {
    if (!VNXeUtils.isHigherVersion(softwareVersion, VNXeConstants.VNXE_BASE_SOFT_VER)) {
        _url = URL_INSTANCE + snapId;
    } else {
        _url = URL_INSTANCE_V31 + snapId;
    }
    VNXeCommandResult result = new VNXeCommandResult();
    setQueryParameters(null);
    if (getDataForOneObject(VNXeFileSystemSnap.class) != null) {
        unsetQueryParameters();
        deleteRequest(null);
        result.setSuccess(true);
        return result;
    } else {
        throw VNXeException.exceptions.vnxeCommandFailed(String.format("No filesystem snap %s found", snapId));
    }
}
Also used : VNXeFileSystemSnap(com.emc.storageos.vnxe.models.VNXeFileSystemSnap) VNXeCommandResult(com.emc.storageos.vnxe.models.VNXeCommandResult)

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