Details
Description
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
Attachments
Issue Links
Activity
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419570623
<b>Trillian test result (tid-2988)</b>
Environment: vmware-65 (x2), Advanced Networking with Mgmt server 7
Total time taken: 31660 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2340-t2988-vmware-65.zip
Intermittent failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermittent failure detected: /marvin/tests/smoke/test_public_ip_range.py
Intermittent failure detected: /marvin/tests/smoke/test_templates.py
Intermittent failure detected: /marvin/tests/smoke/test_usage.py
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Smoke tests completed. 65 look OK, 4 have error(s)
Only failed tests results shown below:
Test | Result | Time (s) | Test File
— | — | — | —
ContextSuite context=TestDeployVirtioSCSIVM>:teardown | `Error` | 0.00 | test_deploy_virtio_scsi_vm.py
test_04_extract_template | `Failure` | 138.61 | test_templates.py
ContextSuite context=TestISOUsage>:setup | `Error` | 0.00 | test_usage.py
test_06_download_detached_volume | `Failure` | 162.07 | test_volumes.py
----------------------------------------------------------------
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:
users@infra.apache.org
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419420642
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + vmware-65) has been kicked to run smoke tests
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419420575
@blueorangutan test centos7 vmware-65
----------------------------------------------------------------
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:
users@infra.apache.org
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419418616
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2288
----------------------------------------------------------------
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:
users@infra.apache.org
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419412954
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-419412763
@blueorangutan package
----------------------------------------------------------------
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:
users@infra.apache.org
nitin-maharana commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-414639173
@rhtyd, I am sorry, somehow I missed your comment. Rebased against latest master. Thank You!
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-412791998
@nitin-maharana can you rebase against latest master, 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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-411304525
@nitin-maharana can you rebase against latest master, 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:
users@infra.apache.org
rhtyd commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r158919029
##########
File path: vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
##########
@@ -1184,4 +1206,261 @@ public ManagedObjectReference waitForPortGroup(String networkName, long timeOutM
}
return morNetwork;
}
+
+ public ManagedObjectReference getComputeResourceEnvironmentBrowser() throws Exception
+
+ public VirtualMachinePciPassthroughInfo getHostPciDeviceInfo(final String pciDeviceId) throws Exception {
+ VirtualMachinePciPassthroughInfo matchingPciPassthroughDevice = null;
+ ConfigTarget configTarget = _context.getService().queryConfigTarget(getComputeResourceEnvironmentBrowser(), _mor);
+ List<VirtualMachinePciPassthroughInfo> pciPassthroughDevices = configTarget.getPciPassthrough();
+ for (VirtualMachinePciPassthroughInfo pciPassthroughDevice : pciPassthroughDevices) {
+ HostPciDevice hostPciDevice = pciPassthroughDevice.getPciDevice();
+ if (pciDeviceId.equals(hostPciDevice.getId()))
+ }
+ return matchingPciPassthroughDevice;
+ }
+
+ public VirtualDevice prepareSharedPciPassthroughDevice(final String vGpuProfile)
+
+ public VirtualDevice prepareDirectPciPassthroughDevice(final VirtualMachinePciPassthroughInfo hostPciDeviceInfo)
+
+ public String getPciIdForAvailableDirectPciPassthroughDevice() throws Exception {
+ String pciId = "";
+ List<HostGraphicsInfo> hostGraphicsInfos = getHostGraphicsInfo();
+ for (HostGraphicsInfo hostGraphicsInfo : hostGraphicsInfos) {
+ if (GPU.GPUType.direct.toString().equalsIgnoreCase(hostGraphicsInfo.getGraphicsType())) {
+ List<ManagedObjectReference> vms = hostGraphicsInfo.getVm();
+ if (CollectionUtils.isEmpty(vms))
+ }
+ }
+ return pciId;
+ }
+
+ /**
+ * It updates the info of each vGPU type in the NVidia GRID K1/K2 Card.
+ * @param gpuCapacity (The output is stored in this)
+ * @param groupName - (NVIDIAGRID K1 or NVIDIAGRID K2)
+ * @param countGridKSharedGPUs (Number of Enabled shared GPUs)
+ * @param graphicsInfo (Info regarding the card)
+ * @param sharedPassthruGpuTypes (All the enabled vGPU types)
+ * @param gridKGPUMemory (Video RAM of each GPU in the card)
+ * @throws Exception
+ */
+ private void updateGpuCapacities(final HashMap<String, VgpuTypesInfo> gpuCapacity, final String groupName, final long countGridKSharedGPUs, final List<HostGraphicsInfo> graphicsInfo, final List<String> sharedPassthruGpuTypes, final long gridKGPUMemory) throws Exception {
+ /*
+ * 0 - grid_k100 or grid_k200
+ * 1 - grid_k120q or grid_k220q
+ * 2 - grid_k140q or grid_k240q
+ * 3 - grid_k160q or grid_k260q
+ * 4 - grid_k180q or grid_k280q
+ */
+ final long remainingCapacities[] = new long[5];
+
+ remainingCapacities[0] = 8l * countGridKSharedGPUs;
+ remainingCapacities[1] = 8l * countGridKSharedGPUs;
+ remainingCapacities[2] = 4l * countGridKSharedGPUs;
+ remainingCapacities[3] = 2l * countGridKSharedGPUs;
+ remainingCapacities[4] = countGridKSharedGPUs;
+
+ for (final HostGraphicsInfo graphicInfo : graphicsInfo) {
+ if (graphicInfo.getDeviceName().equals(groupName) && graphicInfo.getGraphicsType().equals("shared")) {
+ if (CollectionUtils.isNotEmpty(graphicInfo.getVm())) {
+ String vgpuType = "None";
+
+ for (ManagedObjectReference mor : graphicInfo.getVm()) {
+ final VirtualMachineMO vmMo = new VirtualMachineMO(_context, mor);
+
+ if (vgpuType.equals("None") && vmMo != null && vmMo.getConfigInfo() != null && vmMo.getConfigInfo().getHardware() != null) {
+ final List<VirtualDevice> devices = vmMo.getConfigInfo().getHardware().getDevice();
+
+ for (VirtualDevice device : devices) {
+ if (device instanceof VirtualPCIPassthrough) {
+ if (device.getBacking() != null && (device.getBacking() instanceof VirtualPCIPassthroughVmiopBackingInfo)) {
+ final VirtualPCIPassthroughVmiopBackingInfo backingInfo = (VirtualPCIPassthroughVmiopBackingInfo) device.getBacking();
+
+ if (backingInfo.getVgpu() != null)
+ }
+ }
+ }
+ }
+ }
+
+ // If GRID K1, then search for only K1 vGPU types. Same for GRID K2.
+ // The remaining capacity of one type affects other vGPU type capacity.
+ // Each GPU should always contain one type of vGPU VMs.
+ if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k100")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k200"))) {
Review comment:
@nitin-maharana my suggestion is around refactoring, all the ifs specific to a graphics card type/name could be wrapped to a class where the behavior settings/values could be moved. It will make it easier in future to add more graphics cards, maintain code etc.
----------------------------------------------------------------
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:
users@infra.apache.org
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_r158800362
##########
File path: vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
##########
@@ -1184,4 +1206,261 @@ public ManagedObjectReference waitForPortGroup(String networkName, long timeOutM
}
return morNetwork;
}
+
+ public ManagedObjectReference getComputeResourceEnvironmentBrowser() throws Exception
+
+ public VirtualMachinePciPassthroughInfo getHostPciDeviceInfo(final String pciDeviceId) throws Exception {
+ VirtualMachinePciPassthroughInfo matchingPciPassthroughDevice = null;
+ ConfigTarget configTarget = _context.getService().queryConfigTarget(getComputeResourceEnvironmentBrowser(), _mor);
+ List<VirtualMachinePciPassthroughInfo> pciPassthroughDevices = configTarget.getPciPassthrough();
+ for (VirtualMachinePciPassthroughInfo pciPassthroughDevice : pciPassthroughDevices) {
+ HostPciDevice hostPciDevice = pciPassthroughDevice.getPciDevice();
+ if (pciDeviceId.equals(hostPciDevice.getId()))
+ }
+ return matchingPciPassthroughDevice;
+ }
+
+ public VirtualDevice prepareSharedPciPassthroughDevice(final String vGpuProfile)
+
+ public VirtualDevice prepareDirectPciPassthroughDevice(final VirtualMachinePciPassthroughInfo hostPciDeviceInfo)
+
+ public String getPciIdForAvailableDirectPciPassthroughDevice() throws Exception {
+ String pciId = "";
+ List<HostGraphicsInfo> hostGraphicsInfos = getHostGraphicsInfo();
+ for (HostGraphicsInfo hostGraphicsInfo : hostGraphicsInfos) {
+ if (GPU.GPUType.direct.toString().equalsIgnoreCase(hostGraphicsInfo.getGraphicsType())) {
+ List<ManagedObjectReference> vms = hostGraphicsInfo.getVm();
+ if (CollectionUtils.isEmpty(vms))
+ }
+ }
+ return pciId;
+ }
+
+ /**
+ * It updates the info of each vGPU type in the NVidia GRID K1/K2 Card.
+ * @param gpuCapacity (The output is stored in this)
+ * @param groupName - (NVIDIAGRID K1 or NVIDIAGRID K2)
+ * @param countGridKSharedGPUs (Number of Enabled shared GPUs)
+ * @param graphicsInfo (Info regarding the card)
+ * @param sharedPassthruGpuTypes (All the enabled vGPU types)
+ * @param gridKGPUMemory (Video RAM of each GPU in the card)
+ * @throws Exception
+ */
+ private void updateGpuCapacities(final HashMap<String, VgpuTypesInfo> gpuCapacity, final String groupName, final long countGridKSharedGPUs, final List<HostGraphicsInfo> graphicsInfo, final List<String> sharedPassthruGpuTypes, final long gridKGPUMemory) throws Exception {
+ /*
+ * 0 - grid_k100 or grid_k200
+ * 1 - grid_k120q or grid_k220q
+ * 2 - grid_k140q or grid_k240q
+ * 3 - grid_k160q or grid_k260q
+ * 4 - grid_k180q or grid_k280q
+ */
+ final long remainingCapacities[] = new long[5];
+
+ remainingCapacities[0] = 8l * countGridKSharedGPUs;
+ remainingCapacities[1] = 8l * countGridKSharedGPUs;
+ remainingCapacities[2] = 4l * countGridKSharedGPUs;
+ remainingCapacities[3] = 2l * countGridKSharedGPUs;
+ remainingCapacities[4] = countGridKSharedGPUs;
+
+ for (final HostGraphicsInfo graphicInfo : graphicsInfo) {
+ if (graphicInfo.getDeviceName().equals(groupName) && graphicInfo.getGraphicsType().equals("shared")) {
+ if (CollectionUtils.isNotEmpty(graphicInfo.getVm())) {
+ String vgpuType = "None";
+
+ for (ManagedObjectReference mor : graphicInfo.getVm()) {
+ final VirtualMachineMO vmMo = new VirtualMachineMO(_context, mor);
+
+ if (vgpuType.equals("None") && vmMo != null && vmMo.getConfigInfo() != null && vmMo.getConfigInfo().getHardware() != null) {
+ final List<VirtualDevice> devices = vmMo.getConfigInfo().getHardware().getDevice();
+
+ for (VirtualDevice device : devices) {
+ if (device instanceof VirtualPCIPassthrough) {
+ if (device.getBacking() != null && (device.getBacking() instanceof VirtualPCIPassthroughVmiopBackingInfo)) {
+ final VirtualPCIPassthroughVmiopBackingInfo backingInfo = (VirtualPCIPassthroughVmiopBackingInfo) device.getBacking();
+
+ if (backingInfo.getVgpu() != null)
+ }
+ }
+ }
+ }
+ }
+
+ // If GRID K1, then search for only K1 vGPU types. Same for GRID K2.
+ // The remaining capacity of one type affects other vGPU type capacity.
+ // Each GPU should always contain one type of vGPU VMs.
+ if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k100")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k200"))) {
Review comment:
@rhtyd, I didn't get you properly. I guess you are saying to replace the multiple remainingCapacities assignments present in the if..else statement with a single assignment using index variable by matching the grid type. Am I correct?
Note:
Actually, the reason why I hardcoded those assignments because unlike XenServer, VMware doesn't provide libraries to get the remaining capacities of each vGPU type. To obtain that I used the VM size, which says how many VMs of the particular vGPU type present in the card. Accordingly, it reduces the capacity of each vGPU type(One vGPU type affects the capacity of other vGPU types).
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-353930286
@nitin-maharana I've left some remarks and I feel the code may be further refactored, 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:
users@infra.apache.org
rhtyd commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r158675087
##########
File path: vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
##########
@@ -1184,4 +1206,261 @@ public ManagedObjectReference waitForPortGroup(String networkName, long timeOutM
}
return morNetwork;
}
+
+ public ManagedObjectReference getComputeResourceEnvironmentBrowser() throws Exception
+
+ public VirtualMachinePciPassthroughInfo getHostPciDeviceInfo(final String pciDeviceId) throws Exception {
+ VirtualMachinePciPassthroughInfo matchingPciPassthroughDevice = null;
+ ConfigTarget configTarget = _context.getService().queryConfigTarget(getComputeResourceEnvironmentBrowser(), _mor);
+ List<VirtualMachinePciPassthroughInfo> pciPassthroughDevices = configTarget.getPciPassthrough();
+ for (VirtualMachinePciPassthroughInfo pciPassthroughDevice : pciPassthroughDevices) {
+ HostPciDevice hostPciDevice = pciPassthroughDevice.getPciDevice();
+ if (pciDeviceId.equals(hostPciDevice.getId()))
+ }
+ return matchingPciPassthroughDevice;
+ }
+
+ public VirtualDevice prepareSharedPciPassthroughDevice(final String vGpuProfile)
+
+ public VirtualDevice prepareDirectPciPassthroughDevice(final VirtualMachinePciPassthroughInfo hostPciDeviceInfo)
+
+ public String getPciIdForAvailableDirectPciPassthroughDevice() throws Exception {
+ String pciId = "";
+ List<HostGraphicsInfo> hostGraphicsInfos = getHostGraphicsInfo();
+ for (HostGraphicsInfo hostGraphicsInfo : hostGraphicsInfos) {
+ if (GPU.GPUType.direct.toString().equalsIgnoreCase(hostGraphicsInfo.getGraphicsType())) {
+ List<ManagedObjectReference> vms = hostGraphicsInfo.getVm();
+ if (CollectionUtils.isEmpty(vms))
+ }
+ }
+ return pciId;
+ }
+
+ /**
+ * It updates the info of each vGPU type in the NVidia GRID K1/K2 Card.
+ * @param gpuCapacity (The output is stored in this)
+ * @param groupName - (NVIDIAGRID K1 or NVIDIAGRID K2)
+ * @param countGridKSharedGPUs (Number of Enabled shared GPUs)
+ * @param graphicsInfo (Info regarding the card)
+ * @param sharedPassthruGpuTypes (All the enabled vGPU types)
+ * @param gridKGPUMemory (Video RAM of each GPU in the card)
+ * @throws Exception
+ */
+ private void updateGpuCapacities(final HashMap<String, VgpuTypesInfo> gpuCapacity, final String groupName, final long countGridKSharedGPUs, final List<HostGraphicsInfo> graphicsInfo, final List<String> sharedPassthruGpuTypes, final long gridKGPUMemory) throws Exception {
+ /*
+ * 0 - grid_k100 or grid_k200
+ * 1 - grid_k120q or grid_k220q
+ * 2 - grid_k140q or grid_k240q
+ * 3 - grid_k160q or grid_k260q
+ * 4 - grid_k180q or grid_k280q
+ */
+ final long remainingCapacities[] = new long[5];
+
+ remainingCapacities[0] = 8l * countGridKSharedGPUs;
+ remainingCapacities[1] = 8l * countGridKSharedGPUs;
+ remainingCapacities[2] = 4l * countGridKSharedGPUs;
+ remainingCapacities[3] = 2l * countGridKSharedGPUs;
+ remainingCapacities[4] = countGridKSharedGPUs;
+
+ for (final HostGraphicsInfo graphicInfo : graphicsInfo) {
+ if (graphicInfo.getDeviceName().equals(groupName) && graphicInfo.getGraphicsType().equals("shared")) {
+ if (CollectionUtils.isNotEmpty(graphicInfo.getVm())) {
+ String vgpuType = "None";
+
+ for (ManagedObjectReference mor : graphicInfo.getVm()) {
+ final VirtualMachineMO vmMo = new VirtualMachineMO(_context, mor);
+
+ if (vgpuType.equals("None") && vmMo != null && vmMo.getConfigInfo() != null && vmMo.getConfigInfo().getHardware() != null) {
+ final List<VirtualDevice> devices = vmMo.getConfigInfo().getHardware().getDevice();
+
+ for (VirtualDevice device : devices) {
+ if (device instanceof VirtualPCIPassthrough) {
+ if (device.getBacking() != null && (device.getBacking() instanceof VirtualPCIPassthroughVmiopBackingInfo)) {
+ final VirtualPCIPassthroughVmiopBackingInfo backingInfo = (VirtualPCIPassthroughVmiopBackingInfo) device.getBacking();
+
+ if (backingInfo.getVgpu() != null)
+ }
+ }
+ }
+ }
+ }
+
+ // If GRID K1, then search for only K1 vGPU types. Same for GRID K2.
+ // The remaining capacity of one type affects other vGPU type capacity.
+ // Each GPU should always contain one type of vGPU VMs.
+ if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k100")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k200")))
else if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k120q")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k220q")))
{ + remainingCapacities[0] -= 8l; + remainingCapacities[1] -= ((long) graphicInfo.getVm().size()); + remainingCapacities[2] -= 4l; + remainingCapacities[3] -= 2l; + remainingCapacities[4] -= 1l; + }else if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k140q")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k240q")))
{ + remainingCapacities[0] -= 8l; + remainingCapacities[1] -= 8l; + remainingCapacities[2] -= ((long) graphicInfo.getVm().size()); + remainingCapacities[3] -= 2l; + remainingCapacities[4] -= 1l; + }else if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k160q")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k260q")))
{ + remainingCapacities[0] -= 8l; + remainingCapacities[1] -= 8l; + remainingCapacities[2] -= 4l; + remainingCapacities[3] -= ((long)graphicInfo.getVm().size()); + remainingCapacities[4] -= 1l; + }else if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k180q")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k280q")))
{ + remainingCapacities[0] -= 8l; + remainingCapacities[1] -= 8l; + remainingCapacities[2] -= 4l; + remainingCapacities[3] -= 2l; + remainingCapacities[4] -= ((long)graphicInfo.getVm().size()); + }+ }
+ }
+ }
+
+ //Pattern.matches("grid_k100|grid_k1[2468]0[q]", gpuType)
+ for (final String gpuType : sharedPassthruGpuTypes) {
+ if ((groupName.equals("NVIDIAGRID K1") && gpuType.equals("grid_k100")) || (groupName.equals("NVIDIAGRID K2") && gpuType.equals("grid_k200"))) {
Review comment:
@nitin-maharana it's probably worth exploring refactoring each supported gfx card type as it's own class wrapping the behaviour of what gpuCapacity to put?
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r158675008
##########
File path: vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
##########
@@ -1184,4 +1206,261 @@ public ManagedObjectReference waitForPortGroup(String networkName, long timeOutM
}
return morNetwork;
}
+
+ public ManagedObjectReference getComputeResourceEnvironmentBrowser() throws Exception
+
+ public VirtualMachinePciPassthroughInfo getHostPciDeviceInfo(final String pciDeviceId) throws Exception {
+ VirtualMachinePciPassthroughInfo matchingPciPassthroughDevice = null;
+ ConfigTarget configTarget = _context.getService().queryConfigTarget(getComputeResourceEnvironmentBrowser(), _mor);
+ List<VirtualMachinePciPassthroughInfo> pciPassthroughDevices = configTarget.getPciPassthrough();
+ for (VirtualMachinePciPassthroughInfo pciPassthroughDevice : pciPassthroughDevices) {
+ HostPciDevice hostPciDevice = pciPassthroughDevice.getPciDevice();
+ if (pciDeviceId.equals(hostPciDevice.getId()))
+ }
+ return matchingPciPassthroughDevice;
+ }
+
+ public VirtualDevice prepareSharedPciPassthroughDevice(final String vGpuProfile)
+
+ public VirtualDevice prepareDirectPciPassthroughDevice(final VirtualMachinePciPassthroughInfo hostPciDeviceInfo)
+
+ public String getPciIdForAvailableDirectPciPassthroughDevice() throws Exception {
+ String pciId = "";
+ List<HostGraphicsInfo> hostGraphicsInfos = getHostGraphicsInfo();
+ for (HostGraphicsInfo hostGraphicsInfo : hostGraphicsInfos) {
+ if (GPU.GPUType.direct.toString().equalsIgnoreCase(hostGraphicsInfo.getGraphicsType())) {
+ List<ManagedObjectReference> vms = hostGraphicsInfo.getVm();
+ if (CollectionUtils.isEmpty(vms))
+ }
+ }
+ return pciId;
+ }
+
+ /**
+ * It updates the info of each vGPU type in the NVidia GRID K1/K2 Card.
+ * @param gpuCapacity (The output is stored in this)
+ * @param groupName - (NVIDIAGRID K1 or NVIDIAGRID K2)
+ * @param countGridKSharedGPUs (Number of Enabled shared GPUs)
+ * @param graphicsInfo (Info regarding the card)
+ * @param sharedPassthruGpuTypes (All the enabled vGPU types)
+ * @param gridKGPUMemory (Video RAM of each GPU in the card)
+ * @throws Exception
+ */
+ private void updateGpuCapacities(final HashMap<String, VgpuTypesInfo> gpuCapacity, final String groupName, final long countGridKSharedGPUs, final List<HostGraphicsInfo> graphicsInfo, final List<String> sharedPassthruGpuTypes, final long gridKGPUMemory) throws Exception {
+ /*
+ * 0 - grid_k100 or grid_k200
+ * 1 - grid_k120q or grid_k220q
+ * 2 - grid_k140q or grid_k240q
+ * 3 - grid_k160q or grid_k260q
+ * 4 - grid_k180q or grid_k280q
+ */
+ final long remainingCapacities[] = new long[5];
+
+ remainingCapacities[0] = 8l * countGridKSharedGPUs;
+ remainingCapacities[1] = 8l * countGridKSharedGPUs;
+ remainingCapacities[2] = 4l * countGridKSharedGPUs;
+ remainingCapacities[3] = 2l * countGridKSharedGPUs;
+ remainingCapacities[4] = countGridKSharedGPUs;
+
+ for (final HostGraphicsInfo graphicInfo : graphicsInfo) {
+ if (graphicInfo.getDeviceName().equals(groupName) && graphicInfo.getGraphicsType().equals("shared")) {
+ if (CollectionUtils.isNotEmpty(graphicInfo.getVm())) {
+ String vgpuType = "None";
+
+ for (ManagedObjectReference mor : graphicInfo.getVm()) {
+ final VirtualMachineMO vmMo = new VirtualMachineMO(_context, mor);
+
+ if (vgpuType.equals("None") && vmMo != null && vmMo.getConfigInfo() != null && vmMo.getConfigInfo().getHardware() != null) {
+ final List<VirtualDevice> devices = vmMo.getConfigInfo().getHardware().getDevice();
+
+ for (VirtualDevice device : devices) {
+ if (device instanceof VirtualPCIPassthrough) {
+ if (device.getBacking() != null && (device.getBacking() instanceof VirtualPCIPassthroughVmiopBackingInfo)) {
+ final VirtualPCIPassthroughVmiopBackingInfo backingInfo = (VirtualPCIPassthroughVmiopBackingInfo) device.getBacking();
+
+ if (backingInfo.getVgpu() != null)
+ }
+ }
+ }
+ }
+ }
+
+ // If GRID K1, then search for only K1 vGPU types. Same for GRID K2.
+ // The remaining capacity of one type affects other vGPU type capacity.
+ // Each GPU should always contain one type of vGPU VMs.
+ if ((groupName.equals("NVIDIAGRID K1") && vgpuType.equals("grid_k100")) || (groupName.equals("NVIDIAGRID K2") && vgpuType.equals("grid_k200"))) {
Review comment:
@nitin-maharana can you refactor this code by assigning the groupName against an index where `graphicInfo.getVm().size()` should be used instead of static/hard-coded `remainingCapacities` values.
----------------------------------------------------------------
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:
users@infra.apache.org
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-353090544
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1444
----------------------------------------------------------------
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:
users@infra.apache.org
blueorangutan commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-353080694
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-353080606
Re-review requested.
@blueorangutan package
----------------------------------------------------------------
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:
users@infra.apache.org
nitin-maharana commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-353078017
@rhtyd Done!!
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-352662115
@nitin-maharana can you address outstanding comments, then I can initiate testing for your PR.
----------------------------------------------------------------
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:
users@infra.apache.org
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-352662115
@nitin-maharana can you address outstanding comments, then I can initiate testing for you.
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153520500
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4766,6 +4848,31 @@ protected Answer execute(UnregisterNicCommand cmd) {
}
}
+ /**
+ * GetGPUStatsCommand is used to collect the GPU/vGPU details of all the
+ * GPU enabled hosts.
+ * Do Nothing.
+ * @param cmd
+ * @return Answer
+ */
+ protected Answer execute(final GetGPUStatsCommand cmd) {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
+
+ try {
+ groupDetails = hostMo.getGPUGroupDetails();
Review comment:
Yes this one. Then, you could do directly inside the Try/catch:
` HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = hostMo.getGPUGroupDetails()`
This would avoid the creation of a hashmap at line 4863 that is subsequently just dropped for the garbage collector.
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153520500
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4766,6 +4848,31 @@ protected Answer execute(UnregisterNicCommand cmd) {
}
}
+ /**
+ * GetGPUStatsCommand is used to collect the GPU/vGPU details of all the
+ * GPU enabled hosts.
+ * Do Nothing.
+ * @param cmd
+ * @return Answer
+ */
+ protected Answer execute(final GetGPUStatsCommand cmd) {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
+
+ try {
+ groupDetails = hostMo.getGPUGroupDetails();
Review comment:
Yes this one. Then, you could do directly inside the Try/catch:
` HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = hostMo.getGPUGroupDetails()`
This would avoid the creation of a hashmap that is subsequently just dropped for the garbage collector.
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153519413
##########
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
.
+ * @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)
+
+ pciPassthroughDevice = hostMo.prepareDirectPciPassthroughDevice(hostPciDeviceInfo);
+ } else
+
+ if (pciPassthroughDevice != null) {
Review comment:
Well, I understand the idea to code avoiding/deflecting null pointer exceptions. However, cases like this when it is not possible to happen a null pointer exception. I would not do the check/conditional; otherwise, it feels that for every time we use an object we would have to add a conditional checking if that object is a null value or not.
I would not force (suggest strongly) you to remove this because it does not harm the code, but I called your attention to this matter. I know that it might seem nice that we are deflecting null pointers, but if they do not happen at all, we are not deflecting anything
It is a personal choice (so the power is yours here).
----------------------------------------------------------------
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:
users@infra.apache.org
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_r153443468
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -5101,14 +5209,32 @@ private void fillHostNetworkInfo(VmwareContext serviceContext, StartupRoutingCom
}
}
- private void fillHostDetailsInfo(VmwareContext serviceContext, Map<String, String> details) throws Exception {
+ private void fillHostDetailsInfo(final Map<String, String> details) throws Exception {
VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
if (hyperHost.isHAEnabled())
{ details.put("NativeHA", "true"); }}
+ private void fillHostGpuInfo(final StartupRoutingCommand cmd) throws Exception {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ try {
+ final HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = hostMo.getGPUGroupDetails();
+ cmd.setGpuGroupDetails(groupDetails);
+ if (groupDetails != null && !groupDetails.isEmpty())
+ } catch (final Exception e) {
Review comment:
Sure. I will modify this.
----------------------------------------------------------------
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:
users@infra.apache.org
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_r153440683
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4766,6 +4848,31 @@ protected Answer execute(UnregisterNicCommand cmd) {
}
}
+ /**
+ * GetGPUStatsCommand is used to collect the GPU/vGPU details of all the
+ * GPU enabled hosts.
+ * Do Nothing.
+ * @param cmd
+ * @return Answer
+ */
+ protected Answer execute(final GetGPUStatsCommand cmd) {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
+
+ try {
+ groupDetails = hostMo.getGPUGroupDetails();
Review comment:
You mean this statement: return new GetGPUStatsAnswer(cmd, groupDetails);?
----------------------------------------------------------------
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:
users@infra.apache.org
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_r153436096
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -3348,9 +3404,35 @@ protected Answer execute(StopCommand cmd) {
// i.e., i-x-y. This is the internal VM name.
VmwareContext context = getServiceContext();
VmwareHypervisorHost hyperHost = getHyperHost(context);
+
try {
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
+
if (vmMo != null) {
Review comment:
Sure, I would do that.
----------------------------------------------------------------
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:
users@infra.apache.org
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
.
+ * @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)
+
+ pciPassthroughDevice = hostMo.prepareDirectPciPassthroughDevice(hostPciDeviceInfo);
+ } else
+
+ 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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153313840
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -5101,14 +5209,32 @@ private void fillHostNetworkInfo(VmwareContext serviceContext, StartupRoutingCom
}
}
- private void fillHostDetailsInfo(VmwareContext serviceContext, Map<String, String> details) throws Exception {
+ private void fillHostDetailsInfo(final Map<String, String> details) throws Exception {
VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
if (hyperHost.isHAEnabled())
{ details.put("NativeHA", "true"); }}
+ private void fillHostGpuInfo(final StartupRoutingCommand cmd) throws Exception {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ try {
+ final HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = hostMo.getGPUGroupDetails();
+ cmd.setGpuGroupDetails(groupDetails);
+ if (groupDetails != null && !groupDetails.isEmpty())
+ } catch (final Exception e) {
Review comment:
Can't we use a more specific exception here?
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153313658
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4766,6 +4848,31 @@ protected Answer execute(UnregisterNicCommand cmd) {
}
}
+ /**
+ * GetGPUStatsCommand is used to collect the GPU/vGPU details of all the
+ * GPU enabled hosts.
+ * Do Nothing.
+ * @param cmd
+ * @return Answer
+ */
+ protected Answer execute(final GetGPUStatsCommand cmd) {
+ final VmwareContext context = getServiceContext();
+ final VmwareHypervisorHost hyperHost = getHyperHost(context);
+ final HostMO hostMo = new HostMO(context, hyperHost.getMor());
+
+ HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
+
+ try {
+ groupDetails = hostMo.getGPUGroupDetails();
Review comment:
What about using the code of line 4873 right after this line?
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153313511
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4766,6 +4848,31 @@ protected Answer execute(UnregisterNicCommand cmd) {
}
}
+ /**
+ * GetGPUStatsCommand is used to collect the GPU/vGPU details of all the
+ * GPU enabled hosts.
+ * Do Nothing.
+ * @param cmd
Review comment:
These @param and @result without much description you remove them
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153313332
##########
File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -3348,9 +3404,35 @@ protected Answer execute(StopCommand cmd) {
// i.e., i-x-y. This is the internal VM name.
VmwareContext context = getServiceContext();
VmwareHypervisorHost hyperHost = getHyperHost(context);
+
try {
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
+
if (vmMo != null) {
Review comment:
What about extracting this code from 3411-3429 to a method? It might also be good to Document it, and write some unit test cases
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153313022
##########
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
.
+ * @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)
+
+ pciPassthroughDevice = hostMo.prepareDirectPciPassthroughDevice(hostPciDeviceInfo);
+ } else
+
+ if (pciPassthroughDevice != null) {
Review comment:
Is it possible for this `pciPassthroughDevice ` to be null after the previous IF/ELSE?
----------------------------------------------------------------
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:
users@infra.apache.org
rafaelweingartner commented on a change in pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340#discussion_r153312598
##########
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
.
+ * @param vmMo
Review comment:
@nitin-maharana I think that these @param without much explanations can be removed.
----------------------------------------------------------------
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:
users@infra.apache.org
nitin-maharana opened a new pull request #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMWare
URL: https://github.com/apache/cloudstack/pull/2340
Please refer the ticket for description and FS.
Ticket: CLOUDSTACK-10106(https://issues.apache.org/jira/browse/CLOUDSTACK-10106)
Note:
====
Currently, It supports NVIDIA GRID K1 & GRID K2 cards on ESXi 6.0 U2 and later version.
----------------------------------------------------------------
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:
users@infra.apache.org
Hi haijiao, I have created a PR with Tesla M60 card added in CloudStack. If you have NVIDIA Tesla M60 card available in the lab, please feel free to test the change and report the result.
PR: https://github.com/apache/cloudstack/pull/2339
Thanks,
Nitin
haijiao, Addition of new cards is under development. I will publish once it is finished. Thanks!
rhtyd commented on issue #2340: CLOUDSTACK-10106: GPU/vGPU Support on VMware
URL: https://github.com/apache/cloudstack/pull/2340#issuecomment-422342539
Test LGTM, but I think the code could be further refactored. I'm unable to find time to do that @nitin-maharana but please see parts of the code where you see several ifs-elses, see how you can improve that and also add more tests?
----------------------------------------------------------------
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:
users@infra.apache.org