Eli Mesika has uploaded a new change for review.

Change subject: UI:Adding support for host with connectivity..
......................................................................

UI:Adding support for host with connectivity..

Adding support for host with connectivity issues

Change-Id: I7d300b37a49261744d81fd397772f70e56e7a688
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1120829
Signed-off-by: Eli Mesika <[email protected]>
---
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/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.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
M packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
6 files changed, 121 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/31616/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 e56c9e8..22392ef 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
@@ -757,6 +757,8 @@
         }
 
         
cluster.getFencingPolicy().setSkipFencingIfSDActive(model.getSkipFencingIfSDActiveEnabled().getEntity());
+        
cluster.getFencingPolicy().setSkipFencingIfConnectivityBroken(model.getSkipFencingIfConnectivityBrokenEnabled().getEntity());
+        
cluster.getFencingPolicy().setHostsWithBrokenConnectivityThreshold(model.getHostsWithBrokenConnectivityThreshold().getSelectedItem().intValue());
 
         
cluster.setSerialNumberPolicy(model.getSerialNumberPolicy().getSelectedSerialNumberPolicy());
         
cluster.setCustomSerialNumber(model.getSerialNumberPolicy().getCustomSerialNumber().getEntity());
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 8babe4d..9614644 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
@@ -782,6 +782,26 @@
         this.skipFencingIfSDActiveEnabled = skipFencingIfSDActiveEnabled;
     }
 
+    private EntityModel<Boolean> skipFencingIfConnectivityBrokenEnabled;
+
+    public EntityModel<Boolean> getSkipFencingIfConnectivityBrokenEnabled() {
+        return skipFencingIfConnectivityBrokenEnabled;
+    }
+
+    public void setSkipFencingIfConnectivityBrokenEnabled(EntityModel<Boolean> 
skipFencingIfConnectivityBrokenEnabled) {
+        this.skipFencingIfConnectivityBrokenEnabled = 
skipFencingIfConnectivityBrokenEnabled;
+    }
+
+    private ListModel<Integer> hostsWithBrokenConnectivityThreshold;
+
+    public ListModel<Integer> getHostsWithBrokenConnectivityThreshold() {
+        return hostsWithBrokenConnectivityThreshold;
+    }
+
+    public void setHostsWithBrokenConnectivityThreshold(ListModel<Integer> 
value) {
+        hostsWithBrokenConnectivityThreshold = value;
+    }
+
     public ClusterModel()
     {
         super();
@@ -815,6 +835,9 @@
 
         setSkipFencingIfSDActiveEnabled(new EntityModel<Boolean>());
         getSkipFencingIfSDActiveEnabled().setEntity(true);
+
+        setSkipFencingIfConnectivityBrokenEnabled(new EntityModel<Boolean>());
+        getSkipFencingIfConnectivityBrokenEnabled().setEntity(true);
 
         setEnableOvirtService(new EntityModel());
         setEnableGlusterService(new EntityModel());
@@ -903,8 +926,8 @@
                         getEnableTrustedService().setIsChangable(false);
                     }
                 }
-            }
 
+            }
        });
 
         getEnableTrustedService().getEntityChangedEvent().addListener(new 
IEventListener() {
@@ -1012,6 +1035,11 @@
                 }
             });
         }
+
+        setHostsWithBrokenConnectivityThreshold(new ListModel<Integer>());
+        getHostsWithBrokenConnectivityThreshold().setIsAvailable(true);
+        
getHostsWithBrokenConnectivityThreshold().getSelectedItemChangedEvent().addListener(this);
+        initHostsWithBrokenConnectivityThreshold();
 
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);
@@ -1228,6 +1256,8 @@
 
         initSpiceProxy();
         
getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive());
+        
getSkipFencingIfConnectivityBrokenEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfConnectivityBroken());
+        
getHostsWithBrokenConnectivityThreshold().setSelectedItem(getEntity().getFencingPolicy().getHostsWithBrokenConnectivityThreshold());
 
         setMemoryOverCommit(getEntity().getmax_vds_memory_over_commit());
 
@@ -1489,6 +1519,12 @@
         } else {
             getSkipFencingIfSDActiveEnabled().setEntity(false);
         }
