Export all VM names to CSV


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

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s