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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations