Ravi Nori has uploaded a new change for review. Change subject: webadmin: Keep validation/event message if there is an iso update to ovirt node host ......................................................................
webadmin: Keep validation/event message if there is an iso update to ovirt node host The code for checking if there is an iso update to ovirt-node host got removed when reworking ovirt host deploy sequence. shouldAlertUpgrade() is still available in HostGeneralModel.java Change-Id: I1b58f3c5f2ce1a7e9f5c151c07c6c32a2cbb8fe1 Bug-Url: https://bugzilla.redhat.com/1117393 Signed-off-by: Ravi Nori <rn...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java 2 files changed, 60 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/29897/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 9990a93..e4bd133 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 @@ -11,6 +11,7 @@ import org.ovirt.engine.core.common.businessentities.NonOperationalReason; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.core.common.businessentities.VDSType; import org.ovirt.engine.core.common.businessentities.VdsSpmStatus; import org.ovirt.engine.core.common.utils.ObjectUtils; import org.ovirt.engine.core.common.utils.RpmVersionUtils; @@ -1032,6 +1033,10 @@ setNonOperationalReasonEntity((getEntity().getNonOperationalReason() == NonOperationalReason.NONE ? null : (NonOperationalReason) getEntity().getNonOperationalReason())); + setHasAnyAlert(); + } + + public void setHasAnyAlert() { setHasAnyAlert(getHasNICsAlert() || getHasUpgradeAlert() || getHasManualFenceAlert() || getHasNoPowerManagementAlert() || getHasReinstallAlertNonResponsive() || getHasReinstallAlertInstallFailed() || getHasReinstallAlertMaintenance()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index cf3c438..cff4d15 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -96,6 +96,8 @@ @SuppressWarnings("unused") public class HostListModel extends ListWithDetailsModel implements ISupportSystemTreeContext { + private HostGeneralModel generalModel; + private UICommand privateNewCommand; public UICommand getNewCommand() @@ -1806,7 +1808,7 @@ { super.initDetailModels(); - HostGeneralModel generalModel = new HostGeneralModel(); + generalModel = new HostGeneralModel(); generalModel.getRequestEditEvent().addListener(this); generalModel.getRequestGOToEventsTabEvent().addListener(this); @@ -1882,6 +1884,58 @@ { super.onSelectedItemChanged(); updateActionAvailability(); + + if (getSelectedItem() != null) { + updateAlerts(); + } + } + + private void updateAlerts() { + final VDS vds = (VDS) getSelectedItem(); + final UIConstants constants = ConstantsManager.getInstance().getConstants(); + if (vds.getVdsType() == VDSType.oVirtNode) + { + AsyncDataProvider.getoVirtISOsList(new AsyncQuery(this, + new INewAsyncCallback() { + @Override + public void onSuccess(Object target, Object returnValue) { + + ArrayList<RpmVersion> isos = (ArrayList<RpmVersion>) returnValue; + if (isos.size() > 0) + { + String [] hostOsInfo = vds.getHostOs().split("-"); //$NON-NLS-1$ //$NON-NLS-2$ + for (int counter = 0; counter < hostOsInfo.length; counter++) { + hostOsInfo[counter] = hostOsInfo[counter].trim(); + } + generalModel.setHasUpgradeAlert( + generalModel.shouldAlertUpgrade( + isos, + hostOsInfo + ) + ); + boolean executionAllowed = vds.getStatus() != VDSStatus.Up + && vds.getStatus() != VDSStatus.Installing + && vds.getStatus() != VDSStatus.PreparingForMaintenance + && vds.getStatus() != VDSStatus.Reboot + && vds.getStatus() != VDSStatus.PendingApproval; + + if (!executionAllowed) + { + getUpgradeCommand() + .getExecuteProhibitionReasons() + .add(constants + .switchToMaintenanceModeToEnableUpgradeReason()); + } + getUpgradeCommand().setIsExecutionAllowed(executionAllowed); + } + + generalModel.setHasAnyAlert(); + + } + }), + vds.getId()); + } + } @Override -- To view, visit http://gerrit.ovirt.org/29897 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b58f3c5f2ce1a7e9f5c151c07c6c32a2cbb8fe1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ravi Nori <rn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches