mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Skip older records which generate negative duration usage
This commit is contained in:
parent
4ac96d637c
commit
84c25f7025
@ -101,6 +101,11 @@ public class IPAddressUsageParser {
|
|||||||
IpAssignDate = startDate;
|
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)
|
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);
|
updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration);
|
||||||
|
|||||||
@ -98,6 +98,11 @@ public class LoadBalancerUsageParser {
|
|||||||
lbCreateDate = startDate;
|
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)
|
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);
|
updateLBUsageData(usageMap, key, usageLB.getId(), currentDuration);
|
||||||
|
|||||||
@ -99,6 +99,11 @@ public class NetworkOfferingUsageParser {
|
|||||||
noCreateDate = startDate;
|
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)
|
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);
|
updateNOUsageData(usageMap, key, usageNO.getVmInstanceId(), currentDuration);
|
||||||
|
|||||||
@ -98,6 +98,11 @@ public class PortForwardingUsageParser {
|
|||||||
pfCreateDate = startDate;
|
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)
|
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);
|
updatePFUsageData(usageMap, key, usagePF.getId(), currentDuration);
|
||||||
|
|||||||
@ -99,6 +99,11 @@ public class SecurityGroupUsageParser {
|
|||||||
sgCreateDate = startDate;
|
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)
|
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);
|
updateSGUsageData(usageMap, key, usageSG.getVmInstanceId(), currentDuration);
|
||||||
|
|||||||
@ -107,6 +107,11 @@ public class StorageUsageParser {
|
|||||||
storageCreateDate = startDate;
|
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)
|
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);
|
updateStorageUsageData(usageMap, key, usageStorage.getId(), currentDuration);
|
||||||
|
|||||||
@ -104,6 +104,11 @@ public class VMInstanceUsageParser {
|
|||||||
vmStartDate = startDate;
|
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)
|
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) {
|
switch (usageType) {
|
||||||
|
|||||||
@ -94,6 +94,11 @@ public class VPNUserUsageParser {
|
|||||||
vuCreateDate = startDate;
|
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)
|
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);
|
updateVUUsageData(usageMap, key, usageVU.getUserId(), currentDuration);
|
||||||
|
|||||||
@ -103,6 +103,11 @@ public class VolumeUsageParser {
|
|||||||
volCreateDate = startDate;
|
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)
|
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);
|
updateVolUsageData(usageMap, key, usageVol.getId(), currentDuration);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user