You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2014/04/09 14:47:56 UTC

git commit: updated refs/heads/4.4 to 127196e

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 68c80e28c -> 127196e95


CLOUDSTACK-6366: add vgpuTypes details  in vgpu_types table.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/127196e9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/127196e9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/127196e9

Branch: refs/heads/4.4
Commit: 127196e95d863247e6e22c427ee241d4bd5146d3
Parents: 68c80e2
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Mon Apr 7 11:07:55 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Wed Apr 9 18:22:06 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/VgpuTypesInfo.java  | 79 +++++++++++++++++
 api/src/com/cloud/agent/api/to/GPUDeviceTO.java | 11 ++-
 .../com/cloud/agent/api/GetGPUStatsAnswer.java  |  6 +-
 .../cloud/agent/api/StartupRoutingCommand.java  |  6 +-
 .../src/com/cloud/resource/ResourceManager.java |  5 +-
 .../schema/src/com/cloud/gpu/VGPUTypesVO.java   | 91 ++++++++++++++++++--
 .../src/com/cloud/gpu/dao/VGPUTypesDao.java     |  3 +-
 .../src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java | 20 +++--
 engine/schema/src/com/cloud/host/HostVO.java    |  7 +-
 .../src/com/cloud/host/dao/HostDaoImpl.java     |  3 +-
 .../xen/resource/CitrixResourceBase.java        |  5 +-
 .../xen/resource/XenServer620SP1Resource.java   | 29 ++++---
 .../com/cloud/resource/ResourceManagerImpl.java |  5 +-
 server/src/com/cloud/server/StatsCollector.java |  3 +-
 .../cloud/resource/MockResourceManagerImpl.java |  5 +-
 setup/db/db/schema-430to440.sql                 |  8 +-
 16 files changed, 234 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/api/src/com/cloud/agent/api/VgpuTypesInfo.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VgpuTypesInfo.java b/api/src/com/cloud/agent/api/VgpuTypesInfo.java
