Martin Peřina has uploaded a new change for review.

Change subject: webadmin: Add option disable fencing in cluster
......................................................................

webadmin: Add option disable fencing in cluster

Adds option to cluster fencing policy which disabled fencing for all
hosts in cluster. By default fencing in cluster is enabled.

Change-Id: Idd373c344e767306526b2af3955c2d0d33027736
Bug-Url: https://bugzilla.redhat.com/1120858
Signed-off-by: Martin Perina <mper...@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, 57 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/31256/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..1d1d26f 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
@@ -748,6 +748,7 @@
             cluster.setSpiceProxy(model.getSpiceProxy().getEntity());
         }
 
+        
cluster.getFencingPolicy().setFencingEnabled(model.getFencingEnabledModel().getEntity());
         
cluster.getFencingPolicy().setSkipFencingIfSDActive(model.getSkipFencingIfSDActiveEnabled().getEntity());
 
         
cluster.setSerialNumberPolicy(model.getSerialNumberPolicy().getSelectedSerialNumberPolicy());
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..bd6ffd0 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
@@ -772,6 +772,16 @@
         }
     }
 
+    private EntityModel<Boolean> fencingEnabledModel;
+
+    public EntityModel<Boolean> getFencingEnabledModel() {
+        return fencingEnabledModel;
+    }
+
+    public void setFencingEnabledModel(EntityModel<Boolean> 
fencingEnabledModel) {
+        this.fencingEnabledModel = fencingEnabledModel;
+    }
+
     private EntityModel<Boolean> skipFencingIfSDActiveEnabled;
 
     public EntityModel<Boolean> getSkipFencingIfSDActiveEnabled() {
@@ -812,6 +822,23 @@
 
         setSpiceProxy(new EntityModel<String>());
         getSpiceProxy().setIsChangable(false);
+
+        setFencingEnabledModel(new EntityModel<Boolean>());
+        getFencingEnabledModel().setEntity(true);
+        getFencingEnabledModel().getEntityChangedEvent().addListener(new 
IEventListener() {
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                if (getFencingEnabledModel().getEntity()) {
+                    Version ver = getVersion().getSelectedItem();
+                    if (ver != null) {
+                        updateFencingPolicyContent(ver);
+                    }
+                } else {
+                    // when fencing is disabled, all fencing policy content 
should also be disabled
+                    getSkipFencingIfSDActiveEnabled().setIsChangable(false);
+                }
+            }
+        });
 
         setSkipFencingIfSDActiveEnabled(new EntityModel<Boolean>());
         getSkipFencingIfSDActiveEnabled().setEntity(true);
@@ -1227,6 +1254,7 @@
         getComment().setEntity(getEntity().getComment());
 
         initSpiceProxy();
+        
getFencingEnabledModel().setEntity(getEntity().getFencingPolicy().isFencingEnabled());
         
getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive());
 
         setMemoryOverCommit(getEntity().getmax_vds_memory_over_commit());
@@ -1478,7 +1506,8 @@
 
     private void updateFencingPolicyContent(Version ver) {
         boolean supported = 
AsyncDataProvider.getInstance().isSkipFencingIfSDActiveSupported(ver.getValue());
-        getSkipFencingIfSDActiveEnabled().setIsChangable(supported);
+        getSkipFencingIfSDActiveEnabled().setIsChangable(
+                supported && getFencingEnabledModel().getEntity());
         if (supported) {
             if (getEntity() == null) {
                 // this can happen when creating new cluster and cluster 
dialog is shown
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..df07cce 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,9 @@
     @DefaultStringValue("Define SPICE proxy for Cluster")
     String clusterSpiceProxyEnable();
 
+    @DefaultStringValue("Enable fencing")
+    String fencingEnabled();
+
     @DefaultStringValue("Skip fencing if host has live lease on storage")
     String skipFencingIfSDActive();
 
@@ -3796,6 +3799,9 @@
     @DefaultStringValue("Save As Pdf")
     String exportToPdf();
 
+    @DefaultStringValue("Enables fencing operations in cluster. If fencing is 
disabled for this cluster, VM operations on HA VMs are currently limited")
+    String fencingEnabledInfo();
+
     @DefaultStringValue("This will skip fencing for a Host that has live lease 
on Storage Domains")
     String skipFencingIfSDActiveInfo();
 }
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..bfa7e90 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
@@ -352,6 +352,14 @@
     DialogTab fencingPolicyTab;
 
     @UiField(provided = true)
+    InfoIcon fencingEnabledInfo;
+
+    @UiField(provided = true)
+    @Path(value = "fencingEnabledModel.entity")
+    @WithElementId
+    EntityModelCheckBoxEditor fencingEnabledCheckBox;
+
+    @UiField(provided = true)
     InfoIcon skipFencingIfSDActiveInfo;
 
     @UiField(provided = true)
@@ -465,6 +473,7 @@
 
         fencingPolicyTab.setLabel(constants.fencingPolicyTabLabel());
 
+        fencingEnabledCheckBox.setLabel(constants.fencingEnabled());
         
skipFencingIfSDActiveCheckBox.setLabel(constants.skipFencingIfSDActive());
     }
 
@@ -548,6 +557,9 @@
         rngRandomSourceRequired = new EntityModelCheckBoxEditor(Align.RIGHT);
         rngHwrngSourceRequired = new EntityModelCheckBoxEditor(Align.RIGHT);
 
+        fencingEnabledCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
+        fencingEnabledCheckBox.getContentWidgetContainer().setWidth("300px"); 
//$NON-NLS-1$
+
         skipFencingIfSDActiveCheckBox = new 
EntityModelCheckBoxEditor(Align.RIGHT);
         
skipFencingIfSDActiveCheckBox.getContentWidgetContainer().setWidth("300px"); 
//$NON-NLS-1$
     }
@@ -566,6 +578,9 @@
         spiceProxyOverrideEnabled = new EntityModelCheckBoxOnlyEditor();
         spiceProxyEnabledCheckboxWithInfoIcon = new 
EntityModelWidgetWithInfo<String>(label, spiceProxyOverrideEnabled);
 
+        fencingEnabledInfo = new InfoIcon(
+                templates.italicFixedWidth("400px", 
constants.fencingEnabledInfo()), //$NON-NLS-1$
+                resources);
         skipFencingIfSDActiveInfo = new InfoIcon(
                 templates.italicFixedWidth("400px", 
constants.skipFencingIfSDActiveInfo()), //$NON-NLS-1$
                 resources);
@@ -682,12 +697,6 @@
                 }
             }
         });
-        
object.getSkipFencingIfSDActiveEnabled().getPropertyChangedEvent().addListener(new
 IEventListener() {
-            @Override
-            public void eventRaised(Event ev, Object sender, EventArgs args) {
-                updateFencingPolicyTabVisibility(object);
-            }
-        });
     }
 
     private void optimizationForServerFormatter(ClusterModel object) {
@@ -716,12 +725,6 @@
                     
.setHTML(templates.radioButtonLabel(messages.clusterPopupMemoryOptimizationCustomLabel(
                             String.valueOf(object.getMemoryOverCommit()))));
         }
-    }
-
-    private void updateFencingPolicyTabVisibility(ClusterModel object) {
-        fencingPolicyTab.setVisible(
-                object.getSkipFencingIfSDActiveEnabled().getIsChangable()
-        );
     }
 
     @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 21a5f03..17b78b3 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
@@ -273,6 +273,10 @@
                         <t:content>
                             <g:FlowPanel 
addStyleNames="cvp_fencingPolicyContent_pfly_fix">
                                 <g:HorizontalPanel>
+                                    <ge:EntityModelCheckBoxEditor 
ui:field="fencingEnabledCheckBox" />
+                                    <d:InfoIcon ui:field="fencingEnabledInfo" 
addStyleNames="cpv_fencingEnabledInfo_pfly_fix" />
+                                </g:HorizontalPanel>
+                                <g:HorizontalPanel>
                                     <ge:EntityModelCheckBoxEditor 
ui:field="skipFencingIfSDActiveCheckBox" />
                                     <d:InfoIcon 
ui:field="skipFencingIfSDActiveInfo" 
addStyleNames="cpv_skipFencingIfSDActiveInfo_pfly_fix" />
                                 </g:HorizontalPanel>
diff --git a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css 
b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
index af162ae..1880b91 100644
--- a/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
+++ b/packaging/branding/ovirt.brand/ovirt-patternfly-compat.css
@@ -420,7 +420,7 @@
     top: -3px;
     left: 5px;
 }
-.cpv_skipFencingIfSDActiveInfo_pfly_fix {
+.cpv_fencingEnabledInfo_pfly_fix, .cpv_skipFencingIfSDActiveInfo_pfly_fix {
     position: relative;
     top: 5px;
     left: 5px;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd373c344e767306526b2af3955c2d0d33027736
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to