mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Display image store disk size used and total disk size in (#4046)
list imagestore api response
This commit is contained in:
parent
b8ceb88ed9
commit
6bf3769c09
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user