Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- tenantString=$1
- myInstances=""
- myImages=""
- mySnapshots=""
- myVolumes=""
- myFloatingIPs=""
- myGroups=""
- myKeypairs=""
- myNetworks=""
- mySubnets=""
- myRouters=""
- ##Start checking Instances (NOVA)
- instances=`nova list --all-tenants | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Instances"
- for instance in $instances;
- do
- echo -n "."
- tenI=`nova show $instance | grep $tenantString`
- if [[ ! -z $tenI ]]
- then
- myInstances+=" $instance"
- fi
- done
- echo "Done."
- ##Start checking Images (NOVA)
- images=`nova image-list | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Images"
- for image in $images;
- do
- echo -n "."
- # echo -n "$image"
- tenI=`nova image-show $image | grep $tenantString`
- if [[ ! -z $tenI ]]
- then
- myImages+=" $image"
- fi
- done
- echo "Done."
- ##Start checking Snapshots (CINDER)
- snapshots=`cinder snapshot-list --all-tenants | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Snapshots"
- for snapshot in $snapshots;
- do
- echo -n "."
- tenI=`cinder snapshot-show $snapshot | grep $tenantString`
- if [[ ! -z $tenI ]]
- then
- mySnapshots+=" $snapshot"
- fi
- done
- echo "Done."
- ##Start checking Volumes (CINDER)
- volumes=`cinder list --all-tenants | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Volumes"
- for volume in $volumes;
- do
- echo -n "."
- tenI=`cinder show $volume | grep $tenantString`
- if [[ ! -z $tenI ]]
- then
- myVolumes+=" $volume"
- fi
- done
- echo "Done."
- ##Check Sequrity: FloatingIPS
- ##Check Sequrity: Groups
- ##Check Sequrity: KeyPairs
- ##Check Quantum; networks
- nets=` quantum net-list | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Networks."
- for net in $nets;
- do
- echo -n "."
- tenN=`quantum net-show $net | grep tenant_id | grep $tenantString`
- if [[ ! -z $tenN ]]
- then
- myNetworks+=" $net"
- fi
- done
- echo "Done."
- ##Check Quantum; sub-nets
- snets=`quantum subnet-list | grep 'start' | awk 'BEGIN {FS = "|"}; {print $2}' | sort`
- echo "Checking sub-networks."
- for subnet in $snets;
- do
- echo -n "."
- tenSN=`quantum subnet-show $subnet | grep tenant_id | grep $tenantString`
- if [[ ! -z $tenSN ]]
- then
- mySubnets+=" $subnet"
- fi
- done
- echo "Done."
- ##Check Quantum; Routers
- routers=` quantum router-list | grep -v '\-\-' | awk 'BEGIN {FS = "|"}; { if (NR>1) { print $2;}}'| sort`
- echo "Checking Routers."
- for router in $routers;
- do
- echo -n "."
- tenR=`quantum router-show $router | grep tenant_id | grep $tenantString`
- if [[ ! -z $tenR ]]
- then
- myRouters+=" $router"
- fi
- done
- echo "Done."
- echo "Identified; for $tenantString"
- echo "Instances: $myInstances"
- echo "Images : $myImages"
- echo "Snapshots: $mySnapshots"
- echo "Volumes : $myVolumes"
- echo "Networks : $myNetworks"
- echo "Subnets : $mySubnets"
- echo "Routers : $myRouters"
Advertisement
Add Comment
Please, Sign In to add comment