Search in sources :

Example 1 with MigrationOperationTaskCompleter

use of com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter in project coprhd-controller by CoprHD.

the class VPlexDeviceController method pauseMigration.

@Override
public void pauseMigration(URI vplexURI, URI migrationURI, String opId) {
    MigrationOperationTaskCompleter completer = null;
    try {
        // Generate the Workflow.
        Workflow workflow = _workflowService.getNewWorkflow(this, PAUSE_MIGRATION_WF_NAME, false, opId);
        _log.info("Created pause migration workflow with operation id {}", opId);
        StorageSystem vplex = getDataObject(StorageSystem.class, vplexURI, _dbClient);
        Migration migration = getDataObject(Migration.class, migrationURI, _dbClient);
        URI volId = migration.getVolume();
        completer = new MigrationOperationTaskCompleter(volId, opId);
        Workflow.Method pauseMigrationMethod = new Workflow.Method(PAUSE_MIGRATION_METHOD_NAME, vplexURI, migrationURI);
        workflow.createStep(PAUSE_MIGRATION_STEP, "Pause migration", null, vplexURI, vplex.getSystemType(), getClass(), pauseMigrationMethod, rollbackMethodNullMethod(), null);
        String successMsg = String.format("Migration %s paused successfully", migrationURI);
        workflow.executePlan(completer, successMsg);
        _log.info("Workflow plan executing");
    } catch (Exception e) {
        String failMsg = String.format("Pause the migration %s failed", migrationURI);
        _log.error(failMsg, e);
        String opName = ResourceOperationTypeEnum.PAUSE_MIGRATION.getName();
        ServiceError serviceError = VPlexApiException.errors.operateMigrationFailed(opName, e);
        failStep(completer, opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MigrationOperationTaskCompleter(com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter) Migration(com.emc.storageos.db.client.model.Migration) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with MigrationOperationTaskCompleter

use of com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter in project coprhd-controller by CoprHD.

the class VPlexDeviceController method cancelMigration.

@Override
public void cancelMigration(URI vplexURI, URI migrationURI, String opId) {
    MigrationOperationTaskCompleter completer = null;
    try {
        // Generate the Workflow.
        Workflow workflow = _workflowService.getNewWorkflow(this, CANCEL_MIGRATION_WF_NAME, false, opId);
        _log.info("Created cancel migration workflow with operation id {}", opId);
        StorageSystem vplex = getDataObject(StorageSystem.class, vplexURI, _dbClient);
        Migration migration = getDataObject(Migration.class, migrationURI, _dbClient);
        URI volId = migration.getVolume();
        completer = new MigrationOperationTaskCompleter(volId, opId);
        Workflow.Method cancelMigrationMethod = new Workflow.Method(CANCEL_MIGRATION_METHOD_NAME, vplexURI, migrationURI);
        workflow.createStep(CANCEL_MIGRATION_STEP, "Cancel migration", null, vplexURI, vplex.getSystemType(), getClass(), cancelMigrationMethod, rollbackMethodNullMethod(), null);
        String successMsg = String.format("Migration %s cancelled successfully", migrationURI);
        workflow.executePlan(completer, successMsg);
        _log.info("Workflow plan executing");
    } catch (Exception e) {
        String failMsg = String.format("Pause the migration %s failed", migrationURI);
        _log.error(failMsg, e);
        String opName = ResourceOperationTypeEnum.CANCEL_MIGRATION.getName();
        ServiceError serviceError = VPlexApiException.errors.operateMigrationFailed(opName, e);
        failStep(completer, opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MigrationOperationTaskCompleter(com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter) Migration(com.emc.storageos.db.client.model.Migration) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 3 with MigrationOperationTaskCompleter

use of com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter in project coprhd-controller by CoprHD.

the class VPlexDeviceController method deleteMigration.

@Override
public void deleteMigration(URI vplexURI, URI migrationURI, String opId) {
    MigrationOperationTaskCompleter completer = null;
    try {
        // Generate the Workflow.
        Workflow workflow = _workflowService.getNewWorkflow(this, DELETE_MIGRATION_WF_NAME, false, opId);
        _log.info("Created delete migration workflow with operation id {}", opId);
        StorageSystem vplex = getDataObject(StorageSystem.class, vplexURI, _dbClient);
        Migration migration = getDataObject(Migration.class, migrationURI, _dbClient);
        URI volId = migration.getVolume();
        completer = new MigrationOperationTaskCompleter(volId, opId);
        Workflow.Method deleteMigrationMethod = new Workflow.Method(DELETE_MIGRATION_METHOD_NAME, vplexURI, migrationURI);
        workflow.createStep(DELETE_MIGRATION_STEP, "Delete migration", null, vplexURI, vplex.getSystemType(), getClass(), deleteMigrationMethod, rollbackMethodNullMethod(), null);
        String successMsg = String.format("Migration %s deleted successfully", migrationURI);
        workflow.executePlan(completer, successMsg);
        _log.info("Workflow plan executing");
    } catch (Exception e) {
        String failMsg = String.format("Pause the migration %s failed", migrationURI);
        _log.error(failMsg, e);
        String opName = ResourceOperationTypeEnum.DELETE_MIGRATION.getName();
        ServiceError serviceError = VPlexApiException.errors.operateMigrationFailed(opName, e);
        failStep(completer, opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MigrationOperationTaskCompleter(com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter) Migration(com.emc.storageos.db.client.model.Migration) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 4 with MigrationOperationTaskCompleter

use of com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter in project coprhd-controller by CoprHD.

the class VPlexDeviceController method resumeMigration.

@Override
public void resumeMigration(URI vplexURI, URI migrationURI, String opId) {
    MigrationOperationTaskCompleter completer = null;
    try {
        // Generate the Workflow.
        Workflow workflow = _workflowService.getNewWorkflow(this, RESUME_MIGRATION_WF_NAME, false, opId);
        _log.info("Created resume migration workflow with operation id {}", opId);
        StorageSystem vplex = getDataObject(StorageSystem.class, vplexURI, _dbClient);
        Migration migration = getDataObject(Migration.class, migrationURI, _dbClient);
        URI volId = migration.getVolume();
        completer = new MigrationOperationTaskCompleter(volId, opId);
        Workflow.Method resumeMigrationMethod = new Workflow.Method(RESUME_MIGRATION_METHOD_NAME, vplexURI, migrationURI);
        workflow.createStep(RESUME_MIGRATION_STEP, "Resume migration", null, vplexURI, vplex.getSystemType(), getClass(), resumeMigrationMethod, rollbackMethodNullMethod(), null);
        String successMsg = String.format("Migration %s resumed successfully", migrationURI);
        workflow.executePlan(completer, successMsg);
        _log.info("Workflow plan executing");
    } catch (Exception e) {
        String failMsg = String.format("Pause the migration %s failed", migrationURI);
        _log.error(failMsg, e);
        String opName = ResourceOperationTypeEnum.RESUME_MIGRATION.getName();
        ServiceError serviceError = VPlexApiException.errors.operateMigrationFailed(opName, e);
        failStep(completer, opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MigrationOperationTaskCompleter(com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter) Migration(com.emc.storageos.db.client.model.Migration) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

Migration (com.emc.storageos.db.client.model.Migration)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)4 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)4 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)4 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)4 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)4 ControllerException (com.emc.storageos.volumecontroller.ControllerException)4 VPlexApiException (com.emc.storageos.vplex.api.VPlexApiException)4 MigrationOperationTaskCompleter (com.emc.storageos.vplexcontroller.completers.MigrationOperationTaskCompleter)4 Workflow (com.emc.storageos.workflow.Workflow)4 WorkflowException (com.emc.storageos.workflow.WorkflowException)4 IOException (java.io.IOException)4 URI (java.net.URI)4 URISyntaxException (java.net.URISyntaxException)4