Saturday, February 14, 2015

New Script: XenServer VM Memory Management Bash Script


Once virtual desktops are deployed, you typically don't need to adjust the resources often for those VMs unless resource utilization has grown due to additions or some other reason. This happened recently with a customer. Their desktops needed a bit more RAM and there was some additional RAM added to the XenServer hosts. They requested my help and wanted to know the quickest and least impact method for adjusting the RAM allocation for each virtual desktop. Right away I thought of three ways of accomplishing this:

  1. Manually perform this feat.
  2. Update the template VM and re-deploy hundreds of desktops. Better than manually updating the RAM allocation, but still takes too much effort and time.
  3. Script it.

Obviously I chose door number 3 above. This was a quick script, but I built some logic into it as well as added logging. With this menu driven script, you can:

  • List all VMs in a XenServer pool with a specified static max setting.
  • Update memory on all VMs within a XenServer pool with a specified static max to a newly specified amount.
  • Preview the changes before making them.
After writing the script, I chose to run the script after-hours, as this script will only change memory on VMs that are shutdown. I ran the script and updated several hundred VMs in just a few minutes.


You can read more about this script and download it here.

This post was written in reference to the following platforms and versions:

  • XenServer 6.2


No comments:

Post a Comment