Last active
September 2, 2018 16:09
-
-
Save psachin/f31d3ec37348a5e94f09244762e92ef1 to your computer and use it in GitHub Desktop.
dhajare.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm file1.txt | |
for i in `openstack server list -f value -c Name`; do | |
SERVER_DETAIL=$(openstack server show inst2 -c created -c flavor -c project_id -f value | tr '\r\n' ' ') | |
created=$(echo $SERVER_DETAIL | awk '{print $1}') | |
flavor=$(echo $SERVER_DETAIL | awk '{print $2}') | |
project_id=$(echo $SERVER_DETAIL | awk '{print $4}') | |
FLAVOR_DETAIL=$(openstack flavor show $flavor -f value -c disk -c ram -c vcpus) | |
disk_size_gb=$(echo $FLAVOR_DETAIL | awk '{print $1}') | |
ram_mb=$(echo $FLAVOR_DETAIL | awk '{print $2}') | |
cpus=$(echo $FLAVOR_DETAIL | awk '{print $3}') | |
owner=$(openstack project show $project_id -c name -f value) | |
# echo Created: $created | |
# echo Instance name: $i | |
# echo Owner: ql_$owner | |
echo -e $i,$(echo ql_$owner | sed -e s/"ql_"//g),$created,$disk_size_gb,$cpus,$ram_mb,$project_id >> file1.txt | |
done | |
for i in `openstack server list -f value -c Name`; do | |
SERVER_DETAIL=$(openstack server show inst2 -c created -c flavor -c project_id -f value | tr '\r\n' ' ') | |
created=$(echo $SERVER_DETAIL | awk '{print $1}') | |
flavor=$(echo $SERVER_DETAIL | awk '{print $2}') | |
project_id=$(echo $SERVER_DETAIL | awk '{print $4}') | |
FLAVOR_DETAIL=$(openstack flavor show $flavor -f value -c disk -c ram -c vcpus) | |
disk_size_gb=$(echo $FLAVOR_DETAIL | awk '{print $1}') | |
ram_mb=$(echo $FLAVOR_DETAIL | awk '{print $2}') | |
cpus=$(echo $FLAVOR_DETAIL | awk '{print $3}') | |
owner=$(openstack project show $project_id -c name -f value) | |
echo Created: $created | |
echo Instance name: $i | |
echo Owner: ql_$owner | |
echo "sendmail $(echo ql_$owner | sed -e s/"ql_"//g)@redhat.com -s "remove vm"" | |
echo ======================= | |
done | |
for i in `openstack server list -f value -c Name`; do | |
echo $i $(openstack flavor show `openstack server show $i -c flavor -f value | awk '{print $1}'` -f value -c disk -c ram -c vcpus) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment