use of org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation in project ovirt-engine by oVirt.
the class IrsProxy method hostsStorageConnectionsAndPoolMetadataRefresh.
@OnTimerMethodAnnotation("hostsStorageConnectionsAndPoolMetadataRefresh")
public void hostsStorageConnectionsAndPoolMetadataRefresh() {
Map<Guid, Guid> reportsToHandle = procceedReportsThreatmenet();
if (reportsToHandle.isEmpty()) {
return;
}
List<Callable<Void>> connectStorageTasks = new ArrayList<>();
final List<Callable<Void>> refreshStoragePoolTasks = new ArrayList<>();
final StoragePool storagePool = storagePoolDao.get(storagePoolId);
final Guid masterDomainId = storageDomainDao.getMasterStorageDomainIdForPool(storagePoolId);
final List<StoragePoolIsoMap> storagePoolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(storagePoolId);
Map<String, Pair<String, String>> acquiredLocks = new HashMap<>();
try {
for (Map.Entry<Guid, Guid> entry : reportsToHandle.entrySet()) {
Guid vdsId = entry.getKey();
Guid currentReportId = entry.getValue();
vdsHandeledReportsOnUnseenDomains.put(vdsId, currentReportId);
Map<String, Pair<String, String>> lockMap = Collections.singletonMap(vdsId.toString(), new Pair<>(LockingGroup.VDS_POOL_AND_STORAGE_CONNECTIONS.toString(), EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED.toString()));
EngineLock engineLock = new EngineLock(lockMap, null);
if (!lockManager.acquireLock(engineLock).getFirst()) {
log.info("Failed to acquire lock to refresh storage connection and pool metadata for host '{}', skipping it", vdsId);
continue;
}
final VDS vds = vdsDao.get(entry.getKey());
if (vds.getStatus() != VDSStatus.Up) {
log.info("Skipping storage connection and pool metadata information for host '{}' as it's no longer in status UP", vdsId);
lockManager.releaseLock(engineLock);
continue;
}
acquiredLocks.putAll(lockMap);
connectStorageTasks.add(() -> {
getEventListener().connectHostToDomainsInActiveOrUnknownStatus(vds);
return null;
});
refreshStoragePoolTasks.add(() -> {
storagePoolDomainHelper.refreshHostPoolMetadata(vds, storagePool, masterDomainId, storagePoolIsoMap);
return null;
});
}
final Set<String> handledHosts = acquiredLocks.keySet();
log.info("Running storage connections refresh for hosts '{}'", handledHosts);
ThreadPoolUtil.invokeAll(connectStorageTasks);
log.info("Submitting to the event queue pool refresh for hosts '{}'", handledHosts);
getEventQueue().submitEventSync(new Event(storagePoolId, null, null, EventType.POOLREFRESH, ""), () -> {
log.info("Running storage pool metadata refresh for hosts '{}'", handledHosts);
ThreadPoolUtil.invokeAll(refreshStoragePoolTasks);
return new EventResult(true, EventType.POOLREFRESH);
});
} finally {
if (!acquiredLocks.isEmpty()) {
lockManager.releaseLock(new EngineLock(acquiredLocks, null));
}
}
}
use of org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation in project ovirt-engine by oVirt.
the class GlusterHookSyncJob method refreshHooks.
@OnTimerMethodAnnotation("refreshHooks")
public void refreshHooks() {
log.debug("Refreshing hooks list");
List<Cluster> clusters = clusterDao.getAll();
for (Cluster cluster : clusters) {
refreshHooksInCluster(cluster, false);
}
}
use of org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation in project ovirt-engine by oVirt.
the class GlusterSyncJob method refreshSelfHealInfo.
/**
* Refreshes self heal info from GlusterFS. This method is scheduled less frequently as it uses the 'volume
* heal info' command, that adds significant overhead on Gluster processes, and hence should not be invoked too
* frequently.
*/
@OnTimerMethodAnnotation("refreshSelfHealInfo")
public void refreshSelfHealInfo() {
log.debug("Refreshing Gluster Self Heal Data");
for (Cluster cluster : clusterDao.getAll()) {
if (supportsGlusterSelfHealMonitoring(cluster)) {
try {
refreshSelfHealData(cluster);
} catch (Exception e) {
log.error("Error while refreshing Gluster self heal data of cluster '{}': {}", cluster.getName(), e.getMessage());
log.debug("Exception", e);
}
}
}
log.debug("Refreshing Gluster Self Heal data is completed");
}
use of org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation in project ovirt-engine by oVirt.
the class GlusterSyncJob method refreshLightWeightData.
/**
* Refreshes details of all volume across all clusters being managed in the engine. It can end up doing the
* following in engine DB to make sure that the volume details in engine DB are in sync with GlusterFS:<br>
* <li>Insert volumes</li><li>Delete volumes</li><li>Update properties of volume e.g. status, volume type</li><li>
* Add / remove bricks to / from volumes</li><li>Set / Unset volume options</li><br>
* These are all fetched using the 'volume info' command on gluster CLI, which is relatively lightweight, and hence
* this method is scheduled more frequently as compared to the other method <code>refreshHeavyWeightData</code>,
* which uses 'volume status' to fetch and update status of volume bricks.
*/
@OnTimerMethodAnnotation("refreshLightWeightData")
public void refreshLightWeightData() {
log.debug("Refreshing Gluster Data [lightweight]");
List<Cluster> clusters = clusterDao.getAll();
for (Cluster cluster : clusters) {
if (cluster.supportsGlusterService()) {
try {
refreshClusterData(cluster);
} catch (Exception e) {
log.error("Error while refreshing Gluster lightweight data of cluster '{}': {}", cluster.getName(), e.getMessage());
log.debug("Exception", e);
}
}
}
}
use of org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation in project ovirt-engine by oVirt.
the class GlusterTasksSyncJob method updateGlusterAsyncTasks.
@OnTimerMethodAnnotation("gluster_async_task_poll_event")
public void updateGlusterAsyncTasks() {
log.debug("Refreshing gluster tasks list");
List<Cluster> clusters = clusterDao.getAll();
Map<Guid, Set<Guid>> tasksFromClustersMap = new HashMap<>();
for (Cluster cluster : clusters) {
if (!cluster.supportsGlusterService()) {
continue;
}
try {
Map<Guid, GlusterAsyncTask> runningTasks = provider.getTaskListForCluster(cluster.getId());
if (runningTasks != null) {
updateTasksInCluster(cluster, runningTasks);
tasksFromClustersMap.put(cluster.getId(), runningTasks.keySet());
}
} catch (EngineException e) {
log.error("Error updating tasks from CLI", e);
}
}
cleanUpOrphanTasks(tasksFromClustersMap);
}
Aggregations