Dudi Maroshi has uploaded a new change for review.

Change subject: webadmin: Add KSM awaremess for NUMA optimization
......................................................................

webadmin: Add KSM awaremess for NUMA optimization

Add GUI to manage the KSM policy for NUMA at cluster level.

Change-Id: I28bf4a0263566d617c2cbb356275d06729121f93
Bug-Url: https://bugzilla.redhat.com/840114
Signed-off-by: Dudi Maroshi <d...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
5 files changed, 133 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/42156/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
index dd98384..cc1345f 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
@@ -397,6 +397,7 @@
         
clusterModel.getEnableGlusterService().setEntity(cluster.supportsGlusterService());
         clusterModel.getEnableGlusterService().setIsChangeable(true);
         clusterModel.getEnableKsm().setEntity(cluster.isEnableKsm());
+        clusterModel.setKsmPolicyForNuma(cluster.isKsmMergeAcrossNumaNodes());
         
clusterModel.getEnableBallooning().setEntity(cluster.isEnableBallooning());
         
clusterModel.getArchitecture().setSelectedItem(cluster.getArchitecture());
         
clusterModel.getSerialNumberPolicy().setSelectedSerialNumberPolicy(cluster.getSerialNumberPolicy());
@@ -748,6 +749,7 @@
         
cluster.setCountThreadsAsCores(Boolean.TRUE.equals(model.getVersionSupportsCpuThreads().getEntity())
                 && 
Boolean.TRUE.equals(model.getCountThreadsAsCores().getEntity()));
         
cluster.setEnableKsm(Boolean.TRUE.equals(model.getEnableKsm().getEntity()));
+        cluster.setKsmMergeAcrossNumaNodes(model.getKsmPolicyForNuma());
         
cluster.setEnableBallooning(Boolean.TRUE.equals(model.getEnableBallooning().getEntity())
                 && version.compareTo(Version.v3_3) >= 0);
         cluster.setTransparentHugepages(version.compareTo(new Version("3.0")) 
>= 0); //$NON-NLS-1$
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
index bec71e4..f7e11a5 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
@@ -574,6 +574,16 @@
         this.enableKsm = enableKsm;
     }
 
+    private ListModel<KsmPolicyForNuma> ksmPolicyForNumaSelection;
+
+    public ListModel<KsmPolicyForNuma> getKsmPolicyForNumaSelection() {
+        return ksmPolicyForNumaSelection;
+    }
+
+    private void setKsmPolicyForNumaSelection(ListModel<KsmPolicyForNuma> 
value) {
+        ksmPolicyForNumaSelection = value;
+    }
+
     private EntityModel<Boolean> enableBallooning;
 
     public EntityModel<Boolean> getEnableBallooning() {
@@ -886,6 +896,9 @@
     public ClusterModel()
     {
         super();
+        ListModel<KsmPolicyForNuma> ksmPolicyForNumaSelection = new 
ListModel<KsmPolicyForNuma>();
+        
ksmPolicyForNumaSelection.setItems(Arrays.asList(KsmPolicyForNuma.values()));
+        setKsmPolicyForNumaSelection(ksmPolicyForNumaSelection);
     }
 
     public void initTunedProfiles() {
@@ -1111,8 +1124,22 @@
         tempVar7.setEntity(false);
         setMigrateOnErrorOption_HA_ONLY(tempVar7);
         
getMigrateOnErrorOption_HA_ONLY().getEntityChangedEvent().addListener(this);
+        // KSM feature
         setEnableKsm(new EntityModel<Boolean>());
         getEnableKsm().setEntity(false);
+        getKsmPolicyForNumaSelection().setIsChangeable(false);
+        getEnableKsm().getEntityChangedEvent().addListener(new 
IEventListener<EventArgs>() {
+            @Override
+            public void eventRaised(Event<? extends EventArgs> ev, Object 
sender, EventArgs args) {
+                if (getEnableKsm().getEntity() == null)
+                    return;
+                if (getEnableKsm().getEntity() == true)
+                    getKsmPolicyForNumaSelection().setIsChangeable(true);
+                if (getEnableKsm().getEntity() == false)
+                    getKsmPolicyForNumaSelection().setIsChangeable(false);
+            }
+        });
+
         setEnableBallooning(new EntityModel<Boolean>());
         getEnableBallooning().setEntity(false);
         // Optimization methods:
@@ -1439,6 +1466,13 @@
             }
         };
         AsyncDataProvider.getInstance().getDataCenterList(_asyncQuery);
+        // inactive KsmPolicyForNuma if KSM disabled
+        if (getEnableKsm().getEntity() == false)
+            getKsmPolicyForNumaSelection().setIsChangeable(false);
+        // hide KsmPolicyForNuma is cluseter version bellow 3.4
+        Version version = getEntity().getCompatibilityVersion();
+        if (version.compareTo(Version.v3_4) < 0)
+            getKsmPolicyForNumaSelection().setIsAvailable(false);
     }
 
     private void loadCurrentClusterManagementNetwork() {
@@ -1669,18 +1703,35 @@
 
         updateFencingPolicyContent(version);
 
-        boolean isSmallerThanVersion3_4 = version.compareTo(Version.v3_4) < 0;
-        getEnableKsm().setIsChangeable(!isSmallerThanVersion3_4);
-        
getEnableKsm().setChangeProhibitionReason(ConstantsManager.getInstance().getConstants().ksmNotAvailable());
-        if (isSmallerThanVersion3_4) {
-            getEnableKsm().setEntity(true);
-        }
+        updateKSMPolicy(version);
 
         updateMigrateOnError();
 
         updateMigrationOptions();
 
         refreshAdditionalClusterFeaturesList();
+    }
+
+    private void updateKSMPolicy(Version version) {
+        // enable KSM control from version 3.4
+        boolean isSmallerThanVersion3_4 = version.compareTo(Version.v3_4) < 0;
+        getEnableKsm().setIsChangeable(!isSmallerThanVersion3_4);
+        
getEnableKsm().setChangeProhibitionReason(ConstantsManager.getInstance().getConstants().ksmNotAvailable());
+        // default is false (disabled)
+        getEnableKsm().setEntity(false);
+        // for version 3.3 and lower the default is true.
+        if (isSmallerThanVersion3_4) {
+            getEnableKsm().setEntity(true);
+        }
+
+        // allow KSM with NUMA awareness only from version 3.4
+        boolean isLowerVersionThen3_4 = version.compareTo(Version.v3_4) < 0;
+        getKsmPolicyForNumaSelection().setIsAvailable(!isLowerVersionThen3_4);
+        
getKsmPolicyForNumaSelection().setChangeProhibitionReason(ConstantsManager.getInstance()
+                .getConstants()
+                .ksmWithNumaAwarnessNotAvailable());
+        // enable NUMA aware KSM by default (matching kernel's default)
+        setKsmPolicyForNuma(true);
     }
 
     private void refreshAdditionalClusterFeaturesList() {
@@ -2124,4 +2175,43 @@
                 ? ""
                 : srcs;
     }
+
+    public boolean getKsmPolicyForNuma() {
+        switch (getKsmPolicyForNumaSelection().getSelectedItem()) {
+        case shareAcrossNumaNodes:
+            return true;
+        case shareInsideEachNumaNode:
+            return false;
+        }
+        return true;
+    }
+
+    public void setKsmPolicyForNuma(Boolean ksmPolicyForNumaFlag) {
+        if (ksmPolicyForNumaFlag == null)
+            return;
+        KsmPolicyForNuma ksmPolicyForNuma = 
KsmPolicyForNuma.shareAcrossNumaNodes;
+        if (ksmPolicyForNumaFlag == false)
+            ksmPolicyForNuma = KsmPolicyForNuma.shareInsideEachNumaNode;
+
+        getKsmPolicyForNumaSelection().setSelectedItem(ksmPolicyForNuma);
+        return;
+    }
+
+    public enum KsmPolicyForNuma {
+
+        
shareAcrossNumaNodes(ConstantsManager.getInstance().getConstants().shareKsmAcrossNumaNodes()),
+        
shareInsideEachNumaNode(ConstantsManager.getInstance().getConstants().shareKsmInsideEachNumaNode());
+
+        private String description;
+
+        private KsmPolicyForNuma(String description) {
+            this.description = description;
+        }
+
+        @Override
+        public String toString() {
+            return description;
+        }
+    }
+
 }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index dce3725..3b024f3 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -2347,9 +2347,19 @@
     @DefaultStringValue("Remove Scheduling Policy")
     String removeClusterPolicyTitle();
 
