Export all VM names to CSV

[source]

IFS=$’,’

vmuuidlist=$(xe vm-list params=uuid is-control-domain=false –minimal)

for vmuuid in $vmuuidlist

do

vmname=$(xe vm-list params=name-label uuid=$vmuuid –minimal)

hostuuid=$(xe vm-list params=resident-on uuid=$vmuuid –minimal )

hostname=$(xe host-list params=name-label uuid=$hostuuid –minimal)

echo $vmname,$hostname

done > /tmp/vmlist.csv

[/source]

[source]
For a list of VMs in the pool:

xe vm-list | grep "name-label" | cut -d":" -f2 >> test_list.csv

For a list of hosts in the pool:

xe host-list | grep "name-label" | cut -d":" -f2 >> test_list.csv

[/source]

Leave a comment