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