Arik Hadas has posted comments on this change. Change subject: core: add timestamp for vm-dynamic updates ......................................................................
Patch Set 2: (4 comments) https://gerrit.ovirt.org/#/c/41520/2/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java File backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java: Line 286: new VmsMonitoring(this, Line 287: fetcher.getChangedVms(), Line 288: fetcher.getVmsWithChangedDevices(), Line 289: auditLogDirector, Line 290: fetcher.getFetchTime() don't you prefer to take the time here before calling the 'fetch' method instead of in the fetcher? Line 291: ).perform(); Line 292: } Line 293: } Line 294: https://gerrit.ovirt.org/#/c/41520/2/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VmsMonitoring.java File backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VmsMonitoring.java: Line 149: Line 150: if (vmId != null) { Line 151: VmManager vmManager = getResourceManager().getVmManager(vmId); Line 152: if (vmManager.trylock()) { Line 153: if (vmManager.getLastUpdateDate().compareTo(fetchTime) > 0) { well, the probability is very low, I know, but shouldn't be >= ? in terms of readability I would prefer to have if (fetchTime.compareTo(vmManager.getLastUpdateDate()) > 0){... } else {.. } - but that's subjective I guess, so for your consideration Line 154: log.warn("skipping VM '{}' from this monitoring cycle" + Line 155: " - the VM data has changed since fetching the data", vmId); Line 156: vmManager.unlock(); Line 157: } else { Line 169: Line 170: private void unlockVmsManager() { Line 171: Date updateTime = Calendar.getInstance().getTime(); Line 172: for (VmManager vmManager : vmManagers.values()) { Line 173: vmManager.setLastUpdateDate(updateTime); why is this part needed? there will be no additional cycle of VmsMonitoring until the 'perform' method of the previous cycle ends, no? Line 174: vmManager.unlock(); Line 175: } Line 176: } Line 177: https://gerrit.ovirt.org/#/c/41520/2/backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VmsMonitoringTest.java File backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/VmsMonitoringTest.java: Line 33: import org.ovirt.engine.core.utils.MockEJBStrategyRule; Line 34: import org.ovirt.engine.core.vdsbroker.vdsbroker.entities.VmInternalData; Line 35: Line 36: import static org.mockito.Matchers.any; Line 37: import static org.mockito.Mockito.when; do you have the right formater set? Line 38: Line 39: @Ignore Line 40: @RunWith(MockitoJUnitRunner.class) Line 41: /** -- To view, visit https://gerrit.ovirt.org/41520 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If858993450cf957babdcf337e9b7867a282657bc Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Michal Skrivanek <mskri...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches