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 <[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, 71 insertions(+), 44 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/31651/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 22392ef..fa9cbbc 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 @@ -756,6 +756,7 @@ cluster.setSpiceProxy(model.getSpiceProxy().getEntity()); } + cluster.getFencingPolicy().setFencingEnabled(model.getFencingEnabledModel().getEntity()); cluster.getFencingPolicy().setSkipFencingIfSDActive(model.getSkipFencingIfSDActiveEnabled().getEntity()); cluster.getFencingPolicy().setSkipFencingIfConnectivityBroken(model.getSkipFencingIfConnectivityBrokenEnabled().getEntity()); cluster.getFencingPolicy().setHostsWithBrokenConnectivityThreshold(model.getHostsWithBrokenConnectivityThreshold().getSelectedItem().intValue()); 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 9614644..7036c41 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() { @@ -832,6 +842,15 @@ 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) { + updateFencingPolicyContent(getVersion() == null ? null : getVersion().getSelectedItem()); + } + }); setSkipFencingIfSDActiveEnabled(new EntityModel<Boolean>()); getSkipFencingIfSDActiveEnabled().setEntity(true); @@ -1255,6 +1274,7 @@ getComment().setEntity(getEntity().getComment()); initSpiceProxy(); + getFencingEnabledModel().setEntity(getEntity().getFencingPolicy().isFencingEnabled()); getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive()); getSkipFencingIfConnectivityBrokenEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfConnectivityBroken()); getHostsWithBrokenConnectivityThreshold().setSelectedItem(getEntity().getFencingPolicy().getHostsWithBrokenConnectivityThreshold()); @@ -1507,24 +1527,32 @@ } private void updateFencingPolicyContent(Version ver) { - boolean supported = AsyncDataProvider.isSkipFencingIfSDActiveSupported(ver.getValue()); - getSkipFencingIfSDActiveEnabled().setIsChangable(supported); - if (supported) { - if (getEntity() == null) { - // this can happen when creating new cluster and cluster dialog is shown - getSkipFencingIfSDActiveEnabled().setEntity(true); - } else { - getSkipFencingIfSDActiveEnabled().setEntity(getEntity().getFencingPolicy().isSkipFencingIfSDActive()); + // skipFencingIfConnectivityBroken option is enabled when fencing is enabled for all cluster versions + getSkipFencingIfConnectivityBrokenEnabled().setIsChangable(getFencingEnabledModel().getEntity()); + getHostsWithBrokenConnectivityThreshold().setIsChangable(getFencingEnabledModel().getEntity()); + + if (ver == null) { + if (!getFencingEnabledModel().getEntity()) { + // fencing is disabled and cluster version not selected yet, so disable skipFencingIfSDActive + getSkipFencingIfSDActiveEnabled().setIsChangable(false); } } else { - getSkipFencingIfSDActiveEnabled().setEntity(false); + // skipFencingIfSDActive is enabled for supported cluster level if fencing is not disabled + boolean supported = AsyncDataProvider.isSkipFencingIfSDActiveSupported(ver.getValue()); + getSkipFencingIfSDActiveEnabled().setIsChangable( + supported && getFencingEnabledModel().getEntity()); + if (supported) { + if (getEntity() == null) { + // this can happen when creating new cluster and cluster dialog is shown + getSkipFencingIfSDActiveEnabled().setEntity(true); + } else { + getSkipFencingIfSDActiveEnabled().setEntity( + getEntity().getFencingPolicy().isSkipFencingIfSDActive()); + } + } 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) @@ -1594,6 +1622,7 @@ values.add(i); } getHostsWithBrokenConnectivityThreshold().setItems(values); + getHostsWithBrokenConnectivityThreshold().setSelectedItem(50); } private void storagePool_SelectedItemChanged(EventArgs e) 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 8db3e4d..f3bd70f 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 @@ -800,6 +800,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(); @@ -3756,6 +3759,9 @@ @DefaultStringValue("Save As Pdf") String exportToPdf(); + @DefaultStringValue("Enables fencing operations in this cluster. Note that if fencing is disabled, HA VMs running on a non-responsive host will not be restarted elsewhere.") + 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 9a3f802..aac7052 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) @@ -478,6 +486,7 @@ fencingPolicyTab.setLabel(constants.fencingPolicyTabLabel()); + fencingEnabledCheckBox.setLabel(constants.fencingEnabled()); skipFencingIfSDActiveCheckBox.setLabel(constants.skipFencingIfSDActive()); skipFencingIfConnectivityBrokenCheckBox.setLabel(constants.skipFencingWhenConnectivityBroken()); hostsWithBrokenConnectivityThresholdEditor.setLabel(constants.hostsWithBrokenConnectivityThresholdLabel()); @@ -568,6 +577,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$ @@ -589,6 +601,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); @@ -709,27 +724,6 @@ } } }); - object.getSkipFencingIfSDActiveEnabled().getPropertyChangedEvent().addListener(new IEventListener() { - @Override - public void eventRaised(Event ev, Object sender, EventArgs args) { - 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) { @@ -758,13 +752,6 @@ .setHTML(templates.radioButtonLabel(messages.clusterPopupMemoryOptimizationCustomLabel( String.valueOf(object.getMemoryOverCommit())))); } - } - - private void updateFencingPolicyTabVisibility(ClusterModel object) { - fencingPolicyTab.setVisible( - object.getSkipFencingIfSDActiveEnabled().getIsChangable() || - object.getSkipFencingIfConnectivityBrokenEnabled().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 063c176..3311b7b2 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 075b212..6b17d25 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/31651 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd373c344e767306526b2af3955c2d0d33027736 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Martin Peřina <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
