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 00000000000..e59d8a6c4d8 --- /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; + } +} diff --git a/api/src/com/cloud/agent/api/to/GPUDeviceTO.java b/api/src/com/cloud/agent/api/to/GPUDeviceTO.java index 8bc9e5229de..4afe080477b 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> groupDetails = new HashMap>(); + private HashMap> groupDetails = new HashMap>(); - public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap> groupDetails) { + public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap> groupDetails) { this.gpuGroup = gpuGroup; this.vgpuType = vgpuType; this.groupDetails = groupDetails; @@ -46,11 +48,12 @@ public class GPUDeviceTO { this.vgpuType = vgpuType; } - public HashMap> getGroupDetails() { + public HashMap> getGroupDetails() { return groupDetails; } - public void setGroupDetails(HashMap> groupDetails) { + public void setGroupDetails(HashMap> groupDetails) { this.groupDetails = groupDetails; } + } diff --git a/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java b/core/src/com/cloud/agent/api/GetGPUStatsAnswer.java index 566eed5ab63..583326b839a 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> groupDetails; + private HashMap> groupDetails; - public GetGPUStatsAnswer(GetGPUStatsCommand cmd, HashMap> groupDetails) { + public GetGPUStatsAnswer(GetGPUStatsCommand cmd, HashMap> groupDetails) { super(cmd); this.groupDetails = groupDetails; } - public HashMap> getGroupDetails() { + public HashMap> getGroupDetails() { return this.groupDetails; } } diff --git a/core/src/com/cloud/agent/api/StartupRoutingCommand.java b/core/src/com/cloud/agent/api/StartupRoutingCommand.java index dc371133861..52814eac9a9 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 hostDetails; //stuff like host os, cpu capabilities String hypervisorVersion; - HashMap> groupDetails = new HashMap>(); + HashMap> groupDetails = new HashMap>(); public StartupRoutingCommand() { super(Host.Type.Routing); @@ -246,11 +246,11 @@ public class StartupRoutingCommand extends StartupCommand { this._hostVmStateReport = hostVmStateReport; } - public HashMap> getGpuGroupDetails() { + public HashMap> getGpuGroupDetails() { return groupDetails; } - public void setGpuGroupDetails(HashMap> groupDetails) { + public void setGpuGroupDetails(HashMap> groupDetails) { this.groupDetails = groupDetails; } } diff --git a/engine/components-api/src/com/cloud/resource/ResourceManager.java b/engine/components-api/src/com/cloud/resource/ResourceManager.java index 052c2506f1e..4f43adb3f56 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> groupDetails); + void updateGPUDetails(long hostId, HashMap> groupDetails); /** * Get GPU details for a host * @param host, the Host object * @return Details of groupNames and enabled VGPU type with remaining capacity. */ - HashMap> getGPUStatistics(HostVO host); + HashMap> getGPUStatistics(HostVO host); } diff --git a/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java b/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java index 586a0c92798..fa6674c2c7e 100644 --- a/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java +++ b/engine/schema/src/com/cloud/gpu/VGPUTypesVO.java @@ -33,30 +33,47 @@ public class VGPUTypesVO implements InternalIdentity { @Column(name="id") private long id; - @Column(name="vgpu_type") - private String vgpuType; - @Column(name="gpu_group_id") private long gpuGroupId; - @Column(name="remaining_vm_capacity") + @Column(name="vgpu_type") + private String vgpuType; + + @Column(name="video_ram") + private long videoRam; + + @Column(name="max_heads") + private long maxHeads; + + @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.remainingCapacity = remainingCapacity; - } - - public String getVgpuType() { - return vgpuType; - } - - public void setVgpuType(String vgpuType) { 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() { @@ -67,6 +84,54 @@ public class VGPUTypesVO implements InternalIdentity { this.gpuGroupId = gpuGroupId; } + public String getVgpuType() { + return vgpuType; + } + + public void setVgpuType(String vgpuType) { + this.vgpuType = vgpuType; + } + + public long getVideoRam() { + return videoRam; + } + + 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() { return remainingCapacity; } @@ -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; diff --git a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDao.java index 2872cfda886..25f3085ed37 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 { * @param hostId the host * @param groupDetails with enabled VGPU types */ - void persist(long hostId, HashMap> groupDetails); + void persist(long hostId, HashMap> groupDetails); } diff --git a/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java b/engine/schema/src/com/cloud/gpu/dao/VGPUTypesDaoImpl.java index 7cc83cc9eb8..81a1945ac7e 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 implemen } @Override - public void persist(long hostId, HashMap> groupDetails) { - Iterator>> it1 = groupDetails.entrySet().iterator(); + public void persist(long hostId, HashMap> groupDetails) { + Iterator>> it1 = groupDetails.entrySet().iterator(); while (it1.hasNext()) { - Entry> entry = it1.next(); + Entry> entry = it1.next(); HostGpuGroupsVO gpuGroup = _hostGpuGroupsDao.findByHostIdGroupName(hostId, entry.getKey()); - HashMap values = entry.getValue(); - Iterator> it2 = values.entrySet().iterator(); + HashMap values = entry.getValue(); + Iterator> it2 = values.entrySet().iterator(); while (it2.hasNext()) { - Entry record = it2.next(); + Entry 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); } } diff --git a/engine/schema/src/com/cloud/host/HostVO.java b/engine/schema/src/com/cloud/host/HostVO.java index 25cc9544da2..4af8fb73d8f 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> groupDetails = new HashMap>(); + HashMap> groupDetails = new HashMap>(); @Override public String getStorageIpAddressDeux() { @@ -318,11 +319,11 @@ public class HostVO implements Host { this.hostTags = hostTags; } - public HashMap> getGpuGroupDetails() { + public HashMap> getGpuGroupDetails() { return groupDetails; } - public void setGpuGroups(HashMap> groupDetails) { + public void setGpuGroups(HashMap> groupDetails) { this.groupDetails = groupDetails; } diff --git a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java index 3a3bdf67b91..4d7e83de597 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 implements HostDao } protected void saveGpuRecords(HostVO host) { - HashMap> groupDetails = host.getGpuGroupDetails(); + HashMap> groupDetails = host.getGpuGroupDetails(); if (groupDetails != null) { // Create/Update GPU group entries _hostGpuGroupsDao.persist(host.getId(), new ArrayList(groupDetails.keySet())); 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 91b265ba86c..ebfdab62bf8 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> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException { + protected HashMap> 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> groupDetails = getGPUGroupDetails(conn); + HashMap> groupDetails = getGPUGroupDetails(conn); cmd.setGpuDevice(new GPUDeviceTO(null, null, groupDetails)); } 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 877d0cb401a..4f04961e357 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> groupDetails = new HashMap>(); + HashMap> groupDetails = new HashMap>(); 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> groupDetails = getGPUGroupDetails(conn); + HashMap> 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> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException { - HashMap> groupDetails = new HashMap>(); + protected HashMap> getGPUGroupDetails(Connection conn) throws XenAPIException, XmlRpcException { + HashMap> groupDetails = new HashMap>(); Host host = Host.getByUuid(conn, _host.uuid); Set pgpus = host.getPGPUs(conn); Iterator iter = pgpus.iterator(); @@ -99,7 +101,7 @@ public class XenServer620SP1Resource extends XenServer620Resource { GPUGroup gpuGroup = pgpu.getGPUGroup(conn); Set enabledVGPUTypes = gpuGroup.getEnabledVGPUTypes(conn); String groupName = gpuGroup.getNameLabel(conn); - HashMap gpuCapacity = new HashMap(); + HashMap gpuCapacity = new HashMap(); if (groupDetails.get(groupName) != null) { gpuCapacity = groupDetails.get(groupName); } @@ -108,13 +110,20 @@ public class XenServer620SP1Resource extends XenServer620Resource { Iterator 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); } } } diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index f8870dbb8ba..ac36aee02fb 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> groupDetails) { + public void updateGPUDetails(long hostId, HashMap> 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> getGPUStatistics(HostVO host) { + public HashMap> getGPUStatistics(HostVO host) { Answer answer = _agentMgr.easySend(host.getId(), new GetGPUStatsCommand(host.getGuid(), host.getName())); if (answer != null && (answer instanceof UnsupportedAnswer)) { return null; diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 50aa93cd5ee..29ace932026 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> groupDetails = _resourceMgr.getGPUStatistics(host); + HashMap> groupDetails = _resourceMgr.getGPUStatistics(host); if (groupDetails != null) { _resourceMgr.updateGPUDetails(host.getId(), groupDetails); } diff --git a/server/test/com/cloud/resource/MockResourceManagerImpl.java b/server/test/com/cloud/resource/MockResourceManagerImpl.java index 409e3a6d6c3..2646af079a6 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> deviceDetails) { + public void updateGPUDetails(long hostId, HashMap> deviceDetails) { // TODO Auto-generated method stub } @Override - public HashMap> getGPUStatistics(HostVO host) { + public HashMap> getGPUStatistics(HostVO host) { // TODO Auto-generated method stub return null; } diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index 34400d9ce47..72187c358cc 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;