Search in sources :

Example 31 with DiscoveredSystemObject

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

the class ExportWorkflowUtils method generateExportGroupRemoveVolumes.

public String generateExportGroupRemoveVolumes(Workflow workflow, String wfGroupId, String waitFor, URI storage, URI export, List<URI> volumes) throws WorkflowException {
    DiscoveredSystemObject storageSystem = getStorageSystem(_dbClient, storage);
    Workflow.Method method = ExportWorkflowEntryPoints.exportRemoveVolumesMethod(storage, export, volumes);
    return newWorkflowStep(workflow, wfGroupId, String.format("Removing volumes from export (%s) on storage array %s", export, storageSystem.getNativeGuid()), storageSystem, method, null, waitFor, null);
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 32 with DiscoveredSystemObject

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

the class ExportWorkflowUtils method generateExportChangePathParams.

/**
 * Generates a Workflow Step to change the path parameters of a Volume in a specific Export Group.
 *
 * @param workflow
 * @param wfGroupId - Workflow group for the Step
 * @param waitFor - Wait on this step/group to complete in the workflow before execution
 * @param storageURI - Storage system containing the volume
 * @param exportGroupURI - Export group that has exported the volume
 * @param volumeURI - Volume we are changing the path parameters for
 * @return stepId for the generated workflow Step
 * @throws ControllerException
 */
public String generateExportChangePathParams(Workflow workflow, String wfGroupId, String waitFor, URI storageURI, URI exportGroupURI, URI volumeURI) throws ControllerException {
    DiscoveredSystemObject storageSystem = getStorageSystem(_dbClient, storageURI);
    BlockObject volume = BlockObject.fetch(_dbClient, volumeURI);
    Workflow.Method method = ExportWorkflowEntryPoints.exportGroupChangePathParamsMethod(storageURI, exportGroupURI, volumeURI);
    return newWorkflowStep(workflow, wfGroupId, String.format("Updated Export PathParams on storage array %s (%s, args) for volume %s (%s)", storageSystem.getNativeGuid(), storageURI, volume.getLabel(), volumeURI), storageSystem, method, null, waitFor, null);
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Example 33 with DiscoveredSystemObject

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

the class RPControllerImpl method getCopyAccessStates.

@Override
public Map<URI, String> getCopyAccessStates(URI protectionDevice, List<URI> volumeURIs) {
    final DiscoveredSystemObject device = _dbClient.queryObject(ProtectionSystem.class, protectionDevice);
    final Controller controller = lookupDeviceController(device);
    // Try to grab a handle on the RPDeviceController so we can call directly into it.
    if (controller instanceof RPDeviceController) {
        return ((RPDeviceController) controller).getCopyAccessStates(protectionDevice, volumeURIs);
    }
    // Problem calling the controller so just return an empty map
    return new HashMap<URI, String>();
}
Also used : RPDeviceController(com.emc.storageos.protectioncontroller.impl.recoverpoint.RPDeviceController) HashMap(java.util.HashMap) DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) RPController(com.emc.storageos.protectioncontroller.RPController) Controller(com.emc.storageos.Controller) RPDeviceController(com.emc.storageos.protectioncontroller.impl.recoverpoint.RPDeviceController) AbstractDiscoveredSystemController(com.emc.storageos.impl.AbstractDiscoveredSystemController)

Example 34 with DiscoveredSystemObject

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

the class DiscoverTaskCompleter method setSuccessTime.

@Override
public final void setSuccessTime(DbClient dbClient, long time) {
    Class type = getType();
    if (DiscoveredSystemObject.class.isAssignableFrom(type)) {
        try {
            DiscoveredSystemObject dbObject = (DiscoveredSystemObject) DataObject.createInstance(type, getId());
            dbObject.trackChanges();
            dbObject.setSuccessDiscoveryTime(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 35 with DiscoveredSystemObject

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

the class MeteringTaskCompleter method setSuccessTime.

@Override
public final void setSuccessTime(DbClient dbClient, long time) {
    Class type = getType();
    if (DiscoveredSystemObject.class.isAssignableFrom(type)) {
        try {
            DiscoveredSystemObject dbObject = (DiscoveredSystemObject) DataObject.createInstance(type, getId());
            dbObject.trackChanges();
            dbObject.setSuccessMeteringTime(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)

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