0

I've setup my VM as so:

enter image description here

Note: It's initial number of vCPU is 2

Later, I increase it but notice that there's no way to decrease it:

enter image description here

Question: Is there any way to change the current number of vCPUs while it's running via CLI?

I think one goal I have is to adjust this number based on the VMs overall CPU utilization. For instance, if this VM was relatively idle, I would want other VMs on the server to benefit from more vCPUs instead.

0

First you have to install the Linux/Windows API CLI for remote management How to install

Then you can use it from your Linux/Windows machine.

Once installed, you can get the UUID of the VM by name :

xe vm-list name-label=<vm_name>

Change the current VCPUs(should be lower than max Vcpus):

# No shutdown is needed for increasing
# Shutdown is needed for reducing
xe vm-param-set VCPUs-at-startup=<vcpus_no> uuid=<vm_uuid>

Change the maximum VCPUs:

# Shutdown is needed for both operations
xe vm-param-set VCPUs-max=<max_vcpus_no> uuid=<vm_uuid>
4
  • Interestingly, using xe vm-param-set VCPUs-at-startup does seem to let me reduce it but it does it seem to commit the property and change it. If I run that but then go to remote desktop and hit "save" then it seems to actually change it dynamically. Seems like an additional step is required after setting the at startup value. – Suhail Doshi Dec 20 '20 at 21:32
  • I see forgot to state that a shutdown is needed in order to reduce VCPUs number. I will update the answer. – Reda Salih Dec 20 '20 at 23:12
  • It's actually not! You can change the number using that command, then the dropdown in the UI changes! You can then lower the CPUs. It's almost like a bug that works. There must be another command to commit the new number even if it's lower. – Suhail Doshi Dec 20 '20 at 23:26
  • Weird, is Vpcu hotplug enabled in your case ? – Reda Salih Dec 20 '20 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.