Search in sources :

Example 1 with SmisBlockCreateMirrorJob

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

the class AbstractMirrorOperations method createSingleVolumeMirror.

@Override
public void createSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("createSingleVolumeMirror operation START");
    try {
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        StoragePool targetPool = _dbClient.queryObject(StoragePool.class, mirrorObj.getPool());
        Volume source = _dbClient.queryObject(Volume.class, mirrorObj.getSource());
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, source.getTenant().getURI());
        String tenantName = tenant.getLabel();
        String targetLabelToUse = _nameGenerator.generate(tenantName, mirrorObj.getLabel(), mirror.toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = null;
        if (storage.checkIfVmax3()) {
            CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, source, targetPool);
            CIMInstance replicaSettingData = getDefaultReplicationSettingData(storage);
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse, volumeGroupPath, replicaSettingData);
        } else {
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateMirrorJob(job, storage.getId(), !createInactive, taskCompleter)));
            // Resynchronizing state applies to the initial copy as well as future
            // re-synchronization's.
            mirrorObj.setSyncState(SynchronizationState.RESYNCHRONIZING.toString());
            _dbClient.persistObject(mirrorObj);
        }
    } catch (final InternalException e) {
        _log.info("Problem making SMI-S call: ", e);
        taskCompleter.error(_dbClient, e);
    } catch (Exception e) {
        _log.info("Problem making SMI-S call: ", e);
        ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) SmisBlockCreateMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateMirrorJob) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMArgument(javax.cim.CIMArgument)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)1 Volume (com.emc.storageos.db.client.model.Volume)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisBlockCreateMirrorJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateMirrorJob)1 CIMArgument (javax.cim.CIMArgument)1 CIMInstance (javax.cim.CIMInstance)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1