Eli Mesika has uploaded a new change for review.

Change subject: UI: Adding support for setting skip if network...
......................................................................

UI: Adding support for setting skip if network...

Adding support for setting skip if network unstable and threshold

Change-Id: I7d300b37a49261744d81fd397772f70e56e7a688
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1120829
Signed-off-by: Eli Mesika <emes...@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/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, 111 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/05/31305/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 2d0d0a2..e3eb4f1 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
@@ -749,6 +749,8 @@
         }
 
         
cluster.getFencingPolicy().setSkipFencingIfSDActive(model.getSkipFencingIfSDActiveEnabled().getEntity());
+        
cluster.getFencingPolicy().setSkipFencingIfNetworkUnstable(model.getSkipFencingIfNetworkUnstableEnabled().getEntity());
+        
cluster.getFencingPolicy().setHostsWithUnstableNetworkThreshold(model.getHostsWithUnstableNetworkThreshold().getEntity().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 ba86765..5a753d9 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,28 @@
         this.skipFencingIfSDActiveEnabled = skipFencingIfSDActiveEnabled;
     }
 
+    private EntityModel<Boolean> skipFencingIfNetworkUnstableEnabled;
+
+    public EntityModel<Boolean> getSkipFencingIfNetworkUnstableEnabled() {
+        return skipFencingIfNetworkUnstableEnabled;
+    }
+
+    public void setSkipFencingIfNetworkUnstableEnabled(EntityModel<Boolean> 
skipFencingIfNetworkUnstableEnabled) {
+        this.skipFencingIfNetworkUnstableEnabled = 
skipFencingIfNetworkUnstableEnabled;
+    }
+
+    private ListModel<Integer> privateHostsWithUnstableNetworkThreshold;
+
+    public ListModel<Integer> getHostsWithUnstableNetworkThreshold()
+    {
+        return privateHostsWithUnstableNetworkThreshold;
+    }
+
+    public void setHostsWithUnstableNetworkThreshold(ListModel<Integer> value)
+    {
+        privateHostsWithUnstableNetworkThreshold = value;
+    }
+
     public ClusterModel()
     {
         super();
@@ -815,6 +837,11 @@
 
         setSkipFencingIfSDActiveEnabled(new EntityModel<Boolean>());
         getSkipFencingIfSDActiveEnabled().setEntity(true);
+
+        setSkipFencingIfNetworkUnstableEnabled(new EntityModel<Boolean>());
+        getSkipFencingIfNetworkUnstableEnabled().setEntity(true);
+
+        initHostsWithUnstableNetworkThreshold();
 
         setEnableOvirtService(new EntityModel());
         setEnableGlusterService(new EntityModel());
@@ -904,7 +931,6 @@
                     }
                 }
             }
-
        });
 
         getEnableTrustedService().getEntityChangedEvent().addListener(new 
IEventListener() {
@@ -1137,6 +1163,10 @@
                                         }));
                     }
                 }));
+        setHostsWithUnstableNetworkThreshold(new ListModel<Integer>());
+        getHostsWithUnstableNetworkThreshold().setIsAvailable(true);
+        
getHostsWithUnstableNetworkThreshold().getSelectedItemChangedEvent().addListener(this);
+
     }
 
     private void initSpiceProxy() {
@@ -1228,6 +1258,8 @@
 
         initSpiceProxy();
         
getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive());
+        
getSkipFencingIfNetworkUnstableEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfNetworkUnstable());
+        
getHostsWithUnstableNetworkThreshold().setEntity(getEntity().getFencingPolicy().getHostsWithUnstableNetworkThreshold());
 
         setMemoryOverCommit(getEntity().getmax_vds_memory_over_commit());
 
@@ -1479,6 +1511,11 @@
     private void updateFencingPolicyContent(Version ver) {
         boolean supported = 
AsyncDataProvider.getInstance().isSkipFencingIfSDActiveSupported(ver.getValue());
         getSkipFencingIfSDActiveEnabled().setIsChangable(supported);
+        // Enabling setting this entity for all versions
+        getSkipFencingIfNetworkUnstableEnabled().setIsChangable(true);
+        getHostsWithUnstableNetworkThreshold().setIsChangable(true);
+        
getSkipFencingIfNetworkUnstableEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfNetworkUnstable());
+        
getHostsWithUnstableNetworkThreshold().setEntity(getEntity().getFencingPolicy().getHostsWithUnstableNetworkThreshold());
         if (supported) {
             if (getEntity() == null) {
                 // this can happen when creating new cluster and cluster 
dialog is shown
@@ -1551,6 +1588,13 @@
         }
     }
 
+    private void initHostsWithUnstableNetworkThreshold() {
+        // populating threshold values with {0, 25, 50, 75, 100}
+        for (int i=0; i<=100; i+=25) {
+            privateHostsWithUnstableNetworkThreshold.getItems().add(i);
+        }
+    }
+
     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 932acb4..bc3319d 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
@@ -806,6 +806,12 @@
     @DefaultStringValue("Skip fencing if host has live lease on storage")
     String skipFencingIfSDActive();
 
+    @DefaultStringValue("Disrupt fence request if more than X% Hosts have 
networking problems")
+    String skipFencingWhenNetworkUnstable();
+
+    @DefaultStringValue("Threshold of Hosts having network problems")
+    String hostsWithUnstableNetworkThresholdLabel();
+
     @DefaultStringValue("Name")
     String bookmarkPopupNameLabel();
 
@@ -3798,4 +3804,7 @@
 
     @DefaultStringValue("This will skip fencing for a Host that has live lease 
on Storage Domains")
     String skipFencingIfSDActiveInfo();
+
+    @DefaultStringValue("This will disrupt fence request on a Hots if its 
Cluster has more than X% Hosts with networking problems")
+    String skipFencingWhenNetworkUnstableInfo();
 }
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 e6354ff..400e484 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 skipFencingIfNetworkUnstableInfo;
+
+    @UiField(provided = true)
+    @Path(value = "skipFencingIfNetworkUnstableEnabled.entity")
+    @WithElementId
+    EntityModelCheckBoxEditor skipFencingIfNetworkUnstableCheckBox;
+
+    @UiField(provided = true)
+    @Path(value = "hostsWithUnstableNetworkThreshold.selectedItem")
+    @WithElementId
+    ListModelListBoxEditor<Integer> hostsWithUnstableNetworkThresholdEditor;
+
     private final Driver driver = GWT.create(Driver.class);
 
     private final ApplicationMessages messages;
@@ -380,7 +393,6 @@
         initRadioButtonEditors();
         initCheckBoxEditors();
         initInfoIcons(resources, constants, templates);
-
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
         ViewIdHandler.idHandler.generateAndSetIds(this);
 
@@ -466,6 +478,8 @@
         fencingPolicyTab.setLabel(constants.fencingPolicyTabLabel());
 
         
skipFencingIfSDActiveCheckBox.setLabel(constants.skipFencingIfSDActive());
+        
skipFencingIfNetworkUnstableCheckBox.setLabel(constants.skipFencingWhenNetworkUnstable());
+        
hostsWithUnstableNetworkThresholdEditor.setLabel(constants.hostsWithUnstableNetworkThresholdLabel());
     }
 
     private void initRadioButtonEditors() {
@@ -525,7 +539,12 @@
                 return object.getName();
             }
         });
-
+        hostsWithUnstableNetworkThresholdEditor = new 
ListModelListBoxEditor<Integer>(new NullSafeRenderer<Integer>() {
+            @Override
+            public String renderNullSafe(Integer object) {
+                return object.toString();
+            }
+        });
     }
 
     private void initCheckBoxEditors() {
@@ -550,6 +569,9 @@
 
         skipFencingIfSDActiveCheckBox = new 
EntityModelCheckBoxEditor(Align.RIGHT);
         
skipFencingIfSDActiveCheckBox.getContentWidgetContainer().setWidth("300px"); 
//$NON-NLS-1$
+
+        skipFencingIfNetworkUnstableCheckBox = new 
EntityModelCheckBoxEditor(Align.RIGHT);
+        
skipFencingIfNetworkUnstableCheckBox.getContentWidgetContainer().setWidth("300px");
 //$NON-NLS-1$
     }
 
     private void initInfoIcons(ApplicationResources resources, 
ApplicationConstants constants, ApplicationTemplates templates) {
@@ -568,6 +590,10 @@
 
         skipFencingIfSDActiveInfo = new InfoIcon(
                 templates.italicFixedWidth("400px", 
constants.skipFencingIfSDActiveInfo()), //$NON-NLS-1$
+                resources);
+
+        skipFencingIfNetworkUnstableInfo = new InfoIcon(
+                templates.italicFixedWidth("400px", 
constants.skipFencingWhenNetworkUnstableInfo()), //$NON-NLS-1$
                 resources);
     }
 
@@ -688,6 +714,21 @@
                 updateFencingPolicyTabVisibility(object);
             }
         });
+
+        
object.getSkipFencingIfNetworkUnstableEnabled().getPropertyChangedEvent().addListener(new
 IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                updateFencingPolicyTabVisibility(object);
+            }
+        });
+
+        
object.getHostsWithUnstableNetworkThreshold().getSelectedItemChangedEvent().addListener(new
 IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                updateFencingPolicyTabVisibility(object);
+            }
+        });
+
     }
 
     private void optimizationForServerFormatter(ClusterModel object) {
@@ -720,7 +761,8 @@
 
     private void updateFencingPolicyTabVisibility(ClusterModel object) {
         fencingPolicyTab.setVisible(
-                object.getSkipFencingIfSDActiveEnabled().getIsChangable()
+                object.getSkipFencingIfSDActiveEnabled().getIsChangable() ||
+                
object.getSkipFencingIfNetworkUnstableEnabled().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..c37cc56 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
@@ -276,6 +276,11 @@
                                     <ge:EntityModelCheckBoxEditor 
ui:field="skipFencingIfSDActiveCheckBox" />
                                     <d:InfoIcon 
ui:field="skipFencingIfSDActiveInfo" 
addStyleNames="cpv_skipFencingIfSDActiveInfo_pfly_fix" />
                                 </g:HorizontalPanel>
+                                <g:HorizontalPanel>
+                                    <ge:EntityModelCheckBoxEditor 
ui:field="skipFencingIfNetworkUnstableCheckBox" />
+                                    <d:InfoIcon 
ui:field="skipFencingIfNetworkUnstableInfo" 
addStyleNames="cpv_skipFencingIfSNetworkUnstableInfo_pfly_fix" />
+                                    <e:ListModelListBoxEditor 
ui:field="hostsWithUnstableNetworkThresholdEditor" />
+                                </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..a13fa79 100644
--- a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
+++ b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
@@ -425,6 +425,11 @@
     top: 5px;
     left: 5px;
 }
+.cpv_skipFencingIfSNetworkUnstableInfo_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/31305
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to