Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dhajare.sh
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