VMware {code}

 View Only

 Seeking Solution for Automating NVIDIA GPU Passthrough to VMs via API

Hoang Bao's profile image
Hoang Bao posted May 07, 2025 03:48 AM

Hello VMware Community,

I am looking for a solution to automate the process of assigning (passthrough) NVIDIA GPU cards to Virtual Machines (VMs) on our VMware ESXi platform via API. Currently, we are doing this manually through the vCenter UI. However, with an increasing number of VMs, automating this process is crucial to save time and minimize human error.

Our Current Environment:

  • ESXi Version: 7.0 U3
  • vCenter Server Version: 7.0 U3
  • NVIDIA GPU Card Types: NVIDIA A100, NVIDIA T4, NVIDIA V100

Specific Requirements:

We aim to build a script or automated workflow capable of:

  1. Identifying available NVIDIA GPU cards on a specific ESXi host.
  2. Assigning one (or more) specified GPUs to a particular VM in Passthrough (DirectPath I/O) mode.
  3. Configuring the necessary PCI device settings on the VM to ensure the GPU functions correctly after being attached.
  4. (Optional) The ability to remove the GPU from the VM via API.

Questions:

  1. Has anyone successfully implemented a similar solution? If so, could you share your experiences, sample code (PowerCLI, Python with vSphere API, etc.), or detailed guidance?
  2. Are there any specific API endpoints or libraries within the vSphere API/SDK that we should focus on to address this issue?
  3. Are there any particular considerations or challenges when automating NVIDIA GPU passthrough compared to other PCI devices (e.g., driver issues, memory reservation configuration, etc.)?
  4. Are there any third-party tools or solutions that could assist with this?

Any help, suggestions, or guidance from the community would be highly appreciated.

Thank you very much!