XenServer Command Cheat Sheet
Whether you usually manage your XenServer VMs through Center or through the CLI, this XenServer Command Cheat Sheet can come in handy. This list contains all the commands I found myself using on a regular basis.
Replace any parts of code in <> with the value it asks for (removing the <> for the actual command)
Common Commands
- Find VM UUID
xe vm-list name-label=<**Name of VM**>
- Change memory (Note: The UUID of the VM does not need to be located, by appending
--minimalto the above command it returns just the UUID for <**Name of VM**>)
xe vm-memory-limits-set uuid=$(xe vm-list name-label=<**Name of VM**> --minimal) static-min=<**Lowest**>GiB dynamic-min=<**Lower**>GiB dynamic-max=<**Higher**>GiB static-max=<**Highest**>GiB
- Restart Xen services (memory balloon, xapi, xenopsd, etc - Useful if a lot of normal xen tasks aren't working properly [e.g booting VMs])
xe-toolstack-restart
- Find memory information for a VM
xe vm-param-list uuid=$(xe vm-list name-label=<**Name of VM**> --minimal) |grep " memory"
- Export a VM to xva file
xe vm-export vm=<**Name of VM**> filename=**/route/to/<Name of File>**.xva
- Import a VM from xva file
xe vm-import filename=**/route/to/<Name of File>**.xva
- Change name of VM
xe vm-param-set name-label=<**New Name of VM**> uuid=$(xe vm-list name-label=<**Name of VM**> --minimal)
- Change CPUs assigned to a VM
xe vm-param-set uuid=$(xe vm-list name-label=<**Name of VM**> --minimal) VCPUs-max=<**X**> VCPUs-at-startup=<**X**>
Complex Commands
- Print info about paramater for every VM on the server
for i in $(xe vm-list |grep uuid |awk '{print $5}') ; do echo -n "$(xe vm-list uuid=$i |grep name |awk '{print $4}'): " ; xe vm-param-list uuid=$i |grep <**paramater**> ; done