Skip to content

Instantly share code, notes, and snippets.

@jbestell
jbestell / toggleIP.sh
Created November 15, 2016 20:37
Openstack: Use python-novaclient commands to disassociate/reassociate a floating IP with an instance to correct connectivity issues.
!/bin/bash
togglefloaterByUUID() {
floater=$(nova show $1 | grep network | awk -F "|" '{printf $3}' | awk -F ", " '{printf $NF}' | sed -e 's/ //g' | sed ':a;N;$!ba;s/\n/ /g');
if [ -z $floater ]; then
echo $1": No floating IP association found.";
else
name=$(nova show $1 | grep ' name ' | awk -F "|" '{printf $3}' | sed -e 's/ //g' | sed ':a;N;$!ba;s/\n/ /g');
echo "Dis-associating floating IP" $floater "from instance" $name "("$1")...";
nova flavor-list | grep True | awk -F "|" '{print "nova flavor-create --ephemeral 1 --swap 0 --rxtx-factor 1.0 --is-public True" $3 $2 $4 $5 $8";"}' | sed -e 's/ / /g'
@jbestell
jbestell / AZ1-938863.json
Last active December 15, 2015 11:49
HPCS Compute API Get Server Details - JSON
{ "server" : { "accessIPv4" : "",
"accessIPv6" : "",
"addresses" : { "private" : [ { "addr" : "10.4.66.99",
"version" : 4
},
{ "addr" : "15.185.113.156",
"version" : 4
}
] },
"config_drive" : "",