Search in sources :

Example 41 with DataObject

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;
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)

Example 42 with DataObject

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);
    }
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) URI(java.net.URI) HashSet(java.util.HashSet)

Example 43 with DataObject

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));
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject)

Example 44 with DataObject

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");
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject)

Example 45 with DataObject

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()));
}
Also used : DataObject(com.emc.storageos.db.client.model.DataObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject)

Aggregations

DataObject (com.emc.storageos.db.client.model.DataObject)154 URI (java.net.URI)62 ArrayList (java.util.ArrayList)53 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)44 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)30 Volume (com.emc.storageos.db.client.model.Volume)26 NamedURI (com.emc.storageos.db.client.model.NamedURI)24 StringSet (com.emc.storageos.db.client.model.StringSet)23 HashMap (java.util.HashMap)22 BlockObject (com.emc.storageos.db.client.model.BlockObject)17 HashSet (java.util.HashSet)17 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)16 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)14 Operation (com.emc.storageos.db.client.model.Operation)13 List (java.util.List)10 Set (java.util.Set)10 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)9 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)8