new file mode 100644
index 0000000..e59d8a6
--- /dev/null
+++ b/api/src/com/cloud/agent/api/VgpuTypesInfo.java
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.package com.cloud.agent.api;
+public class VgpuTypesInfo {
+
+    private String modelName;
+    private Long maxHeads;
+    private Long videoRam;
+    private Long maxResolutionX;
+    private Long maxResolutionY;
+    private Long maxVgpuPerGpu;
+    private Long remainingCapacity;
+    private Long maxCapacity;
+
+    public String getModelName() {
+        return modelName;
+    }
+
+    public Long getVideoRam() {
+        return videoRam;
+    }
+
+    public Long getMaxHeads() {
+        return maxHeads;
+    }
+
+    public Long getMaxResolutionX() {
+        return maxResolutionX;
+    }
+
+    public Long getMaxResolutionY() {
+        return maxResolutionY;
+    }
+
+    public Long getMaxVpuPerGpu() {
+        return maxVgpuPerGpu;
+    }
+
+    public Long getRemainingCapacity() {
+        return remainingCapacity;
+    }
+
+    public void setRemainingCapacity(Long remainingCapacity) {
+        this.remainingCapacity = remainingCapacity;
+    }
+
+    public Long getMaxCapacity() {
+        return maxCapacity;
+    }
+
+    public void setMaxVmCapacity(Long maxCapacity) {
+        this.maxCapacity = maxCapacity;
+    }
+
+    public VgpuTypesInfo(String modelName, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY, Long maxVgpuPerGpu,
+            Long remainingCapacity, Long maxCapacity) {
+        this.modelName = modelName;
+        this.videoRam = videoRam;
+        this.maxHeads = maxHeads;
+        this.maxResolutionX = maxResolutionX;
+        this.maxResolutionY = maxResolutionY;
+        this.maxVgpuPerGpu = maxVgpuPerGpu;
+        this.remainingCapacity = remainingCapacity;
+        this.maxCapacity = maxCapacity;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/GPUDeviceTO.java b/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
index 8bc9e52..4afe080 100644
--- a/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
+++ b/api/src/com/cloud/agent/api/to/GPUDeviceTO.java
@@ -18,13 +18,15 @@ package com.cloud.agent.api.to;
 
 import java.util.HashMap;
 
+import com.cloud.agent.api.VgpuTypesInfo;
+
 public class GPUDeviceTO {
 
     private String gpuGroup;
     private String vgpuType;
-    private HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
+    private HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
 
-    public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap<String, HashMap<String, Long>> groupDetails) {
+    public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         this.gpuGroup = gpuGroup;
         this.vgpuType = vgpuType;
         this.groupDetails = groupDetails;
@@ -46,11 +48,12 @@ public class GPUDeviceTO {
         this.vgpuType = vgpuType;
     }
 
-    public HashMap<String, HashMap<String, Long>> getGroupDetails() {
+    public HashMap<String, HashMap<String, VgpuTypesInfo>> getGroupDetails() {
         return groupDetails;
     }
 
-    public void setGroupDetails(HashMap<String, HashMap<String, Long>> groupDetails) {
+    public void setGroupDetails(HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         this.groupDetails = groupDetails;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java b/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java
index 566eed5..583326b 100644
--- a/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java
+++ b/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java
@@ -23,14 +23,14 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
 @LogLevel(Log4jLevel.Trace)
 public class GetGPUStatsAnswer extends Answer {
 
-    private HashMap<String, HashMap<String, Long>> groupDetails;
+    private HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails;
 
-    public GetGPUStatsAnswer(GetGPUStatsCommand cmd, HashMap<String, HashMap<String, Long>> groupDetails) {
+    public GetGPUStatsAnswer(GetGPUStatsCommand cmd, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         super(cmd);
         this.groupDetails = groupDetails;
     }
 
-    public HashMap<String, HashMap<String, Long>> getGroupDetails() {
+    public HashMap<String, HashMap<String, VgpuTypesInfo>> getGroupDetails() {
         return this.groupDetails;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/core/src/com/cloud/agent/api/StartupRoutingCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/StartupRoutingCommand.java b/core/src/com/cloud/agent/api/StartupRoutingCommand.java
index dc37113..52814ea 100755
--- a/core/src/com/cloud/agent/api/StartupRoutingCommand.java
+++ b/core/src/com/cloud/agent/api/StartupRoutingCommand.java
@@ -70,7 +70,7 @@ public class StartupRoutingCommand extends StartupCommand {
     HypervisorType hypervisorType;
     Map<String, String> hostDetails; //stuff like host os, cpu capabilities
     String hypervisorVersion;
-    HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
+    HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
 
     public StartupRoutingCommand() {
         super(Host.Type.Routing);
@@ -246,11 +246,11 @@ public class StartupRoutingCommand extends StartupCommand {
         this._hostVmStateReport = hostVmStateReport;
     }
 
-    public  HashMap<String, HashMap<String, Long>> getGpuGroupDetails() {
+    public  HashMap<String, HashMap<String, VgpuTypesInfo>> getGpuGroupDetails() {
         return groupDetails;
     }
 
-    public void setGpuGroupDetails(HashMap<String, HashMap<String, Long>> groupDetails) {
+    public void setGpuGroupDetails(HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         this.groupDetails = groupDetails;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/components-api/src/com/cloud/resource/ResourceManager.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/resource/ResourceManager.java b/engine/components-api/src/com/cloud/resource/ResourceManager.java
index 052c250..4f43adb 100755
--- a/engine/components-api/src/com/cloud/resource/ResourceManager.java
+++ b/engine/components-api/src/com/cloud/resource/ResourceManager.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.to.GPUDeviceTO;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
@@ -180,12 +181,12 @@ public interface ResourceManager extends ResourceService {
      * @param hostId, the dest host Id
      * @param groupDetails, capacity of GPU group.
      */
-    void updateGPUDetails(long hostId, HashMap<String, HashMap<String, Long>> groupDetails);
+    void updateGPUDetails(long hostId, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails);
 
     /**
      * Get GPU details for a host
      * @param host, the Host object
      * @return Details of groupNames and enabled VGPU type with remaining capacity.
      */
-    HashMap<String, HashMap<String, Long>> getGPUStatistics(HostVO host);
+    HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUStatistics(HostVO host);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java b/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java
index 586a0c9..fa6674c 100644
--- a/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java
+++ b/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java
@@ -33,22 +33,55 @@ public class VGPUTypesVO implements InternalIdentity {
     @Column(name="id")
     private long id;
 
+    @Column(name="gpu_group_id")
+    private long gpuGroupId;
+
     @Column(name="vgpu_type")
     private String vgpuType;
 
-    @Column(name="gpu_group_id")
-    private long gpuGroupId;
+    @Column(name="video_ram")
+    private long videoRam;
+
+    @Column(name="max_heads")
+    private long maxHeads;
 
-    @Column(name="remaining_vm_capacity")
+    @Column(name="max_resolution_x")
+    private long maxResolutionX;
+
+    @Column(name="max_resolution_y")
+    private long maxResolutionY;
+
+    @Column(name="max_vgpu_per_pgpu")
+    private long maxVgpuPerPgpu;
+
+    @Column(name="remaining_capacity")
     private long remainingCapacity;
 
+    @Column(name="max_capacity")
+    private long maxCapacity;
+
     protected VGPUTypesVO() {
     }
 
-    public VGPUTypesVO(String vgpuType, long gpuGroupId, long remainingCapacity) {
-        this.vgpuType = vgpuType;
+    public VGPUTypesVO(long gpuGroupId, String vgpuType, long videoRam, long maxHeads, long maxResolutionX, long maxResolutionY, long maxVgpuPerPgpu,
+            long remainingCapacity, long maxCapacity) {
         this.gpuGroupId = gpuGroupId;
+        this.vgpuType = vgpuType;
+        this.videoRam = videoRam;
+        this.maxHeads = maxHeads;
+        this.maxResolutionX = maxResolutionX;
+        this.maxResolutionY = maxResolutionY;
+        this.maxVgpuPerPgpu = maxVgpuPerPgpu;
         this.remainingCapacity = remainingCapacity;
+        this.maxCapacity = maxCapacity;
+    }
+
+    public long getGpuGroupId() {
+        return gpuGroupId;
+    }
+
+    public void setGpuGroupId(long gpuGroupId) {
+        this.gpuGroupId = gpuGroupId;
     }
 
     public String getVgpuType() {
@@ -59,12 +92,44 @@ public class VGPUTypesVO implements InternalIdentity {
         this.vgpuType = vgpuType;
     }
 
-    public long getGpuGroupId() {
-        return gpuGroupId;
+    public long getVideoRam() {
+        return videoRam;
     }
 
-    public void setGpuGroupId(long gpuGroupId) {
-        this.gpuGroupId = gpuGroupId;
+    public void setVideoRam(long videoRam) {
+        this.videoRam = videoRam;
+    }
+
+    public long getMaxHeads() {
+        return maxHeads;
+    }
+
+    public void setMaxHeads(long maxHeads) {
+        this.maxHeads = maxHeads;
+    }
+
+    public long getMaxResolutionX() {
+        return maxResolutionX;
+    }
+
+    public void setMaxResolutionX(long maxResolutionX) {
+        this.maxResolutionX = maxResolutionX;
+    }
+
+    public long getMaxResolutionY() {
+        return maxResolutionY;
+    }
+
+    public void setMaxResolutionY(long maxResolutionY) {
+        this.maxResolutionY = maxResolutionY;
+    }
+
+    public long getMaxVgpuPerPgpu() {
+        return maxVgpuPerPgpu;
+    }
+
+    public void setMaxVgpuPerPgpu(long maxVgpuPerPgpu) {
+        this.maxVgpuPerPgpu = maxVgpuPerPgpu;
     }
 
     public long getRemainingCapacity() {
@@ -75,6 +140,14 @@ public class VGPUTypesVO implements InternalIdentity {
         this.remainingCapacity = remainingCapacity;
     }
 
+    public long getMaxCapacity() {
+        return maxCapacity;
+    }
+
+    public void setMaxCapacity(long maxCapacity) {
+        this.maxCapacity = maxCapacity;
+    }
+
     @Override
     public long getId() {
         return id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java
index 2872cfd..25f3085 100644
--- a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java
+++ b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java
@@ -19,6 +19,7 @@ package com.cloud.gpu.dao;
 import java.util.HashMap;
 import java.util.List;
 
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.gpu.VGPUTypesVO;
 import com.cloud.utils.db.GenericDao;
 
@@ -44,5 +45,5 @@ public interface VGPUTypesDao extends GenericDao<VGPUTypesVO, Long> {
   * @param hostId the host
   * @param groupDetails with enabled VGPU types
   */
- void persist(long hostId, HashMap<String, HashMap<String, Long>> groupDetails);
+ void persist(long hostId, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java
index 7cc83cc..81a1945 100644
--- a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java
+++ b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java
@@ -27,6 +27,7 @@ import javax.inject.Inject;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.gpu.HostGpuGroupsVO;
 import com.cloud.gpu.VGPUTypesVO;
 import com.cloud.utils.db.GenericDaoBase;
@@ -73,20 +74,23 @@ public class VGPUTypesDaoImpl extends GenericDaoBase<VGPUTypesVO, Long> implemen
     }
 
     @Override
-    public void persist(long hostId, HashMap<String, HashMap<String, Long>> groupDetails) {
-        Iterator<Entry<String, HashMap<String, Long>>> it1 = groupDetails.entrySet().iterator();
+    public void persist(long hostId, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
+        Iterator<Entry<String, HashMap<String, VgpuTypesInfo>>> it1 = groupDetails.entrySet().iterator();
         while (it1.hasNext()) {
-            Entry<String, HashMap<String, Long>> entry = it1.next();
+            Entry<String, HashMap<String, VgpuTypesInfo>> entry = it1.next();
             HostGpuGroupsVO gpuGroup = _hostGpuGroupsDao.findByHostIdGroupName(hostId, entry.getKey());
-            HashMap<String, Long> values = entry.getValue();
-            Iterator<Entry<String, Long>> it2 = values.entrySet().iterator();
+            HashMap<String, VgpuTypesInfo> values = entry.getValue();
+            Iterator<Entry<String, VgpuTypesInfo>> it2 = values.entrySet().iterator();
             while (it2.hasNext()) {
-                Entry<String, Long> record = it2.next();
+                Entry<String, VgpuTypesInfo> record = it2.next();
+                VgpuTypesInfo details = record.getValue();
                 VGPUTypesVO vgpuType = null;
                 if ((vgpuType = findByGroupIdVGPUType(gpuGroup.getId(), record.getKey())) == null) {
-                    persist(new VGPUTypesVO(record.getKey(), gpuGroup.getId(), record.getValue()));
+                    persist(new VGPUTypesVO(gpuGroup.getId(), record.getKey(), details.getVideoRam(), details.getMaxHeads(), details.getMaxResolutionX(),
+                            details.getMaxResolutionY(), details.getMaxVpuPerGpu(), details.getRemainingCapacity(), details.getMaxCapacity()));
                 } else {
-                    vgpuType.setRemainingCapacity(record.getValue());
+                    vgpuType.setRemainingCapacity(details.getRemainingCapacity());
+                    vgpuType.setMaxCapacity(details.getMaxCapacity());
                     update(vgpuType.getId(), vgpuType);
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/schema/src/com/cloud/host/HostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/HostVO.java b/engine/schema/src/com/cloud/host/HostVO.java
index 25cc954..4af8fb7 100755
--- a/engine/schema/src/com/cloud/host/HostVO.java
+++ b/engine/schema/src/com/cloud/host/HostVO.java
@@ -38,6 +38,7 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ResourceState;
 import com.cloud.storage.Storage.StoragePoolType;
@@ -156,7 +157,7 @@ public class HostVO implements Host {
 
     // This value is only for saving and current cannot be loaded.
     @Transient
-    HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
+    HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
 
     @Override
     public String getStorageIpAddressDeux() {
@@ -318,11 +319,11 @@ public class HostVO implements Host {
         this.hostTags = hostTags;
     }
 
-    public  HashMap<String, HashMap<String, Long>> getGpuGroupDetails() {
+    public  HashMap<String, HashMap<String, VgpuTypesInfo>> getGpuGroupDetails() {
         return groupDetails;
     }
 
-    public void setGpuGroups(HashMap<String, HashMap<String, Long>> groupDetails) {
+    public void setGpuGroups(HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         this.groupDetails = groupDetails;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
index 3a3bdf6..4d7e83d 100755
--- a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
+++ b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
@@ -34,6 +34,7 @@ import javax.persistence.TableGenerator;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.cluster.agentlb.HostTransferMapVO;
 import com.cloud.cluster.agentlb.dao.HostTransferMapDao;
 import com.cloud.dc.ClusterVO;
@@ -782,7 +783,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
     }
 
     protected void saveGpuRecords(HostVO host) {
-        HashMap<String, HashMap<String, Long>> groupDetails = host.getGpuGroupDetails();
+        HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = host.getGpuGroupDetails();
         if (groupDetails != null) {
             // Create/Update GPU group entries
             _hostGpuGroupsDao.persist(host.getId(), new ArrayList<String>(groupDetails.keySet()));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 91b265b..ebfdab6 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -114,6 +114,7 @@ import com.cloud.agent.api.UnPlugNicAnswer;
 import com.cloud.agent.api.UnPlugNicCommand;
 import com.cloud.agent.api.UpdateHostPasswordCommand;
 import com.cloud.agent.api.UpgradeSnapshotCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.VmStatsEntry;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
@@ -1340,7 +1341,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         return dynamicMinRam;
     }
 
-    protected HashMap<String, HashMap<String, Long>> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException {
+    protected HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException {
         return null;
     }
 
@@ -3665,7 +3666,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                                 s_logger.debug("VM " + vmName + " does not have GPU support.");
                             }
                             if (vGPUs != null && !vGPUs.isEmpty()) {
-                                HashMap<String, HashMap<String, Long>> groupDetails = getGPUGroupDetails(conn);
+                                HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = getGPUGroupDetails(conn);
                                 cmd.setGpuDevice(new GPUDeviceTO(null, null, groupDetails));
                             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
index 877d0cb..4f04961 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer620SP1Resource.java
@@ -34,6 +34,7 @@ import com.cloud.agent.api.GetGPUStatsAnswer;
 import com.cloud.agent.api.GetGPUStatsCommand;
 import com.cloud.agent.api.StartCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.to.GPUDeviceTO;
 import com.cloud.resource.ServerResource;
 import com.xensource.xenapi.Connection;
@@ -43,6 +44,7 @@ import com.xensource.xenapi.PGPU;
 import com.xensource.xenapi.Types.XenAPIException;
 import com.xensource.xenapi.VGPU;
 import com.xensource.xenapi.VGPUType;
+import com.xensource.xenapi.VGPUType.Record;
 import com.xensource.xenapi.VM;
 
 @Local(value=ServerResource.class)
@@ -65,7 +67,7 @@ public class XenServer620SP1Resource extends XenServer620Resource {
 
     protected GetGPUStatsAnswer execute(GetGPUStatsCommand cmd) {
         Connection conn = getConnection();
-        HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
+        HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
         try {
             groupDetails = getGPUGroupDetails(conn);
         } catch (Exception e) {
@@ -79,7 +81,7 @@ public class XenServer620SP1Resource extends XenServer620Resource {
     protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
         super.fillHostInfo(conn, cmd);
         try {
-            HashMap<String, HashMap<String, Long>> groupDetails = getGPUGroupDetails(conn);
+            HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = getGPUGroupDetails(conn);
             cmd.setGpuGroupDetails(groupDetails);
         } catch (Exception e) {
             if (s_logger.isDebugEnabled()) {
@@ -89,8 +91,8 @@ public class XenServer620SP1Resource extends XenServer620Resource {
     }
 
     @Override
-    protected HashMap<String, HashMap<String, Long>> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException {
-        HashMap<String, HashMap<String, Long>> groupDetails = new HashMap<String, HashMap<String, Long>>();
+    protected HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException {
+        HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
         Host host = Host.getByUuid(conn, _host.uuid);
         Set<PGPU> pgpus = host.getPGPUs(conn);
         Iterator<PGPU> iter = pgpus.iterator();
@@ -99,7 +101,7 @@ public class XenServer620SP1Resource extends XenServer620Resource {
             GPUGroup gpuGroup = pgpu.getGPUGroup(conn);
             Set<VGPUType> enabledVGPUTypes = gpuGroup.getEnabledVGPUTypes(conn);
             String groupName = gpuGroup.getNameLabel(conn);
-            HashMap<String, Long> gpuCapacity = new HashMap<String, Long>();
+            HashMap<String, VgpuTypesInfo> gpuCapacity = new HashMap<String, VgpuTypesInfo>();
             if (groupDetails.get(groupName) != null) {
                 gpuCapacity = groupDetails.get(groupName);
             }
@@ -108,13 +110,20 @@ public class XenServer620SP1Resource extends XenServer620Resource {
                 Iterator<VGPUType> it = enabledVGPUTypes.iterator();
                 while (it.hasNext()) {
                     VGPUType type = it.next();
-                    String modelName = type.getModelName(conn);
+                    Record record = type.getRecord(conn);
                     Long remainingCapacity = pgpu.getRemainingCapacity(conn, type);
-                    if (gpuCapacity.get(modelName) != null) {
-                        long newRemainingCapacity = gpuCapacity.get(modelName) + remainingCapacity;
-                        gpuCapacity.put(modelName, newRemainingCapacity);
+                    Long maxCapacity = pgpu.getSupportedVGPUMaxCapacities(conn).get(type);
+                    VgpuTypesInfo entry;
+                    if ((entry = gpuCapacity.get(record.modelName)) != null) {
+                        remainingCapacity += entry.getRemainingCapacity();
+                        maxCapacity += entry.getMaxCapacity();
+                        entry.setRemainingCapacity(remainingCapacity);
+                        entry.setMaxVmCapacity(maxCapacity);
+                        gpuCapacity.put(record.modelName, entry);
                     } else {
-                        gpuCapacity.put(modelName, remainingCapacity);
+                        VgpuTypesInfo vgpuTypeRecord = new VgpuTypesInfo(record.modelName, record.framebufferSize, record.maxHeads,
+                                record.maxResolutionX, record.maxResolutionY, maxCapacity, remainingCapacity, maxCapacity);
+                        gpuCapacity.put(record.modelName, vgpuTypeRecord);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 9f549e0..0f2ffc3 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -63,6 +63,7 @@ import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.agent.api.UnsupportedAnswer;
 import com.cloud.agent.api.UpdateHostPasswordCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.to.GPUDeviceTO;
 import com.cloud.agent.transport.Request;
 import com.cloud.api.ApiDBUtils;
@@ -2537,7 +2538,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     }
 
     @Override
-    public void updateGPUDetails(long hostId, HashMap<String, HashMap<String, Long>> groupDetails) {
+    public void updateGPUDetails(long hostId, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
         // Update GPU group capacity
         TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
@@ -2547,7 +2548,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     }
 
     @Override
-    public HashMap<String, HashMap<String, Long>> getGPUStatistics(HostVO host) {
+    public HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUStatistics(HostVO host) {
         Answer answer = _agentMgr.easySend(host.getId(), new GetGPUStatsCommand(host.getGuid(), host.getName()));
         if (answer != null && (answer instanceof UnsupportedAnswer)) {
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 50aa93c..29ace93 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -49,6 +49,7 @@ import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.GetStorageStatsCommand;
 import com.cloud.agent.api.HostStatsEntry;
 import com.cloud.agent.api.PerformanceMonitorCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.VmDiskStatsEntry;
 import com.cloud.agent.api.VmStatsEntry;
 import com.cloud.cluster.ManagementServerHostVO;
@@ -342,7 +343,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
                     gpuEnabledHosts = hosts;
                 }
                 for (HostVO host : gpuEnabledHosts) {
-                    HashMap<String, HashMap<String, Long>> groupDetails = _resourceMgr.getGPUStatistics(host);
+                    HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = _resourceMgr.getGPUStatistics(host);
                     if (groupDetails != null) {
                         _resourceMgr.updateGPUDetails(host.getId(), groupDetails);
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/server/test/com/cloud/resource/MockResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/resource/MockResourceManagerImpl.java b/server/test/com/cloud/resource/MockResourceManagerImpl.java
index 409e3a6..2646af0 100644
--- a/server/test/com/cloud/resource/MockResourceManagerImpl.java
+++ b/server/test/com/cloud/resource/MockResourceManagerImpl.java
@@ -36,6 +36,7 @@ import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
 
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.VgpuTypesInfo;
 import com.cloud.agent.api.to.GPUDeviceTO;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
@@ -576,12 +577,12 @@ public class MockResourceManagerImpl extends ManagerBase implements ResourceMana
     }
 
     @Override
-    public void updateGPUDetails(long hostId, HashMap<String, HashMap<String, Long>> deviceDetails) {
+    public void updateGPUDetails(long hostId, HashMap<String, HashMap<String, VgpuTypesInfo>> deviceDetails) {
         // TODO Auto-generated method stub
     }
 
     @Override
-    public HashMap<String, HashMap<String, Long>> getGPUStatistics(HostVO host) {
+    public HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUStatistics(HostVO host) {
         // TODO Auto-generated method stub
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/127196e9/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 1fdf41c..055b09d 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -738,7 +738,13 @@ CREATE TABLE `cloud`.`vgpu_types` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `gpu_group_id` bigint(20) unsigned NOT NULL,
   `vgpu_type` varchar(40) NOT NULL COMMENT 'vgpu type supported by this gpu group',
-  `remaining_vm_capacity` bigint(20) unsigned DEFAULT NULL COMMENT 'remaining vgpu can be created with this vgpu_type on the given gpu group',
+  `video_ram` bigint(20) unsigned DEFAULT NULL COMMENT 'video RAM for this vgpu type',
+  `max_heads` bigint(20) unsigned DEFAULT NULL COMMENT 'maximum displays per user',
+  `max_resolution_x` bigint(20) unsigned DEFAULT NULL COMMENT 'maximum X resolution per display',
+  `max_resolution_y` bigint(20) unsigned DEFAULT NULL COMMENT 'maximum Y resolution per display',
+  `max_vgpu_per_pgpu` bigint(20) unsigned DEFAULT NULL COMMENT 'max number of vgpus per physical gpu (pgpu)',
+  `remaining_capacity` bigint(20) unsigned DEFAULT NULL COMMENT 'remaining vgpu can be created with this vgpu_type on the given gpu group',
+  `max_capacity` bigint(20) unsigned DEFAULT NULL COMMENT 'maximum vgpu can be created with this vgpu_type on the given gpu group',
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_vgpu_types__gpu_group_id` FOREIGN KEY (`gpu_group_id`) REFERENCES `host_gpu_groups` (`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB CHARSET=utf8;