Managed OpenStack
Latest
List All Instances, Username, And Tenants in OpenStack Region
Problem
Obtain a complete list of instance names, tenant name, region name mapped to the corresponding username in an OpenStack region.
Environment
Platform9 Managed OpenStack - All Versions
OpenStack CLI
Procedure
Source the RC file for admin user of your environment.
$ source [your_rc_file].rc
Run the script on each region.
# Give +x permission to the script before executing.# Run this bash script on each region.echo -e "Instance_Name \t Region \t Username \t \t \t Tenant"for name in $(openstack server list --all -c ID -c Status -f value | awk '{if ($2 != "ERROR") print $1}' )dovm_name=$(openstack server show $name -c name -f value 2> /dev/null)if [[ $vm_name ]];thenUser_name=$(openstack user list | grep `openstack server show $name -c user_id -f value` | awk '{$1=$2=$3="";print $4}' | sed 's/|//g')tenant_name=$(openstack project show -f value -c name $(openstack server show $name -f value -c project_id))echo -e "${vm_name} \t ${OS_REGION_NAME} \t ${User_name} \t ${tenant_name}"fidone
The script output snippet:
# ./script.shInstance_Name Region Username Tenant[VM_NAME] [region] [username] [tenant]
Additional Information
Refer the OpenStack Documentation for more information on steps to install the OpenStack CLI and command line options.
Last updated on
Was this page helpful?
Frequently Asked Questions
Solution
How To
Internal Only
Templates
Powered by
