Shirly Radco has uploaded a new change for review.

Change subject: reports: br12 report - added comments to queries
......................................................................

reports: br12 report - added comments to queries

Changed the code structure so it will be more readable
and added commets.

Change-Id: I3b8b92e5eb2568e562221f00462c5d65c3545cb7
Signed-off-by: Shirly Radco <[email protected]>
---
M 
packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml.data
1 file changed, 40 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/58/27858/1

diff --git 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml.data
 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml.data
index ad79f06..3fcf2aa 100644
--- 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml.data
+++ 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml.data
@@ -1,26 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 5.5.0-->
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; 
name="cluster_host_resources_status_dr12" language="groovy" pageWidth="534" 
pageHeight="35" whenNoDataType="AllSectionsNoDetail" columnWidth="534" 
leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" 
resourceBundle="ovirt_reports_bundle" 
uuid="730ce376-1f59-480d-8a7c-12215324a377">
        <property name="ireport.zoom" value="1.0"/>
        <property name="ireport.x" value="0"/>
        <property name="ireport.y" value="0"/>
-       <property name="ireport.jasperserver.reportUnit" 
value="/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/cluster_host_resources_status_dr12"/>
-       <property name="ireport.jasperserver.url" 
value="http://localhost:8080/jasperserver-pro/services/repository"/>
-       <parameter name="P_Cluster_ID" class="java.lang.String">
-               <defaultValueExpression><![CDATA[]]></defaultValueExpression>
-       </parameter>
-       <queryString>
-               <![CDATA[SELECT 100 - (cpu_usage_percent_avg + 
memory_usage_percent_avg)/2 as average_resources_not_used
-FROM (SELECT AVG(cpu_usage_percent) AS cpu_usage_percent_avg,  
AVG(memory_usage_percent) AS memory_usage_percent_avg
-      FROM v3_5_statistics_hosts_resources_usage_samples
-           INNER JOIN v3_5_latest_configuration_hosts ON 
(v3_5_latest_configuration_hosts.host_id = 
v3_5_statistics_hosts_resources_usage_samples.host_id)
-      WHERE v3_5_statistics_hosts_resources_usage_samples.host_status = 1
-            AND v3_5_latest_configuration_hosts.cluster_id = 
cast($P{P_Cluster_ID} as UUID)) as average_resources]]>
+       <property name="ireport.jasperserver.url" 
value="http://localhost:8080/jasperserver-pro/"/>
+       <property name="ireport.jasperserver.report.resource" 
value="/reports_resources/embedded_reports/webadmin_dashboards/cluster_dashboard/jrxmls/cluster_host_resources_status_dr12_jrxml"/>
+       <parameter name="P_Cluster_ID" class="java.lang.String"/>
+       <queryString language="SQL">
+               <![CDATA[-- DR12 - This query returns the
+-- for the specific cluster the average
+-- resources that  are not used ( cpu and memory )
+
+SELECT
+    100 -
+    (
+        cpu_usage_percent_avg + memory_usage_percent_avg
+    ) /
+    2
+    AS average_resources_not_used
+FROM (
+    SELECT
+        AVG (
+            cpu_usage_percent
+        ) AS cpu_usage_percent_avg,
+        AVG (
+            memory_usage_percent
+        ) AS memory_usage_percent_avg
+    FROM v3_5_statistics_hosts_resources_usage_samples
+        INNER JOIN v3_5_latest_configuration_hosts
+            ON (
+                v3_5_latest_configuration_hosts.host_id =
+                v3_5_statistics_hosts_resources_usage_samples.host_id
+            )
+    WHERE
+        -- Here we get only active hosts
+        v3_5_statistics_hosts_resources_usage_samples.host_status = 1
+        -- Here we filter by the cluster chosen by the user
+        AND v3_5_latest_configuration_hosts.cluster_id =
+        CAST ( $P{P_Cluster_ID} AS UUID )
+) AS average_resources]]>
        </queryString>
        <field name="average_resources_not_used" class="java.math.BigDecimal"/>
        <summary>
                <band height="35" splitType="Stretch">
                        <textField>
-                               <reportElement 
uuid="faa5baa3-2e42-4b86-b015-cfd58f990200" x="0" y="0" width="387" height="35" 
forecolor="#333333"/>
+                               <reportElement x="0" y="0" width="387" 
height="35" forecolor="#333333" uuid="faa5baa3-2e42-4b86-b015-cfd58f990200"/>
                                <textElement verticalAlignment="Middle" 
markup="html">
                                        <font fontName="SansSerif" size="15"/>
                                </textElement>
@@ -28,14 +53,14 @@
                                
<hyperlinkTooltipExpression><![CDATA["Calculates averages of CPU and memory 
percent for all hosts and averages the two values. Displays check mark if 
resources not used is over 60%, otherwise displays X mark.\nThis query is 
calculated from the host statistics samples view for the selected 
cluster."]]></hyperlinkTooltipExpression>
                        </textField>
                        <image>
-                               <reportElement 
uuid="8fcbd622-3fa2-4f8b-9b6a-cfcc2cdffe51" x="387" y="10" width="17" 
height="15">
+                               <reportElement x="387" y="10" width="17" 
height="15" uuid="8fcbd622-3fa2-4f8b-9b6a-cfcc2cdffe51">
                                        
<printWhenExpression><![CDATA[$F{average_resources_not_used} == null || 
$F{average_resources_not_used} >= 60]]></printWhenExpression>
                                </reportElement>
                                
<imageExpression><![CDATA["repo:/reports_resources/check-mark.jpg"]]></imageExpression>
                                
<hyperlinkTooltipExpression><![CDATA["Calculates averages of CPU and memory 
percent for all hosts and averages the two values. Displays check mark if 
resources not used is over 60%, otherwise displays X mark.\nThis query is 
calculated from the host statistics samples view for the selected 
cluster."]]></hyperlinkTooltipExpression>
                        </image>
                        <image>
-                               <reportElement 
uuid="5ba996a3-c840-4034-827a-6ac7510a722f" x="387" y="10" width="17" 
height="15">
+                               <reportElement x="387" y="10" width="17" 
height="15" uuid="5ba996a3-c840-4034-827a-6ac7510a722f">
                                        
<printWhenExpression><![CDATA[$F{average_resources_not_used} != null && 
$F{average_resources_not_used} < 60]]></printWhenExpression>
                                </reportElement>
                                
<imageExpression><![CDATA["repo:/reports_resources/x-mark.jpg"]]></imageExpression>


-- 
To view, visit http://gerrit.ovirt.org/27858
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to