Skip to content

Instantly share code, notes, and snippets.

@rvanbutselaar
Last active June 6, 2019 09:04
Show Gist options
  • Save rvanbutselaar/eea2b1e0cda87d1a92090f7be5fceb51 to your computer and use it in GitHub Desktop.
Save rvanbutselaar/eea2b1e0cda87d1a92090f7be5fceb51 to your computer and use it in GitHub Desktop.
# detach volumes from server
openstack server show compute-1 -f value
for v in `cat volumes`; do openstack volume show $v; done
for v in `cat volumes`; do echo $v && openstack server remove volume compute-1 $v; done
# add security group
for s in `openstack server list -c Name -f value| grep "prod"`; do openstack server add security group $s allow-http; done
# list/show/delete available volumes
openstack volume list --status available -f value -c Name > available-vols.txt
for v in `cat available-vols.txt`; do
echo "----------------------------------------";
openstack volume show $v -c name -c status -c properties -c updated_at -f value | sed 's/kubernetes.io//g';
done
for v in `cat available-vols.txt`; do
echo "----------------------------------------";
openstack volume show $v -c name -c status -c properties -c updated_at -f value | sed 's/kubernetes.io//g';
read -p "removing volume.. Are you sure? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
openstack volume delete $v
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment