Tomas Jelinek has posted comments on this change. Change subject: engine: Modify memory verify mode for synchronous mode in template and vm module. ......................................................................
Patch Set 3: (1 comment) Good point, it is indeed a bug. Unfortunately this patch will behave very similarly and the proper solution is way harder. What you will need to do is to solve it the same way as it is done for e.g. defaultOSes (AsyncDataProvider.defaultOSes) So, 1: Create the method OsRepository.getMaximumRams() and it's implementation in OsRepositoryImpl (will return a Map<Integer,Integer> which will be a mapping OsId -> MaxRam 2: Add the OsQueryParameters.GetMaxOsRams and wire all together in OsRepositoryQuery.executeQueryCommand() 3: Add some method like initOsMaxRams() AsyncDataProvider and call it from the AsyncDataProvider.initCache 4: Create a new map like: private static HashMap<Integer, Integer> maxRams. From initOsMaxRams() call the newly created query the same way as the initDefaultOSes() calls its and fill the result to the maxRams. 5: Change the AsyncDataProvider.getOsMaxRam(...) to be synchronous and get the data from your maxRams map (like getDefaultOs). Be careful to handle the case where the osId is not present in the map 6: Use this method from UnitVmModel http://gerrit.ovirt.org/#/c/24217/3/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java: Line 2385: public void onSuccess(Object model, Object returnValue) { Line 2386: set_maxMemSize((Integer)((VdcQueryReturnValue)returnValue).getReturnValue()); Line 2387: } Line 2388: }; Line 2389: validateMemorySize(getMemSize(), get_maxMemSize(), _minMemSize); the set_maxMemSize has not yet been called, it will be sometimes in the future after the callback returns... Line 2390: if (!(getBehavior() instanceof TemplateVmModelBehavior)) { Line 2391: // Minimum 'Physical Memory Guaranteed' is 1MB Line 2392: if (getMemSize().getEntity() == 0) { Line 2393: validateMemorySize(getMinAllocatedMemory(), get_maxMemSize(), 1); -- To view, visit http://gerrit.ovirt.org/24217 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id0dd06b1af4a5e24c5f5d88d442466e5a2752e45 Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: 锡亮 马 <maxiliang4...@gmail.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches