cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: updated refs/heads/master to 84c25f7
Date Wed, 07 Jan 2015 06:53:57 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 4ac96d637 -> 84c25f702


Skip older records which generate negative duration usage


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/84c25f70
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/84c25f70
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/84c25f70

Branch: refs/heads/master
Commit: 84c25f7025ca0eb22c8229d9e9cb7e987cffffbe
Parents: 4ac96d6
Author: Kishan Kavala <kishan@apache.org>
Authored: Thu Nov 20 17:34:44 2014 +0530
Committer: Kishan Kavala <kishan@apache.org>
Committed: Wed Jan 7 11:49:50 2015 +0530

----------------------------------------------------------------------
 usage/src/com/cloud/usage/parser/IPAddressUsageParser.java      | 5 +++++
 usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java   | 5 +++++
 .../src/com/cloud/usage/parser/NetworkOfferingUsageParser.java  | 5 +++++
 usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java | 5 +++++
 usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java  | 5 +++++
 usage/src/com/cloud/usage/parser/StorageUsageParser.java        | 5 +++++
 usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java     | 5 +++++
 usage/src/com/cloud/usage/parser/VPNUserUsageParser.java        | 5 +++++
 usage/src/com/cloud/usage/parser/VolumeUsageParser.java         | 5 +++++
 9 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
index adeff01..feee16b 100644
--- a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
@@ -101,6 +101,11 @@ public class IPAddressUsageParser {
                 IpAssignDate = startDate;
             }
 
+            if (IpAssignDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (IpReleaseDeleteDate.getTime() - IpAssignDate.getTime())
+ 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find
total number of millis to charge)
 
             updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
index 1b813b7..31ff97d 100644
--- a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
@@ -98,6 +98,11 @@ public class LoadBalancerUsageParser {
                 lbCreateDate = startDate;
             }
 
+            if (lbCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (lbDeleteDate.getTime() - lbCreateDate.getTime()) + 1;
// make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updateLBUsageData(usageMap, key, usageLB.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
index 4a5a1d2..e54cd53 100644
--- a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
@@ -99,6 +99,11 @@ public class NetworkOfferingUsageParser {
                 noCreateDate = startDate;
             }
 
+            if (noCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (noDeleteDate.getTime() - noCreateDate.getTime()) + 1;
// make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updateNOUsageData(usageMap, key, usageNO.getVmInstanceId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
index 37c7751..9abf8a7 100644
--- a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
@@ -98,6 +98,11 @@ public class PortForwardingUsageParser {
                 pfCreateDate = startDate;
             }
 
+            if (pfCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (pfDeleteDate.getTime() - pfCreateDate.getTime()) + 1;
// make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updatePFUsageData(usageMap, key, usagePF.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java b/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
index ea86d49..99d764d 100644
--- a/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
@@ -99,6 +99,11 @@ public class SecurityGroupUsageParser {
                 sgCreateDate = startDate;
             }
 
+            if (sgCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (sgDeleteDate.getTime() - sgCreateDate.getTime()) + 1;
// make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updateSGUsageData(usageMap, key, usageSG.getVmInstanceId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/StorageUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/StorageUsageParser.java b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
index f1091a1..fccd00c 100644
--- a/usage/src/com/cloud/usage/parser/StorageUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
@@ -107,6 +107,11 @@ public class StorageUsageParser {
                 storageCreateDate = startDate;
             }
 
+            if (storageCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (storageDeleteDate.getTime() - storageCreateDate.getTime())
+ 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find
total number of millis to charge)
 
             updateStorageUsageData(usageMap, key, usageStorage.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
index 684412f..8c30e99 100644
--- a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
@@ -104,6 +104,11 @@ public class VMInstanceUsageParser {
                 vmStartDate = startDate;
             }
 
+            if (vmStartDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (vmEndDate.getTime() - vmStartDate.getTime()) + 1; //
make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number
of millis to charge)
 
             switch (usageType) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java b/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
index 619c861..24997ec 100644
--- a/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
@@ -94,6 +94,11 @@ public class VPNUserUsageParser {
                 vuCreateDate = startDate;
             }
 
+            if (vuCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (vuDeleteDate.getTime() - vuCreateDate.getTime()) + 1;
// make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updateVUUsageData(usageMap, key, usageVU.getUserId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
index 81ebdc0..8e8c89c 100644
--- a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
@@ -103,6 +103,11 @@ public class VolumeUsageParser {
                 volCreateDate = startDate;
             }
 
+            if (volCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (volDeleteDate.getTime() - volCreateDate.getTime()) +
1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total
number of millis to charge)
 
             updateVolUsageData(usageMap, key, usageVol.getId(), currentDuration);


Mime
View raw message