+
+        // skipFencingIfConnectivityBroken is enabled for all cluster versions
+        getSkipFencingIfConnectivityBrokenEnabled().setIsChangable(true);
+        getHostsWithBrokenConnectivityThreshold().setIsChangable(true);
+        getSkipFencingIfConnectivityBrokenEnabled().setEntity(getEntity() == 
null ? false : 
getEntity().getFencingPolicy().isSkipFencingIfConnectivityBroken());
+        getHostsWithBrokenConnectivityThreshold().setEntity(getEntity() == 
null ? 50 : 
getEntity().getFencingPolicy().getHostsWithBrokenConnectivityThreshold());
     }
 
     private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> 
cpus, boolean canChangeArchitecture)
@@ -1551,6 +1587,15 @@
         }
     }
 
+    private void initHostsWithBrokenConnectivityThreshold() {
+        ArrayList values = new ArrayList<Integer>();
+        // populating threshold values with {25, 50, 75, 100}
+        for (int i = 25; i <= 100; i += 25) {
+            values.add(i);
+        }
+        getHostsWithBrokenConnectivityThreshold().setItems(values);
+    }
+
     private void storagePool_SelectedItemChanged(EventArgs e)
     {
         // possible versions for new cluster (when editing cluster, this event 
won't occur)
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index dda9e3a..8db3e4d 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -803,6 +803,12 @@
     @DefaultStringValue("Skip fencing if host has live lease on storage")
     String skipFencingIfSDActive();
 
+    @DefaultStringValue("Skip fencing on cluster connectivity issues")
+    String skipFencingWhenConnectivityBroken();
+
+    @DefaultStringValue("Threshold")
+    String hostsWithBrokenConnectivityThresholdLabel();
+
     @DefaultStringValue("Name")
     String bookmarkPopupNameLabel();
 
@@ -3752,4 +3758,7 @@
 
     @DefaultStringValue("This will skip fencing for a Host that has live lease 
on Storage Domains")
     String skipFencingIfSDActiveInfo();
+
+    @DefaultStringValue("This will skip fencing if the percentage of Cluster 
Hosts with connectivity issues is greater than or equal to the defined 
threshold")
+    String skipFencingWhenConnectivityBrokenInfo();
 }
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 bc5f9b1..9a3f802 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
@@ -359,6 +359,19 @@
     @WithElementId
     EntityModelCheckBoxEditor skipFencingIfSDActiveCheckBox;
 
+    @UiField(provided = true)
+    InfoIcon skipFencingIfConnectivityBrokenInfo;
+
+    @UiField(provided = true)
+    @Path(value = "skipFencingIfConnectivityBrokenEnabled.entity")
+    @WithElementId
+    EntityModelCheckBoxEditor skipFencingIfConnectivityBrokenCheckBox;
+
+    @UiField(provided = true)
+    @Path(value = "hostsWithBrokenConnectivityThreshold.selectedItem")
+    @WithElementId
+    ListModelListBoxEditor<Integer> hostsWithBrokenConnectivityThresholdEditor;
+
     private final Driver driver = GWT.create(Driver.class);
 
     private final ApplicationMessages messages;
@@ -466,6 +479,8 @@
         fencingPolicyTab.setLabel(constants.fencingPolicyTabLabel());
 
         
skipFencingIfSDActiveCheckBox.setLabel(constants.skipFencingIfSDActive());
+        
skipFencingIfConnectivityBrokenCheckBox.setLabel(constants.skipFencingWhenConnectivityBroken());
+        
hostsWithBrokenConnectivityThresholdEditor.setLabel(constants.hostsWithBrokenConnectivityThresholdLabel());
     }
 
     private void initRadioButtonEditors() {
@@ -525,7 +540,12 @@
                 return object.getName();
             }
         });
