I am adding a nvidia grid vGPU to a VM using the following code:
---- cut ----
var vGPUProfile = 'grid_m10-1b';
var deviceConfigSpec = new VcVirtualDeviceConfigSpec();
deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
deviceConfigSpec.device = new VcVirtualPCIPassthrough;
deviceConfigSpec.device.deviceInfo = new VcDescription;
deviceConfigSpec.device.deviceInfo.summary = '';
deviceConfigSpec.device.deviceInfo.label = 'New PCI device';
deviceConfigSpec.device.backing = new VcVirtualPCIPassthroughVmiopBackingInfo;
deviceConfigSpec.device.backing.vgpu = vGPUProfile;
var deviceConfigSpecs = new Array();
deviceConfigSpecs = deviceConfigSpec;
var configSpec = new VcVirtualMachineConfigSpec();
configSpec.changeVersion = vm.config.changeVersion;
configSpec.memoryReservationLockedToMax = true;
configSpec.deviceChange = deviceConfigSpecs;
task = vm.reconfigVM_Task(configSpec);
---- cut ----
In vRA the above workflow is triggered via EBS, the VM gets configured with the vGPU profiles. But fails to power-on with an error "exceeds max number of vGPU instances allowed". I believe the error message is misleading and the VM is failing to get powered on because the vGPU is getting added in a dedicated mode instead of shared mode.
Question is how do I ensure the vGPU being added is forced to be as a Shared-vGPU device? Or am I missing something?
I am replying to this question. Since after a bit of digging around. I realized that the Cluster did not have enough vGPU capacity to power on a VM. TO essential the below mentioned code works as expected.