Skip to content

Instantly share code, notes, and snippets.

@ViKingIX
Created February 23, 2021 03:28
Show Gist options
  • Save ViKingIX/b8020e2e2e7e0bf4b18c570951ed9171 to your computer and use it in GitHub Desktop.
Save ViKingIX/b8020e2e2e7e0bf4b18c570951ed9171 to your computer and use it in GitHub Desktop.
list instance volumes using openstack client from bash
#!/bin/bash
for prj in $(jq -r .[] projects.json)
do
instance_uuids=$(openstack server list -f json --project $prj | jq -r ".[].ID")
for instance_uuid in $instance_uuids
do
instance_json=$(openstack server show $instance_uuid -f json)
echo $instance_json | jq '{uuid: .id, instance: ."OS-EXT-SRV-ATTR:instance_name", volumes: ."os-extended-volumes:volumes_attached"}'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment