Tal Nisan has uploaded a new change for review.

Change subject: webadmin: Add host SPM priority value in host general tab
......................................................................

webadmin: Add host SPM priority value in host general tab

Change-Id: I9dc7b21ccb893b6d27443482b650659165dd40b6
Bug-Url: https://bugzilla.redhat.com/867642
Signed-off-by: Tal Nisan <tni...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Messages.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
3 files changed, 96 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/11895/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
index d017df4..404e846 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
@@ -244,6 +244,91 @@
 
     // 2nd column in General tab
 
+    private Integer spmPriorityValue;
+    private Integer spmMaxPriorityValue;
+    private Integer spmDefaultPriorityValue;
+    private int spmLowPriorityValue;
+    private int spmHighPriorityValue;
+    private int spmNeverPriorityValue = -1;
+
+    public Integer getSpmPriorityValue() {
+        return spmPriorityValue;
+    }
+
+    public void setSpmPriorityValue(final Integer value) {
+        if (spmPriorityValue == null || !spmPriorityValue.equals(value)) {
+            this.spmPriorityValue = value;
+
+            if (spmMaxPriorityValue == null || spmDefaultPriorityValue == 
null) {
+                getMaxSpmPriority();
+            }
+            else {
+                updateSpmPriority();
+            }
+        }
+    }
+
+    private void getMaxSpmPriority() {
+        AsyncDataProvider.GetMaxSpmPriority(new AsyncQuery(this, new 
INewAsyncCallback() {
+            @Override
+            public void OnSuccess(Object target, Object returnValue) {
+                spmMaxPriorityValue = (Integer) returnValue;
+                getDefaultSpmPriority();
+            }
+        }));
+    }
+
+    private void getDefaultSpmPriority() {
+        AsyncDataProvider.GetDefaultSpmPriority(new AsyncQuery(this, new 
INewAsyncCallback() {
+            @Override
+            public void OnSuccess(Object target, Object returnValue) {
+                spmDefaultPriorityValue = (Integer) returnValue;
+                updateSpmPriorityValues();
+                updateSpmPriority();
+            }
+        }));
+    }
+
+    private void updateSpmPriorityValues() {
+        spmLowPriorityValue = spmDefaultPriorityValue / 2;
+        spmHighPriorityValue = spmDefaultPriorityValue + (spmMaxPriorityValue 
- spmDefaultPriorityValue) / 2;
+    }
+
+    private void updateSpmPriority() {
+        if (spmPriorityValue == null) {
+            setSpmPriority(null);
+        }
+        else if (spmPriorityValue == spmLowPriorityValue) {
+            
setSpmPriority(ConstantsManager.getInstance().getConstants().lowTitle());
+        }
+        else if (spmPriorityValue.equals(spmDefaultPriorityValue)) {
+            
setSpmPriority(ConstantsManager.getInstance().getConstants().mediumTitle());
+        }
+        else if (spmPriorityValue == spmHighPriorityValue) {
+            
setSpmPriority(ConstantsManager.getInstance().getConstants().highTitle());
+        }
+        else if (spmPriorityValue == spmNeverPriorityValue) {
+            
setSpmPriority(ConstantsManager.getInstance().getConstants().neverTitle());
+        }
+        else {
+            
setSpmPriority(ConstantsManager.getInstance().getMessages().customSpmPriority(spmPriorityValue));
+        }
+    }
+
+    private String spmPriority;
+
+    public String getSpmPriority() {
+        return spmPriority;
+    }
+
+    public void setSpmPriority(String value) {
+        if (spmPriority == null || !spmPriority.equals(value)) {
+            this.spmPriority = value;
+            OnPropertyChanged(new PropertyChangedEventArgs("SpmPriority")); 
//$NON-NLS-1$
+        }
+    }
+
+
     private Integer activeVms;
 
     public Integer getActiveVms()
@@ -891,6 +976,7 @@
         setSpiceVersion(vds.getspice_version());
         setIScsiInitiatorName(vds.getIScsiInitiatorName());
 
+        setSpmPriorityValue(vds.getVdsSpmPriority());
         setActiveVms(vds.getvm_active());
         setCpuName(vds.getCpuName() != null ? vds.getCpuName().getCpuName() : 
null);
         setCpuType(vds.getcpu_model());
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Messages.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Messages.java
index 182ba2b..87a4f44 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Messages.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Messages.java
@@ -226,4 +226,6 @@
     @DefaultMessage("Updating 'network' on a running virtual machine while the 
NIC is plugged is not supported on cluster version {0}")
     String hotNetworkUpdateNotSupported(String clusterVersion);
 
+    @DefaultMessage("Custom({0})")
+    String customSpmPriority(int priority);
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
index d965aed..cda7dc0 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
@@ -64,6 +64,7 @@
     NullableNumberLabel<Integer> activeVms = new 
NullableNumberLabel<Integer>();
     NullableNumberLabel<Integer> numberOfSockets = new 
NullableNumberLabel<Integer>("Unknown"); //$NON-NLS-1$
     NullableNumberLabel<Integer> coresPerSocket = new 
NullableNumberLabel<Integer>("Unknown"); //$NON-NLS-1$
+    TextBoxLabel spmPriority = new TextBoxLabel();
 
     MemorySizeLabel<Integer> physicalMemory;
     MemorySizeLabel<Integer> usedMemory;
@@ -135,12 +136,13 @@
         formItems.add(new FormItem(constants.spiceVersionHostGeneral(), 
spiceVersion, 5, 0));
         formItems.add(new FormItem(constants.isciInitNameHostGeneral(), 
iScsiInitiatorName, 6, 0));
 
-        formItems.add(new FormItem(constants.activeVmsHostGeneral(), 
activeVms, 0, 1));
-        formItems.add(new FormItem(constants.cpuNameHostGeneral(), cpuName, 1, 
1));
-        formItems.add(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 2, 
1));
-        formItems.add(new FormItem(constants.numOfSocketsHostGeneral(), 
numberOfSockets, 3, 1));
-        formItems.add(new FormItem(constants.numOfCoresPerSocketHostGeneral(), 
coresPerSocket, 4, 1));
-        formItems.add(new FormItem(constants.numOfThreadsPerCoreHostGeneral(), 
threadsPerCore, 5, 1));
+        formItems.add(new FormItem(constants.spmPriority(), spmPriority, 0, 
1));
+        formItems.add(new FormItem(constants.activeVmsHostGeneral(), 
activeVms, 1, 1));
+        formItems.add(new FormItem(constants.cpuNameHostGeneral(), cpuName, 2, 
1));
+        formItems.add(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 3, 
1));
+        formItems.add(new FormItem(constants.numOfSocketsHostGeneral(), 
numberOfSockets, 4, 1));
+        formItems.add(new FormItem(constants.numOfCoresPerSocketHostGeneral(), 
coresPerSocket, 5, 1));
+        formItems.add(new FormItem(constants.numOfThreadsPerCoreHostGeneral(), 
threadsPerCore, 6, 1));
 
         formItems.add(new FormItem(constants.physMemHostGeneral(), 
physicalMemoryDetails, 0, 2));
         formItems.add(new FormItem(constants.swapSizeHostGeneral(), 
swapSizeDetails, 1, 2));


--
To view, visit http://gerrit.ovirt.org/11895
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to