I realize that I can modify the resources of a VM in the vsphere client by clicking modify settings -> resources -> CPU and then move the sliders for the Limit and Reservation.
What I need to be able to do is modify those values either through SSH or directly on the ESXi Host console.
I've already looked around online for this problem but everyone just points to the vSphere Client or web client to perform the action.
I'm using ESXi 5.5.0 in this case and I've been scouring the esxcli and vim-cmd arguments and documentation to no avail. I've also been looking at esxcfg commands and vmk commands as well.
I'm aware of pyVmomi as well though I haven't found a solution with this either.
Does anyone know of a way to set the CPU limit/reservation via the ESXi host command line tools or at the very least pyVmomi or even powercli if necessary.
You're looking to modify a VM's configuration spec with the reconfigure
method. The properties can be located in the ResourceAllocationInfo object: https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=/com.vmware.wssdk.apiref.doc/index.html&single=true
Here's a pyvmomi example to configure a memory reservation:
from task import WaitForTask
memReserve = vm.config.hardware.memoryMB * 2
spec = vim.vm.ConfigSpec()
spec.memoryAllocation = vim.ResourceAllocationInfo(reservation=memReserve)
WaitForTask(vm.Reconfigure(spec))
For PowerCLI, you can use the Set-VMResourceConfiguration
cmdlet: https://code.vmware.com/docs/7788/cmdlet-reference/doc/Set-VMResourceConfiguration.html