This is an automated email from the ASF dual-hosted git repository. rohit 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 6bf3769 Display image store disk size used and total disk size in (#4046) 6bf3769 is described below commit 6bf3769c0987d578d068891e28fe2a5da466291a Author: Rakesh <rakeshv....@gmail.com> AuthorDate: Mon Jun 8 03:35:58 2020 +0200 Display image store disk size used and total disk size in (#4046) list imagestore api response --- .../cloudstack/api/response/ImageStoreResponse.java | 16 ++++++++++++++++ .../com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java index aaef652..fba9b2d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java @@ -60,6 +60,14 @@ public class ImageStoreResponse extends BaseResponse { @Param(description = "the scope of the image store") private ScopeType scope; + @SerializedName("disksizetotal") + @Param(description = "the total disk size of the host") + private Long diskSizeTotal; + + @SerializedName("disksizeused") + @Param(description = "the host's currently used disk size") + private Long diskSizeUsed; + public ImageStoreResponse() { } @@ -132,4 +140,12 @@ public class ImageStoreResponse extends BaseResponse { this.protocol = protocol; } + public void setDiskSizeTotal(Long diskSizeTotal) { + this.diskSizeTotal = diskSizeTotal; + } + + public void setDiskSizeUsed(Long diskSizeUsed) { + this.diskSizeUsed = diskSizeUsed; + } + } diff --git a/server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java index 7734489..2389b57 100644 --- a/server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java @@ -21,6 +21,8 @@ import java.util.List; import javax.inject.Inject; +import com.cloud.api.ApiDBUtils; +import com.cloud.storage.StorageStats; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -75,6 +77,12 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase<ImageStoreJoinVO, Long osResponse.setZoneId(ids.getZoneUuid()); osResponse.setZoneName(ids.getZoneName()); + StorageStats secStorageStats = ApiDBUtils.getSecondaryStorageStatistics(ids.getId()); + if (secStorageStats != null) { + osResponse.setDiskSizeTotal(secStorageStats.getCapacityBytes()); + osResponse.setDiskSizeUsed(secStorageStats.getByteUsed()); + } + osResponse.setObjectName("imagestore"); return osResponse; }