Moti Asayag has uploaded a new change for review.

Change subject: engine: Update host for available updates when ISOs are checked
......................................................................

engine: Update host for available updates when ISOs are checked

When the GetoVirtISOsQuery is called, no input is persisted for
the host. Storing the updates availability will allow the user
to examine the host entity (in UI or Rest) for that information.

Change-Id: Ib9cf358ccfa986220cff871b02cf1b588495a086
Bug-Url: https://bugzilla.redhat.com/1157368
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/GetoVirtISOsQuery.java
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/40835/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/GetoVirtISOsQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/GetoVirtISOsQuery.java
index 85ebf00..a2efc3f 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/GetoVirtISOsQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/GetoVirtISOsQuery.java
@@ -10,14 +10,18 @@
 import java.util.List;
 import java.util.regex.Matcher;
 
+import javax.inject.Inject;
+
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.QueriesCommandBase;
 import org.ovirt.engine.core.bll.VdsHandler;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.queries.VdsIdParametersBase;
+import org.ovirt.engine.core.common.utils.RpmVersionUtils;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.RpmVersion;
 import org.ovirt.engine.core.compat.Version;
+import org.ovirt.engine.core.dao.VdsDynamicDAO;
 
 /**
  * The {@code GetoVirtISOsQuery} is responsible to detect all available oVirt 
images installed on engine server. It detects
@@ -27,6 +31,9 @@
 public class GetoVirtISOsQuery<P extends VdsIdParametersBase> extends 
QueriesCommandBase<P> {
     private static final String OVIRT_ISO_VERSION_PREFIX = "version";
     private static final String OVIRT_ISO_VDSM_COMPATIBILITY_PREFIX = 
"vdsm-compatibility";
+
+    @Inject
+    private VdsDynamicDAO hostDynamicDao;
 
     public GetoVirtISOsQuery(P parameters) {
         super(parameters);
@@ -106,6 +113,14 @@
         }
         Collections.sort(availableISOsList);
         getQueryReturnValue().setReturnValue(availableISOsList);
+        updateUpdatesAvailableForHost(availableISOsList, vds);
+    }
+
+    public void updateUpdatesAvailableForHost(List<RpmVersion> availableIsos, 
VDS vds) {
+        boolean updateAvailable = 
RpmVersionUtils.isUpdateAvailable(availableIsos, vds.getHostOs());
+        if (updateAvailable != vds.isUpdateAvailable()) {
+            hostDynamicDao.updateUpdateAvailable(vds.getId(), updateAvailable);
+        }
     }
 
     private boolean isIsoCompatibleForUpgradeByClusterVersion(IsoData isoData) 
{


-- 
To view, visit https://gerrit.ovirt.org/40835
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9cf358ccfa986220cff871b02cf1b588495a086
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to