This post is the next in my ongoing series examining under documented commands in the excellent Xen Cloud Platform cloud computing system!
Today’s post is about using the params modifier and the minimal switch to return information about hosts, templates, or virtual machines.
The params modifier and the minimal switch are part of the host-list, template-list, and vm-list commands. You can get a list of params available by using host-params-list, template-params-list, or vm-params list, but if you want to get one specific param back, you must use *-list, not *-params-list.
For example, if we want the name label for a particular virtual machine, we would use xe vm-list params=name-label uuid=(uuid). This shows the response format of (param name):(param value) and this brings us to the second part.
If you’re writing scripts for xe (which it is well suited for), you typically only want the value returned, not the param name. In this case, finish the command with –minimal. This returns simply (param value), allowing you to use it without any extra string handling to separate the value from the name.