Douglas Schilling Landgraf has uploaded a new change for review. Change subject: frontend: rewrite hode has upgrade logic ......................................................................
frontend: rewrite hode has upgrade logic Commit 5233548 required to be rewritten to match any revision. Change-Id: I76bd2948524110ec80923e855bd1f49e09e17046 Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java 1 file changed, 31 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/17987/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 2c0c502..162008a 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 @@ -665,15 +665,40 @@ } } - public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, Version hostOs) + public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String [] hostOs) { boolean alert = false; + String version_host[] = hostOs[1].split("\\."); //$NON-NLS-1$ //$NON-NLS-2$ + String release_host[] = hostOs[2].split("\\."); //$NON-NLS-1$ //$NON-NLS-2$ + for (RpmVersion iso: isos) { - if (iso.getMajor() == hostOs.getMajor() && - iso.compareTo(hostOs) > 0) { - alert = true; - break; + // Major check + if (Integer.parseInt(version_host[0].trim()) == iso.getMajor()) { + // Minor and Build + if (iso.getMinor() > Integer.parseInt(version_host[1].trim()) || + iso.getBuild() > Integer.parseInt(version_host[2].trim())) { + alert = true; + break; + } + + // Check if release contain revision + if (Integer.toString(iso.getRevision()).length() > release_host[0].length()) { + alert = true; + break; + } + + String releaseISO [] = Integer.toString(iso.getRevision()).split("\\."); //$NON-NLS-1$ //$NON-NLS-2$ + for (int i=0; i < release_host.length; i++) { + try { + if (Integer.parseInt(releaseISO[i].trim()) > Integer.parseInt(release_host[i].trim())) { + alert = true; + break; + } + } catch (NumberFormatException e) { + break; + } + } } } return alert; @@ -1097,14 +1122,8 @@ hostGeneralModel.setHasUpgradeAlert( shouldAlertUpgrade( isos, - new Version( - new StringBuilder().append( - host[1].trim() - ).append(".").append( //$NON-NLS-1$ //$NON-NLS-2$ - host[2].split("\\.")[0].trim() //$NON-NLS-1$ //$NON-NLS-2$ - ).toString() + host ) - ) ); boolean executionAllowed = vds.getStatus() != VDSStatus.Up -- To view, visit http://gerrit.ovirt.org/17987 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76bd2948524110ec80923e855bd1f49e09e17046 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Douglas Schilling Landgraf <dougsl...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches