This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new 189b0e4 CLOUDSTACK-10060: ListUsage API always displays the Virtual
size as '0' for Usage type=9 (snapshot) (#2257)
189b0e4 is described below
commit 189b0e4487c0caa0204b1dbb3cb5882ad2e7726e
Author: PranaliM <[email protected]>
AuthorDate: Thu Oct 12 18:17:18 2017 +0530
CLOUDSTACK-10060: ListUsage API always displays the Virtual size as '0' for
Usage type=9 (snapshot) (#2257)
Bug Description:
In the listUsage API, the Virtual Size of Snapshot is always displayed as
'0'.
Root Cause:
In case of snapshots, the usage is accounted for depending on the value of
the global parameter, 'usage.snapshot.virtualsize.select'. If set to 'true',
the usage calculation is done based on the Virtual Size, and if set to false,
it is done based on the Physical size. In the Usage API, this value, (i.e.
virtual or physical) is displayed as 'Size' field correctly, but the field
'VirtualSize' is always displayed as 0. This is misleading.
Expected Output:
Since this is a Usage API, ideally only that size should be displayed which
is used for billing, depending on the value of
'usage.snapshot.virtualsize.select'.
There is another API - the ListSnapshot API that displays both, the
physical as well as Virtual size and can be used to know both the sizes.
Fix Implemented:
Skipped showing the 'VirtualSize' Field for type=snapshot
---
usage/src/com/cloud/usage/parser/StorageUsageParser.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/usage/src/com/cloud/usage/parser/StorageUsageParser.java
b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
index fccd00c..03aa97b 100644
--- a/usage/src/com/cloud/usage/parser/StorageUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
@@ -181,8 +181,11 @@ public class StorageUsageParser {
usageDesc += "Snapshot ";
break;
}
- // Create the usage record
- usageDesc += "Id:" + storageId + " Size:" + size + "VirtualSize:" +
virtualSize;
+ //Create the usage record
+ usageDesc += "Id:" + storageId + " Size:" + size;
+ if (type != StorageTypes.SNAPSHOT) {
+ usageDesc += " VirtualSize:" + virtualSize;
+ }
//ToDo: get zone id
UsageVO usageRecord =
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].