Skip to content

Instantly share code, notes, and snippets.

@manuthu
Last active April 15, 2020 15:38
Show Gist options
  • Save manuthu/82936fbb01a0ddf69b71b1fb1a70e14f to your computer and use it in GitHub Desktop.
Save manuthu/82936fbb01a0ddf69b71b1fb1a70e14f to your computer and use it in GitHub Desktop.
A script to get all the running routers in a given storage pool in XEN.
# Get all running routers. Routers in cloudstack are prefixed with `r-DIGIT`
RUNNING_VMS=$(xe vm-list | grep -A2 -B2 'r-[0-9]' | grep uuid | awk -F':' '{print $2}')
SRID=8c269040-fc42-c12d-b091-8958784ec65e
for vm_id in $RUNNING_VMS
do
xe vbd-list vm-uuid=$vm_id | grep vdi-uuid | awk -F':' '{print $2}' | xargs -I {} xe vdi-list uuid={} | grep $SRID && echo $vm_id
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment