Arik Hadas has submitted this change and it was merged.
Change subject: core: minimize access to database during vm analysis
......................................................................
core: minimize access to database during vm analysis
VM fetchers provide 3 types of pairs to VmAnalyzer:
1. pair of reported VM from VDSM and VM from database
2. pair of VM from database and NULL
3. pair of VM from VDSM and NULL
1) means that the VM is 'stable', that is it is reported from
the host that it is expected to run on.
2) means that the VM disappeared, that is no longer reported
from the host that it is expected to run on.
3) means that the VM is reported from host that the VM was
not running on.
To resolve these cases the fetchers get the reported VM from
VDSM and the ones in the database that are running on the
monitored host. In case of #3, VmAnalyzer needs to query the
database again.
This patch queries the VM from the database, if needed, in the
factory of VmAnalyzer. That way, we reduce the access to the
database inside VmAnalyzer and replace unclear null-checks with
more declarative checks.
Change-Id: I5d6b83c4f4a2d8ee6d1bb3f7f69bebeeec0675cb
Signed-off-by: Arik Hadas <ahadas(a)redhat.com>
---
M
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VmAnalyzer.java
M
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VmAnalyzerFactory.java
M
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VmsMonitoring.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/VmAnalyzerTest.java
M
backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/monitoring/VmTestPairs.java
5 files changed, 25 insertions(+), 83 deletions(-)
Approvals:
Shahar Havivi: Looks good to me, approved
Jenkins CI: Passed CI tests
Arik Hadas: Verified
--
To view, visit
https://gerrit.ovirt.org/56566
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d6b83c4f4a2d8ee6d1bb3f7f69bebeeec0675cb
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Shahar Havivi <shavivi(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>