-
+        hostsWithBrokenConnectivityThresholdEditor = new 
ListModelListBoxEditor<Integer>(new NullSafeRenderer<Integer>() {
+            @Override
+            public String renderNullSafe(Integer object) {
+                return object.toString();
+            }
+        });
     }
 
     private void initCheckBoxEditors() {
@@ -550,6 +570,9 @@
 
         skipFencingIfSDActiveCheckBox = new 
EntityModelCheckBoxEditor(Align.RIGHT);
         
skipFencingIfSDActiveCheckBox.getContentWidgetContainer().setWidth("300px"); 
//$NON-NLS-1$
+
+        skipFencingIfConnectivityBrokenCheckBox = new 
EntityModelCheckBoxEditor(Align.RIGHT);
+        
skipFencingIfConnectivityBrokenCheckBox.getContentWidgetContainer().setWidth("300px");
 //$NON-NLS-1$
     }
 
     private void initInfoIcons(ApplicationResources resources, 
ApplicationConstants constants, ApplicationTemplates templates) {
@@ -568,6 +591,10 @@
 
         skipFencingIfSDActiveInfo = new InfoIcon(
                 templates.italicFixedWidth("400px", 
constants.skipFencingIfSDActiveInfo()), //$NON-NLS-1$
+                resources);
+
+        skipFencingIfConnectivityBrokenInfo = new InfoIcon(
+                templates.italicFixedWidth("400px", 
constants.skipFencingWhenConnectivityBrokenInfo()), //$NON-NLS-1$
                 resources);
     }
 
@@ -688,6 +715,21 @@
                 updateFencingPolicyTabVisibility(object);
             }
         });
+
+        
object.getSkipFencingIfConnectivityBrokenEnabled().getPropertyChangedEvent().addListener(new
 IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                updateFencingPolicyTabVisibility(object);
+            }
+        });
+
+        
object.getHostsWithBrokenConnectivityThreshold().getSelectedItemChangedEvent().addListener(new
 IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                updateFencingPolicyTabVisibility(object);
+            }
+        });
+
     }
 
     private void optimizationForServerFormatter(ClusterModel object) {
@@ -720,7 +762,8 @@
 
     private void updateFencingPolicyTabVisibility(ClusterModel object) {
         fencingPolicyTab.setVisible(
-                object.getSkipFencingIfSDActiveEnabled().getIsChangable()
+                object.getSkipFencingIfSDActiveEnabled().getIsChangable() ||
+                
object.getSkipFencingIfConnectivityBrokenEnabled().getIsChangable()
         );
     }
 
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 21a5f03..063c176 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
@@ -146,7 +146,7 @@
 
     </ui:style>
 
-    <d:SimpleDialogPanel width="670px" height="560px">
+    <d:SimpleDialogPanel width="800px" height="560px">
         <d:content>
             <t:DialogTabPanel ui:field="tabsPanel" height="100%">
                 <t:tab>
@@ -276,6 +276,13 @@
                                     <ge:EntityModelCheckBoxEditor 
ui:field="skipFencingIfSDActiveCheckBox" />
                                     <d:InfoIcon 
ui:field="skipFencingIfSDActiveInfo" 
addStyleNames="cpv_skipFencingIfSDActiveInfo_pfly_fix" />
                                 </g:HorizontalPanel>
+                                <g:HorizontalPanel>
+                                    <ge:EntityModelCheckBoxEditor 
ui:field="skipFencingIfConnectivityBrokenCheckBox" />
+                                    <d:InfoIcon 
ui:field="skipFencingIfConnectivityBrokenInfo" />
+                                </g:HorizontalPanel>
+                                <g:HorizontalPanel>
+                                    <e:ListModelListBoxEditor 
ui:field="hostsWithBrokenConnectivityThresholdEditor" 
addStyleNames="cpv_hostsWithBrokenConnectivityThresholdEditor_pfly_fix" />
+                                </g:HorizontalPanel>
                             </g:FlowPanel>
                         </t:content>
                     </t:DialogTab>
diff --git a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css 
b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
index af162ae..075b212 100644
--- a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
+++ b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
@@ -425,6 +425,17 @@
     top: 5px;
     left: 5px;
 }
+.cpv_skipFencingIfConnectivityBrokenInfo_pfly_fix {
+    position: relative;
+    top: 5px;
+    left: 5px;
+    width: 30%;
+}
+.cpv_hostsWithBrokenConnectivityThresholdEditor_pfly_fix {
+    position: relative;
+    top: 5px;
+    left: 5px;
+}
 .appv_searchButton_pfly_fix {
     position: relative !important;
     top: 2px !important;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d300b37a49261744d81fd397772f70e56e7a688
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to