From 5e9b25bad07ec08968abbd17c80ba1baafc618ec Mon Sep 17 00:00:00 2001 From: Sanjay Tripathi Date: Thu, 10 Apr 2014 13:55:25 +0530 Subject: [PATCH] CLOUDSTACK-6373: listHost API response is not listing all the details of vgpuType. --- .../apache/cloudstack/api/ApiConstants.java | 6 ++ .../cloudstack/api/response/VgpuResponse.java | 59 +++++++++++++++---- .../cloud/api/query/dao/HostJoinDaoImpl.java | 8 ++- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index 08ab7af3105..70e19844202 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -591,7 +591,13 @@ public class ApiConstants { public static final String GPUGROUPNAME = "gpugroupname"; public static final String VGPU = "vgpu"; public static final String VGPUTYPE = "vgputype"; + public static final String VIDEORAM = "videoram"; + public static final String MAXHEADS = "maxheads"; + public static final String MAXRESOLUTIONX = "maxresolutionx"; + public static final String MAXRESOLUTIONY = "maxresolutiony"; + public static final String MAXVGPUPERPGPU = "maxvgpuperpgpu"; public static final String REMAININGCAPACITY = "remainingcapacity"; + public static final String MAXCAPACITY = "maxcapacity"; public static final String DISTRIBUTED_VPC_ROUTER = "distributedvpcrouter"; public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc"; public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet"; diff --git a/api/src/org/apache/cloudstack/api/response/VgpuResponse.java b/api/src/org/apache/cloudstack/api/response/VgpuResponse.java index 17e194be5b1..c51dc8d0f66 100644 --- a/api/src/org/apache/cloudstack/api/response/VgpuResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VgpuResponse.java @@ -29,24 +29,63 @@ public class VgpuResponse extends BaseResponse { @Param(description = "Model Name of vGPU") private String name; - @SerializedName(ApiConstants.REMAININGCAPACITY) - @Param(description = "No. of more VMs can be deployped with this vGPU type") - private Long capacity; + @SerializedName(ApiConstants.VIDEORAM) + @Param(description = "Video RAM for this vGPU type") + private Long videoRam; - public String getName() { - return name; - } + @SerializedName(ApiConstants.MAXHEADS) + @Param(description = "Maximum displays per user") + private Long maxHeads; + + @SerializedName(ApiConstants.MAXRESOLUTIONX) + @Param(description = "Maximum X resolution per display") + private Long maxResolutionX; + + @SerializedName(ApiConstants.MAXRESOLUTIONY) + @Param(description = "Maximum Y resolution per display") + private Long maxResolutionY; + + @SerializedName(ApiConstants.MAXVGPUPERPGPU) + @Param(description = "Maximum no. of vgpu per gpu card (pgpu)") + private Long maxVgpuPerPgpu; + + @SerializedName(ApiConstants.REMAININGCAPACITY) + @Param(description = "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type") + private Long remainingCapacity; + + @SerializedName(ApiConstants.MAXCAPACITY) + @Param(description = "Maximum vgpu can be created with this vgpu type on the given gpu group") + private Long maxCapacity; public void setName(String name) { this.name = name; } - public Long getCapacity() { - return capacity; + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; } - public void setCapacity(Long capacity) { - this.capacity = capacity; + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; } + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } + + public void setMaxVgpuPerPgpu(Long maxVgpuPerPgpu) { + this.maxVgpuPerPgpu = maxVgpuPerPgpu; + } + + public void setRemainingCapacity(Long remainingCapacity) { + this.remainingCapacity = remainingCapacity; + } + + public void setmaxCapacity(Long maxCapacity) { + this.maxCapacity = maxCapacity; + } } diff --git a/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java index 6c890fc830c..9a4b38efbb7 100644 --- a/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/HostJoinDaoImpl.java @@ -108,7 +108,13 @@ public class HostJoinDaoImpl extends GenericDaoBase implements for (VGPUTypesVO vgpuType : vgpuTypes) { VgpuResponse vgpuResponse = new VgpuResponse(); vgpuResponse.setName(vgpuType.getVgpuType()); - vgpuResponse.setCapacity(vgpuType.getRemainingCapacity()); + vgpuResponse.setVideoRam(vgpuType.getVideoRam()); + vgpuResponse.setMaxHeads(vgpuType.getMaxHeads()); + vgpuResponse.setMaxResolutionX(vgpuType.getMaxResolutionX()); + vgpuResponse.setMaxResolutionY(vgpuType.getMaxResolutionY()); + vgpuResponse.setMaxVgpuPerPgpu(vgpuType.getMaxVgpuPerPgpu()); + vgpuResponse.setRemainingCapacity(vgpuType.getRemainingCapacity()); + vgpuResponse.setmaxCapacity(vgpuType.getMaxCapacity()); vgpus.add(vgpuResponse); } gpuResponse.setVgpu(vgpus);