Tomas Jelinek has posted comments on this change. Change subject: frontend: Add CPU profile to VM flows ......................................................................
Patch Set 2: (7 comments) http://gerrit.ovirt.org/#/c/31630/2/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java: Line 277: updateVirtioScsiAvailability(); Line 278: updateOSValues(); Line 279: updateTemplate(); Line 280: updateNumOfSockets(); Line 281: updateCpuProfile(vm.getVdsGroupId(), vm.getVdsGroupCompatibilityVersion(), vm.getCpuProfileId()); also here I would go with the selected cluster and i'ts compatibility version. (being careful because the getModel().getSelectedCluster() can return null) Line 282: } Line 283: Line 284: @Override Line 285: public void defaultHost_SelectedItemChanged() http://gerrit.ovirt.org/#/c/31630/2/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java: Line 142: Line 143: getModel().getVmInitModel().init(template); Line 144: getModel().getVmInitEnabled().setEntity(template.getVmInit() != null); Line 145: Line 146: updateCpuProfile(template.getVdsGroupId(), getClusterCompatibilityVersion(), template.getCpuProfileId()); I'd say that you should set the cluster up according to the cluster on which you are creating the VM and not according to the one on which the template is. So something like: updateCpuProfile( getModel().getSelectedCluster(), getClusterCompatibilityVersion(), template.getCpuProfileId() ); Line 147: } Line 148: } Line 149: Line 150: @Override http://gerrit.ovirt.org/#/c/31630/2/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java: Line 157: Line 158: getModel().getVmInitModel().init(vmBase); Line 159: getModel().getVmInitEnabled().setEntity(vmBase.getVmInit() != null); Line 160: Line 161: updateCpuProfile(vmBase.getVdsGroupId(), getClusterCompatibilityVersion(), vmBase.getCpuProfileId()); same Line 162: } Line 163: } Line 164: Line 165: @Override http://gerrit.ovirt.org/#/c/31630/2/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java: Line 137: updateCpuSharesAvailability(); Line 138: updateVirtioScsiAvailability(); Line 139: updateMigrationForLocalSD(); Line 140: updateOSValues(); Line 141: updateCpuProfile(template.getCpuProfileId(), getClusterCompatibilityVersion(), template.getCpuProfileId()); same Line 142: } Line 143: Line 144: @Override Line 145: public void defaultHost_SelectedItemChanged() http://gerrit.ovirt.org/#/c/31630/2/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 195: public void setVmAttachedToPool(boolean value) { Line 196: if (value) { Line 197: // ==General Tab== Line 198: getDataCenterWithClustersList().setIsChangable(!value); Line 199: getQuota().setIsChangable(false); you need to call also here getCpuProfiles().setIsChangable(false); Line 200: Line 201: getNumOfDesktops().setIsChangable(false); Line 202: getPrestartedVms().setIsChangable(false); Line 203: getMaxAssignedVmsPerUser().setIsChangable(false); http://gerrit.ovirt.org/#/c/31630/2/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java File frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java: Line 1190: getModel().getCpuProfiles().setIsAvailable(false); Line 1191: } Line 1192: } Line 1193: Line 1194: private void fetchCpuProfiles(Guid clusterId, final Guid cpuProfileId) { Here I would be a bit more defensive and did a null check of the clusterId (even I can not tell you an exact scenario how could this happen to be null but I'm pretty sure that there are situations where it will be called with null and only after than inited to the correct cluster). Line 1195: Frontend.getInstance().runQuery(VdcQueryType.GetCpuProfilesByClusterId, Line 1196: new IdQueryParameters(clusterId), Line 1197: new AsyncQuery(new INewAsyncCallback() { Line 1198: Line 1203: getModel().getCpuProfiles().setItems(cpuProfiles); Line 1204: if (cpuProfiles != null) { Line 1205: for (CpuProfile cpuProfile : cpuProfiles) { Line 1206: if (cpuProfile.getId().equals(cpuProfileId)) { Line 1207: getModel().getCpuProfiles().setSelectedItem(cpuProfile); here you can call "break;" Line 1208: } Line 1209: } Line 1210: } Line 1211: } -- To view, visit http://gerrit.ovirt.org/31630 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8a55e2ae268b932537d41b8e626795292fed8134 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org 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