exnetid=$(neutron net-list | awk '{if($4=="'ext-net'"){print $2;}}')
for i in `seq 1 10`; do
#boot vm, and create floating ip
nova boot --image cirros --flavor m1.tiny --nic net-id=$netzengfaid cirroszengfa${i}
cirroszengfaid[i]=$(nova list | awk '{if($4=="'cirroszengfa${i}'"){print $2;}}')
output=$(neutron floatingip-create $exnetid)
echo $output
floatipid[i]=$(echo "$output" | awk '{if($2=="id"){print $4;}}')
floatip[i]=$(echo "$output" | awk '{if($2=="floating_ip_address"){print $4;}}')a
done
# Setup router
neutron router-gateway-set $routerzengfaid $exnetid
neutron router-interface-add zengfa-router $subnetzengfaid
#wait for VM to be running
sleep 30
for i in `seq 1 10`; do
cirrosfix=$(nova list | awk '{if($4=="'cirroszengfa${i}'"){print $12;}}')
cirrosfixip=${cirrosfix#*=}
output=$(neutron port-list | grep ${cirrosfixip})
echo $output
portid=$(echo "$output" | awk '{print $2;}')
neutron floatingip-associate --fixed-ip-address $cirrosfixip ${floatipid[i]} $portid
neutron floatingip-delete ${floatipid[i]}
nova delete ${cirroszengfaid[i]}
done
Here is the script I run several times, I saw it happens once a while:
neutron net-create zengfa-net $(neutron net-list | awk '{if($4= ="'zengfa- net'"){ print $2;}}') $(neutron subnet-list | awk '{if($4= ="'zengfa- subnet' "){print $2;}}') $(neutron router-list | awk '{if($4= ="'zengfa- router' "){print $2;}}')
netzengfaid=
neutron subnet-create zengfa-net 10.100.100.0/24 --name zengfa-subnet
subnetzengfaid=
neutron router-create zengfa-router
routerzengfaid=
exnetid=$(neutron net-list | awk '{if($4= ="'ext- net'"){ print $2;}}') aid[i]= $(nova list | awk '{if($4= ="'cirroszengfa ${i}'") {print $2;}}') $(neutron floatingip-create $exnetid) i]=$(echo "$output" | awk '{if($2= ="id"){ print $4;}}') i]=$(echo "$output" | awk '{if($2= ="floating_ ip_address" ){print $4;}}')a
for i in `seq 1 10`; do
#boot vm, and create floating ip
nova boot --image cirros --flavor m1.tiny --nic net-id=$netzengfaid cirroszengfa${i}
cirroszengf
output=
echo $output
floatipid[
floatip[
done
# Setup router interface- add zengfa-router $subnetzengfaid
neutron router-gateway-set $routerzengfaid $exnetid
neutron router-
#wait for VM to be running
sleep 30
for i in `seq 1 10`; do $(nova list | awk '{if($4= ="'cirroszengfa ${i}'") {print $12;}}') =${cirrosfix# *=} $(neutron port-list | grep ${cirrosfixip}) associate --fixed-ip-address $cirrosfixip ${floatipid[i]} $portid d[i]}
cirrosfix=
cirrosfixip
output=
echo $output
portid=$(echo "$output" | awk '{print $2;}')
neutron floatingip-
neutron floatingip-delete ${floatipid[i]}
nova delete ${cirroszengfai
done
neutron router- interface- delete zengfa-router $subnetzengfaid gateway- clear zengfa-router $netzengfaid
neutron router-
neutron router-delete zengfa-router
neutron subnet-delete $subnetzengfaid
neutron net-delete $netzengfaid