[ https://issues.apache.org/jira/browse/CLOUDSTACK-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16268441#comment-16268441 ]
ASF GitHub Bot commented on CLOUDSTACK-10106: --------------------------------------------- nitin-maharana commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153434917 ########## File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java ########## @@ -2254,6 +2270,46 @@ protected void configureVideoCard(VirtualMachineMO vmMo, VirtualMachineTO vmSpec } } + /** + * Sets GPU card details to the one provided in detail vgpu.type (if provided) on {@code vmConfigSpec}. + * @param vmMo + * @param vmSpec + * @param vmConfigSpec + * @throws RuntimeFaultFaultMsg + * @throws Exception + */ + protected void configureGpuCard(final VirtualMachineMO vmMo, final VirtualMachineTO vmSpec, final VirtualMachineConfigSpec vmConfigSpec) throws Exception { + final String vGpuProfile = vmSpec.getGpuDevice().getVgpuType(); + + VirtualDevice pciPassthroughDevice = null; + HostMO hostMo = new HostMO(vmMo.getContext(), getHyperHost(vmMo.getContext()).getMor()); + + if (vGpuProfile.equalsIgnoreCase(GPU.GPUType.passthrough.toString())) { + // Fetch the available direct PCI graphics card available for allocation + String pciDeviceId = hostMo.getPciIdForAvailableDirectPciPassthroughDevice(); + VirtualMachinePciPassthroughInfo hostPciDeviceInfo = hostMo.getHostPciDeviceInfo(pciDeviceId); + + if (hostPciDeviceInfo == null) { + final String msg = "Unable to find free passthrough GPU to be allocated to VM. Please check the host hardware configuration."; + s_logger.error(msg); + throw new Exception(msg); + } + + pciPassthroughDevice = hostMo.prepareDirectPciPassthroughDevice(hostPciDeviceInfo); + } else { + pciPassthroughDevice = hostMo.prepareSharedPciPassthroughDevice(vGpuProfile); + } + + if (pciPassthroughDevice != null) { Review comment: @rafaelweingartner, I just cross-checked, It's not possible because we initialize the object in hostMo prepareDirectPciPassthroughDevice and prepareSharedPciPassthroughDevice If/Else statement. It's redundant but I feel it's safe to check. Do you want me to remove? Thanks!! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > GPU/vGPU Support on VMWare > -------------------------- > > Key: CLOUDSTACK-10106 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10106 > Project: CloudStack > Issue Type: New Feature > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API, UI, VMware > Affects Versions: 4.11.0.0 > Reporter: Nitin Kumar Maharana > Labels: VMWARE > Fix For: 4.11.0.0 > > > VMware has added support for NVIDIA GRID K1 and NVIDIA GRID K2 cards as well > as NVIDIA Tesla M6 and Tesla M60 cards. This feature allows CloudStack VMs on > ESXi hosts to use the GPU cards connected to it. Currently, it supports only > NVIDIA GRID K1 and K2 cards for CloudStack VMs. > Feature Specification: > https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74681765 -- This message was sent by Atlassian JIRA (v6.4.14#64029)