use of com.emc.storageos.db.client.model.DataObject in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method getUnManagedProtectionSetForManagedVolume.
/**
* Get the unmanaged protection set corresponding to the managed volume
*
* @param managedVolume the Volume object to find an UnManagedProtectionSet for
* @param dbClient a reference to the database client
* @return unmanaged protection set
*/
public static UnManagedProtectionSet getUnManagedProtectionSetForManagedVolume(IngestionRequestContext requestContext, BlockObject managedVolume, DbClient dbClient) {
UnManagedProtectionSet umpset = null;
// Find the UnManagedProtectionSet associated with this managed volume
List<UnManagedProtectionSet> umpsets = CustomQueryUtility.getUnManagedProtectionSetByManagedVolumeId(dbClient, managedVolume.getId().toString());
Iterator<UnManagedProtectionSet> umpsetsItr = umpsets.iterator();
if (umpsetsItr.hasNext()) {
umpset = umpsetsItr.next();
}
if (umpset != null) {
DataObject alreadyLoadedUmpset = requestContext.findInUpdatedObjects(umpset.getId());
if (alreadyLoadedUmpset != null && (alreadyLoadedUmpset instanceof UnManagedProtectionSet)) {
umpset = (UnManagedProtectionSet) alreadyLoadedUmpset;
}
}
return umpset;
}
use of com.emc.storageos.db.client.model.DataObject in project coprhd-controller by CoprHD.
the class ReplicaCleanupContext method execute.
/**
* Iterates over the collection of volume URIs, having each {@link ReplicaCleanup} instance
* process each member, adding relevant items for either deletion or updating.
*
* Finally, call the database to make the necessary changes.
*
* @param volumes Collection of Volume URIs.
*/
public void execute(Collection<URI> volumes) {
if (volumes == null || volumes.isEmpty()) {
return;
}
Collection<DataObject> itemsToUpdate = new HashSet<>();
Collection<DataObject> itemsToDelete = new HashSet<>();
for (URI volume : volumes) {
for (ReplicaCleanup cleanup : cleanups) {
cleanup.process(volume, itemsToUpdate, itemsToDelete);
}
}
if (!itemsToDelete.isEmpty()) {
dbClient.markForDeletion(itemsToDelete);
}
if (!itemsToUpdate.isEmpty()) {
dbClient.updateObject(itemsToUpdate);
}
}
use of com.emc.storageos.db.client.model.DataObject in project coprhd-controller by CoprHD.
the class DataCollectionTaskCompleter method statusPending.
@Override
public void statusPending(DbClient dbClient, String message) {
DataObject dbObject = dbClient.queryObject(getType(), getId());
if (!dbObject.getOpStatus().containsKey(getOpId())) {
createDefaultOperation(dbClient);
}
super.statusPending(dbClient, message);
_log.info(String.format("Updated JobType: %s, Class: %s Id: %s, OpId: %s, status: %s, message: %s", getJobType(), getType().toString(), getId().toString(), getOpId(), Status.pending.name(), message));
}
use of com.emc.storageos.db.client.model.DataObject in project coprhd-controller by CoprHD.
the class DataCollectionTaskCompleter method schedule.
public void schedule(DbClient dbClient) {
updateObjectState(dbClient, DiscoveredDataObject.DataCollectionJobStatus.SCHEDULED);
DataObject dbObject = dbClient.queryObject(getType(), getId());
if (!dbObject.getOpStatus().containsKey(getOpId())) {
createDefaultOperation(dbClient);
}
_log.info(String.format("Scheduled JobType: %s, Class: %s, Id: %s, OpId: %s", getJobType(), getType().toString(), getId().toString(), getOpId()));
// TODO : Need to record the event of task completion in the DB
// RecordableEventManager.EventType eventType = ....
// recordBourneDiscoverEvent(dbClient, eventType, status, "Discover");
}
use of com.emc.storageos.db.client.model.DataObject in project coprhd-controller by CoprHD.
the class DataCollectionTaskCompleter method statusError.
@Override
public void statusError(DbClient dbClient, ServiceCoded code) {
DataObject dbObject = dbClient.queryObject(getType(), getId());
if (!dbObject.getOpStatus().containsKey(getOpId())) {
createDefaultOperation(dbClient);
}
super.statusError(dbClient, code);
_log.info(String.format("Failed JobType: %s, Class: %s Id: %s, OpId: %s, status: %s, cause: %s", getJobType(), getType().toString(), getId().toString(), getOpId(), Status.error.name(), code.getMessage()));
}
Aggregations