This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.15 by this push:
new 1afcd82 server: Root disk size should be listed in GB at
listServiceOffering (#5085)
1afcd82 is described below
commit 1afcd823e004a744b8a613b99a2cf26051decb46
Author: Gabriel Beims Bräscher <[email protected]>
AuthorDate: Wed Jun 9 02:44:18 2021 -0300
server: Root disk size should be listed in GB at listServiceOffering (#5085)
* Root disk size should be listed in GB at listServiceOffering
* Update UI to handle rootdisk size in GB instead of Bytes
---
.../com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java | 10 +++++++++-
ui/src/components/view/DetailsTab.vue | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git
a/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
b/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
index 87b0374..9950b90 100644
---
a/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
+++
b/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
@@ -45,6 +45,13 @@ public class ServiceOfferingJoinDaoImpl extends
GenericDaoBase<ServiceOfferingJo
private SearchBuilder<ServiceOfferingJoinVO> sofIdSearch;
+ /**
+ * Constant used to convert GB into Bytes (or the other way around).
+ * GB * MB * KB = Bytes //
+ * 1024 * 1024 * 1024 = 1073741824
+ */
+ private static final long GB_TO_BYTES = 1073741824;
+
protected ServiceOfferingJoinDaoImpl() {
sofIdSearch = createSearchBuilder();
@@ -123,7 +130,8 @@ public class ServiceOfferingJoinDaoImpl extends
GenericDaoBase<ServiceOfferingJo
}
}
- offeringResponse.setRootDiskSize(offering.getRootDiskSize());
+ long rootDiskSizeInGb = (long) offering.getRootDiskSize() /
GB_TO_BYTES;
+ offeringResponse.setRootDiskSize(rootDiskSizeInGb);
return offeringResponse;
}
diff --git a/ui/src/components/view/DetailsTab.vue
b/ui/src/components/view/DetailsTab.vue
index 563acac..a9c5845 100644
--- a/ui/src/components/view/DetailsTab.vue
+++ b/ui/src/components/view/DetailsTab.vue
@@ -35,7 +35,7 @@
</div>
<div v-else-if="$route.meta.name === 'computeoffering' && item ===
'rootdisksize'">
<div>
- {{ parseFloat( resource.rootdisksize / (1024.0 * 1024.0 *
1024.0)).toFixed(1) }} GB
+ {{ resource.rootdisksize }} GB
</div>
</div>
<div v-else-if="['name', 'type'].includes(item)">