use of com.emc.storageos.vplexcontroller.job.VPlexCacheStatusJob in project coprhd-controller by CoprHD.
the class VPlexDeviceController method invalidateCache.
/**
* Called to invalidate the read cache for a VPLEX volume when
* restoring a snapshot.
*
* @param vplexURI
* The URI of the VPLEX system.
* @param vplexVolumeURI
* The URI of a VPLEX volume.
* @param stepId
* The workflow step identifier.
*/
public void invalidateCache(URI vplexURI, URI vplexVolumeURI, String stepId) {
_log.info("Executing invalidate cache for volume {} on VPLEX {}", vplexVolumeURI, vplexURI);
try {
// Update workflow step.
WorkflowStepCompleter.stepExecuting(stepId);
// Get the API client.
StorageSystem vplexSystem = getDataObject(StorageSystem.class, vplexURI, _dbClient);
VPlexApiClient client = getVPlexAPIClient(_vplexApiFactory, vplexSystem, _dbClient);
_log.info("Got VPLEX API client");
// Get the VPLEX volume.
Volume vplexVolume = getDataObject(Volume.class, vplexVolumeURI, _dbClient);
String vplexVolumeName = vplexVolume.getDeviceLabel();
_log.info("Got VPLEX volumes");
// Invalidate the cache for the volume.
boolean stillInProgress = client.invalidateVirtualVolumeCache(vplexVolumeName);
_log.info("Invalidated the VPLEX volume cache");
// invalidation completes.
if (stillInProgress) {
CacheStatusTaskCompleter invalidateCompleter = new CacheStatusTaskCompleter(vplexVolumeURI, stepId);
VPlexCacheStatusJob cacheStatusJob = new VPlexCacheStatusJob(invalidateCompleter);
ControllerServiceImpl.enqueueJob(new QueueJob(cacheStatusJob));
_log.info("Queued job to monitor migration progress.");
} else {
// Update workflow step state to success.
WorkflowStepCompleter.stepSucceded(stepId);
_log.info("Updated workflow step state to success");
}
} catch (VPlexApiException vae) {
_log.error("Exception invalidating VPLEX volume cache " + vae.getMessage(), vae);
WorkflowStepCompleter.stepFailed(stepId, vae);
} catch (Exception e) {
_log.error("Exception invalidating VPLEX volume cache " + e.getMessage(), e);
WorkflowStepCompleter.stepFailed(stepId, VPlexApiException.exceptions.failedInvalidatingVolumeCache(vplexVolumeURI.toString(), e));
}
}
Aggregations