07 September 2012

Adjusting XenServer Dynamic Memory Minimum Limits

I needed to adjust the lower limit of a XenServer Guest Windows OSs to less than the template amount of 2048MB. When I did it through the GUI it just set it back up again. Then I found this useful post:
Adjusting XenServer Dynamic Memory Minimum Limits (lower than 1024MB) through XE CLI

The script didn't work for me on XenServer 6 but after a minor adjustment it ran. The adjustments were:

  • xe vm-memory-limits-set not xe vm-param-set
  • all done on one line
  • used different parameter names 'static-min' not 'memory-static-min'
  • included dynamic-max and static-max
  • satisfy the condition:  static-min <= dynamic-min=dynamic-max=static-max
However I did find my modified script set them all to the max, which wasn't what I wanted. I just manually set them after that and it worked.


function xe_param()
{
    PARAM=$1
    while read DATA; do
        LINE=$(echo $DATA | egrep "$PARAM")
        if [ $? -eq 0 ]; then
            echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
        fi
    done
}

for VM_UUID in $(xe vm-list is-control-domain=false power-state=halted | xe_param uuid); do
 VMName=$(xe vm-list uuid=$VM_UUID | xe_param name)
 echo "Now processing " $VMName
 xe vm-memory-limits-set uuid=$VM_UUID static-min=536870912 dynamic-min=8062GiB dynamic-max=8062GiB static-max=8062GiB
done

No comments:

Post a Comment