Shirly Radco has uploaded a new change for review.

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

reports: dr11 report - added comments to queries

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

Change-Id: I9d7ebe0b286ac74543945f99e776064e5068d847
Signed-off-by: Shirly Radco <sra...@redhat.com>
---
M 
packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml.data
1 file changed, 42 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/88/27888/1

diff --git 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml.data
 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml.data
index 4306ee7..0d4f97b 100644
--- 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml.data
+++ 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml.data
@@ -1,27 +1,53 @@
 <?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="dc_host_resources_status_dr11" language="groovy" pageWidth="534" 
pageHeight="35" columnWidth="534" leftMargin="0" rightMargin="0" topMargin="0" 
bottomMargin="0" resourceBundle="ovirt_reports_bundle" 
whenResourceMissingType="Error" uuid="3caf93da-a5f6-414d-9ea6-63e09888459c">
        <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/webadmin_dashboards/ce/datacenter_dashboard"/>
-       <property name="ireport.jasperserver.url" 
value="http://localhost:8080/jasperserver-pro/services/repository"/>
-       <parameter name="P_DataCenter_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)
-                      INNER JOIN v3_5_latest_configuration_clusters ON 
(v3_5_latest_configuration_clusters.cluster_id = 
v3_5_latest_configuration_hosts.cluster_id)
-      WHERE v3_5_statistics_hosts_resources_usage_samples.host_status = 1
-            AND v3_5_latest_configuration_clusters.datacenter_id = 
cast($P{P_DataCenter_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/dc_dashboard/jrxmls/dc_host_resources_status_dr11_jrxml"/>
+       <parameter name="P_DataCenter_ID" class="java.lang.String"/>
+       <queryString language="SQL">
+               <![CDATA[-- DR11 - This query returns the
+-- for the specific datacenter the average hosts
+-- 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
+            )
+        INNER JOIN v3_5_latest_configuration_clusters
+            ON (
+                v3_5_latest_configuration_clusters.cluster_id =
+                v3_5_latest_configuration_hosts.cluster_id
+            )
+    WHERE
+        -- Here we get only active hosts
+        v3_5_statistics_hosts_resources_usage_samples.host_status = 1
+        -- Here we filter by the datacenter chosen by the user
+        AND v3_5_latest_configuration_clusters.datacenter_id =
+        CAST ( $P{P_DataCenter_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="8d92428d-31cc-4b5e-8a99-dbba7db67ef2" x="0" y="0" width="375" height="35" 
forecolor="#333333"/>
+                               <reportElement x="0" y="0" width="375" 
height="35" forecolor="#333333" uuid="8d92428d-31cc-4b5e-8a99-dbba7db67ef2"/>
                                <textElement verticalAlignment="Middle" 
markup="html">
                                        <font fontName="SansSerif" size="15"/>
                                </textElement>
@@ -29,14 +55,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 
datacenter."]]></hyperlinkTooltipExpression>
                        </textField>
                        <image>
-                               <reportElement 
uuid="eaae8ca7-b4f2-4505-bd79-689fa1eb3eb2" x="375" y="10" width="17" 
height="15">
+                               <reportElement x="375" y="10" width="17" 
height="15" uuid="eaae8ca7-b4f2-4505-bd79-689fa1eb3eb2">
                                        
<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 
datacenter."]]></hyperlinkTooltipExpression>
                        </image>
                        <image>
-                               <reportElement 
uuid="ef6a0d5b-f292-4650-bb3a-3b9b4e7bbe19" x="375" y="10" width="17" 
height="15">
+                               <reportElement x="375" y="10" width="17" 
height="15" uuid="ef6a0d5b-f292-4650-bb3a-3b9b4e7bbe19">
                                        
<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/27888
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d7ebe0b286ac74543945f99e776064e5068d847
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-reports
Gerrit-Branch: master
Gerrit-Owner: Shirly Radco <sra...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to