How-To Get Consolidate Size Information of all The Cinder Volumes Provisioned

Problem

Need to obtain the consolidated size of all the volumes provisioned in a Region for capacity planning.

Environment

  • Platform9 Managed OpenStack - All Versions.

  • Cinder

Procedure

  1. The following script can be used, it gives an option to either get only the size of the volumes in use or the size of the volumes created except the ones which are in the error state.

#!/bin/bashcalsize()  {    export volsize=0    for vol in $volumes    do      s=$(openstack volume show $vol -c size -f value)      volsize=$((volsize+s))    done    echo "Tatal volume size in Gb= $volsize"}echo " select from the below    1) in-use volume size    2) total size of the volumes created "read Selectioncase $Selection in1)  echo "##calculating size of the volumes in-use##"  export volumes=$(openstack volume list --all -f value | awk '{if($3 == "in-use" || $2 == "in-use") print $1}')  calsize;;2)    echo "##calculating size of all the volumes created and not in error state"    export volumes=$(openstack volume list --all -f value | awk '{if($2 != "error" && $3 != "error") print $1}')    calsize;;esac

Last updated