Search in sources :

Example 21 with DiscoveredSystemObject

use of com.emc.storageos.db.client.model.DiscoveredSystemObject in project coprhd-controller by CoprHD.

the class MeteringTaskCompleter method setLastTime.

@Override
public final void setLastTime(DbClient dbClient, long time) {
    Class type = getType();
    if (DiscoveredSystemObject.class.isAssignableFrom(type)) {
        try {
            DiscoveredSystemObject dbObject = (DiscoveredSystemObject) DataObject.createInstance(type, getId());
            dbObject.trackChanges();
            dbObject.setLastMeteringRunTime(time);
            dbClient.persistObject(dbObject);
        } catch (InstantiationException ex) {
            DatabaseException.fatals.queryFailed(ex);
        } catch (IllegalAccessException ex) {
            DatabaseException.fatals.queryFailed(ex);
        }
    } else {
        throw new RuntimeException("Unsupported system Type : " + type.toString());
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 22 with DiscoveredSystemObject

use of com.emc.storageos.db.client.model.DiscoveredSystemObject in project coprhd-controller by CoprHD.

the class MeteringTaskCompleter method setNextRunTime.

@Override
public final void setNextRunTime(DbClient dbClient, long time) {
    Class type = getType();
    if (DiscoveredSystemObject.class.isAssignableFrom(type)) {
        try {
            DiscoveredSystemObject dbObject = (DiscoveredSystemObject) DataObject.createInstance(type, getId());
            dbObject.trackChanges();
            dbObject.setNextMeteringRunTime(time);
            dbClient.persistObject(dbObject);
        } catch (InstantiationException ex) {
            DatabaseException.fatals.queryFailed(ex);
        } catch (IllegalAccessException ex) {
            DatabaseException.fatals.queryFailed(ex);
        }
    } else {
        throw new RuntimeException("Unsupported system Type : " + type.toString());
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 23 with DiscoveredSystemObject

use of com.emc.storageos.db.client.model.DiscoveredSystemObject in project coprhd-controller by CoprHD.

the class ExportWorkflowEntryPoints method exportGroupDelete.

public void exportGroupDelete(URI storageURI, URI exportGroupURI, String token) throws ControllerException {
    try {
        WorkflowStepCompleter.stepExecuting(token);
        final String workflowKey = "exportGroupDelete";
        if (!WorkflowService.getInstance().hasWorkflowBeenCreated(token, workflowKey)) {
            DiscoveredSystemObject storage = ExportWorkflowUtils.getStorageSystem(_dbClient, storageURI);
            MaskingOrchestrator orchestrator = getOrchestrator(storage.getSystemType());
            orchestrator.exportGroupDelete(storageURI, exportGroupURI, token);
            // Mark this workflow as created/executed so we don't do it again on retry/resume
            WorkflowService.getInstance().markWorkflowBeenCreated(token, workflowKey);
        }
    } catch (Exception e) {
        DeviceControllerException exception = DeviceControllerException.exceptions.exportGroupDeleteFailed(e);
        WorkflowStepCompleter.stepFailed(token, exception);
        throw exception;
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 24 with DiscoveredSystemObject

use of com.emc.storageos.db.client.model.DiscoveredSystemObject in project coprhd-controller by CoprHD.

the class ExportWorkflowEntryPoints method exportGroupCreate.

// ====================== Methods to call Masking Orchestrator
// ======================
public void exportGroupCreate(URI storageURI, URI exportGroupURI, Map<URI, Integer> volumeMap, List<URI> initiatorURIs, String token) throws ControllerException {
    try {
        WorkflowStepCompleter.stepExecuting(token);
        // Check to see if we are re-entering this step after a previous execution already created the export
        // workflow.
        // If this is the case, do not create it again.
        final String workflowKey = "exportGroupCreate";
        if (!WorkflowService.getInstance().hasWorkflowBeenCreated(token, workflowKey)) {
            DiscoveredSystemObject storage = ExportWorkflowUtils.getStorageSystem(_dbClient, storageURI);
            MaskingOrchestrator orchestrator = getOrchestrator(storage.getSystemType());
            orchestrator.exportGroupCreate(storageURI, exportGroupURI, initiatorURIs, volumeMap, token);
            // Mark this workflow as created/executed so we don't do it again on retry/resume
            WorkflowService.getInstance().markWorkflowBeenCreated(token, workflowKey);
        }
    } catch (Exception e) {
        DeviceControllerException exception = DeviceControllerException.exceptions.exportGroupCreateFailed(e);
        WorkflowStepCompleter.stepFailed(token, exception);
        throw exception;
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 25 with DiscoveredSystemObject

use of com.emc.storageos.db.client.model.DiscoveredSystemObject in project coprhd-controller by CoprHD.

the class ExportWorkflowEntryPoints method changeAutoTieringPolicy.

public void changeAutoTieringPolicy(URI storageURI, List<URI> volumeURIs, URI newVpoolURI, boolean rollback, String token) throws ControllerException {
    try {
        WorkflowStepCompleter.stepExecuting(token);
        DiscoveredSystemObject storage = ExportWorkflowUtils.getStorageSystem(_dbClient, storageURI);
        MaskingOrchestrator orchestrator = getOrchestrator(storage.getSystemType());
        ((AbstractBasicMaskingOrchestrator) orchestrator).changeAutoTieringPolicy(storageURI, volumeURIs, newVpoolURI, rollback, token);
    } catch (Exception e) {
        DeviceControllerException exception = DeviceControllerException.exceptions.changeAutoTieringPolicy(e);
        WorkflowStepCompleter.stepFailed(token, exception);
        throw exception;
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Aggregations

DiscoveredSystemObject (com.emc.storageos.db.client.model.DiscoveredSystemObject)43 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)15 ControllerException (com.emc.storageos.volumecontroller.ControllerException)14 WorkflowException (com.emc.storageos.workflow.WorkflowException)14 Workflow (com.emc.storageos.workflow.Workflow)13 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)4 URI (java.net.URI)3 Controller (com.emc.storageos.Controller)2 BlockObject (com.emc.storageos.db.client.model.BlockObject)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CompatibilityException (com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException)1 StoragePortGroup (com.emc.storageos.db.client.model.StoragePortGroup)1 RetryableDatabaseException (com.emc.storageos.db.exceptions.RetryableDatabaseException)1 AbstractDiscoveredSystemController (com.emc.storageos.impl.AbstractDiscoveredSystemController)1 ProtectionExportController (com.emc.storageos.protectioncontroller.ProtectionExportController)1 RPController (com.emc.storageos.protectioncontroller.RPController)1 RPDeviceController (com.emc.storageos.protectioncontroller.impl.recoverpoint.RPDeviceController)1 WorkflowRestartedException (com.emc.storageos.workflow.WorkflowRestartedException)1 IOException (java.io.IOException)1