+    // MoM
     @DefaultStringValue("KSM control is only available for Cluster 
compatibility version 3.4 and higher")
     String ksmNotAvailable();
 
+    @DefaultStringValue("KSM with NUMA optimization control is only available 
for Cluster compatibility version 3.6 and higher")
+    String ksmWithNumaAwarnessNotAvailable();
+
+    @DefaultStringValue("Share memory pages across all available memory (best 
KSM effectivness)")
+    String shareKsmAcrossNumaNodes();
+
+    @DefaultStringValue("Share memory pages inside NUMA nodes (best NUMA 
performance)")
+    String shareKsmInsideEachNumaNode();
+
     @DefaultStringValue("Ballooning is only available for Cluster 
compatibility version 3.3 and higher")
     String ballooningNotAvailable();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
index 236c8bc..126eddc 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
@@ -23,6 +23,7 @@
 import org.ovirt.engine.ui.common.widget.dialog.tab.DialogTabPanel;
 import org.ovirt.engine.ui.common.widget.editor.ListModelCheckBoxGroup;
 import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
+import org.ovirt.engine.ui.common.widget.editor.ListModelRadioGroupEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxOnlyEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor;
@@ -432,6 +433,11 @@
 
     private final Driver driver = GWT.create(Driver.class);
 
+    @UiField
+    @Path(value = "ksmPolicyForNumaSelection.selectedItem")
+    public ListModelRadioGroupEditor<ClusterModel.KsmPolicyForNuma> 
ksmPolicyForNumaEditor;
+
+
     private final static ApplicationTemplates templates = 
AssetProvider.getTemplates();
     private final static ApplicationResources resources = 
AssetProvider.getResources();
     private final static ApplicationConstants constants = 
AssetProvider.getConstants();
@@ -484,6 +490,8 @@
         
enableOptionalReasonEditor.setContentWidgetContainerStyleName(style.fullWidth());
         
enableHostMaintenanceReasonEditor.setContentWidgetContainerStyleName(style.fullWidth());
         
additionalFeaturesExpanderContent.setStyleName(style.additionalFeaturesExpanderContent());
+        
ksmPolicyForNumaEditor.addContentWidgetContainerStyleName(style.overrideRadioButtonPanelWidth());
+        
ksmPolicyForNumaEditor.addLabelStyleName(style.overideRadioButtonLabel());
     }
 
     private void localize() {
@@ -857,7 +865,12 @@
 
         String optimizationTabPanel();
 
+
         String additionalFeaturesExpanderContent();
+
+        String overrideRadioButtonPanelWidth();
+
+        String overideRadioButtonLabel();
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
index c7f3198..86274e9 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
@@ -161,6 +161,17 @@
             display: none;
         }
 
+        .overrideRadioButtonPanelWidth {
+            padding: 0px 30px;
+            width: 100%;
+            margin-top: 15px;
+            line-height: 25px !important;
+        }
+
+        .overideRadioButtonLabel {
+            padding: 0px;
+        }
+
     </ui:style>
 
     <d:SimpleDialogPanel width="800px" height="560px">
@@ -234,6 +245,7 @@
                                 <g:FlowPanel 
addStyleNames="{style.nestedSubsequentPanel}">
                                     <g:Label text="{constants.ksmLabelTitle}" 
addStyleNames="{style.panelTitle}" />
                                     <ge:EntityModelCheckBoxEditor 
ui:field="enableKsm" />
+                                    <e:ListModelRadioGroupEditor  
ui:field="ksmPolicyForNumaEditor" />
                                 </g:FlowPanel>
                             </g:FlowPanel>
                         </t:content>


-- 
To view, visit https://gerrit.ovirt.org/42156
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28bf4a0263566d617c2cbb356275d06729121f93
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Dudi Maroshi <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to