/** * Analyze the VM data pair Skip analysis on VMs which cannot be locked note: metrics calculation * like memCommited and vmsCoresCount should be calculated *before* this filtering. */ private void refreshVmStats() { for (Pair<VM, VmInternalData> monitoredVm : monitoredVms) { // TODO filter out migratingTo VMs if no action is taken on them if (tryLockVmForUpdate(monitoredVm)) { VmAnalyzer vmAnalyzer = getVmAnalyzer(monitoredVm); vmAnalyzers.add(vmAnalyzer); vmAnalyzer.analyze(); if (vmAnalyzer.isExternalVm()) { externalVms.add(new Pair<>(vmAnalyzer.getDbVm(), vmAnalyzer.getVdsmVm())); } } } processExternallyManagedVms(); processVmsWithDevicesChange(); saveVmsToDb(); }