Alon Bar-Lev has posted comments on this change.
Change subject: HostGeneralModel: improve "node has upgrade" logic
......................................................................
Patch Set 7: (3 inline comments)
....................................................
File
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
Line 669: {
Line 670: boolean alert = false;
Line 671:
Line 672: for (RpmVersion iso: isos) {
Line 673: if (iso.compareTo(hostOs) > 0) {
where do we compare the major version?
Line 674: alert = true;
Line 675: break;
Line 676: }
Line 677: }
Line 1091: ArrayList<RpmVersion> isos =
(ArrayList<RpmVersion>) returnValue;
Line 1092: if (isos.size() > 0)
Line 1093: {
Line 1094: VDS vds =
hostGeneralModel.getEntity();
Line 1095: String [] Host =
vds.getHostOs().split("-"); //$NON-NLS-1$ //$NON-NLS-2$
Yair, I am wondering how out let this Host convention go.
Douglas,
This is no good, as if there is dash between components you get an error, for
example ovirt-node-1.2.3.
Line 1096: String NodeRPMVersion =
Host[1].trim() + "." + Host[2].split("\\.")[0].trim(); //$NON-NLS-1$
//$NON-NLS-2$
Line 1097: Version hostOS = new
Version(NodeRPMVersion);
Line 1098:
hostGeneralModel.setHasUpgradeAlert(shouldAlertUpgrade(isos, hostOS));
Line 1099:
Line 1094: VDS vds =
hostGeneralModel.getEntity();
Line 1095: String [] Host =
vds.getHostOs().split("-"); //$NON-NLS-1$ //$NON-NLS-2$
Line 1096: String NodeRPMVersion =
Host[1].trim() + "." + Host[2].split("\\.")[0].trim(); //$NON-NLS-1$
//$NON-NLS-2$
Line 1097: Version hostOS = new
Version(NodeRPMVersion);
Line 1098:
hostGeneralModel.setHasUpgradeAlert(shouldAlertUpgrade(isos, hostOS));
So basically, al the above bla bla is the following code:
String[] host = vds.getHostOs().split("-");
hostGeneralModel.setHasUpgradeAlert(
shouldAlertUpgrade(
isos,
new Version(
String.format(
"%s.%s",
host[1].trim(),
host[2].split("\\.")[0].trim()
)
)
)
And I ask, why not use RPMVersion that already knows to parse
prefix-version-release?
And the answer is... engine code is a mess, UI has its own version of
RrpmVersion which does not actually parse version, so we need to parse it...
but if we need to parse it why not fix the RpmVerision implementation to be
compatible with UI, or the one of the UI to provide the service?
Line 1099:
Line 1100: boolean executionAllowed =
vds.getStatus() != VDSStatus.Up
Line 1101: && vds.getStatus() !=
VDSStatus.Installing
Line 1102: && vds.getStatus() !=
VDSStatus.PreparingForMaintenance
--
To view, visit http://gerrit.ovirt.org/16089
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I49c74d3d0d92c74848e0c175095610b6e6b5a88e
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Barak Azulay <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Einav Cohen <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches