Last active
August 29, 2015 14:15
-
-
Save ajayhn/a16b165014f1419f5a78 to your computer and use it in GitHub Desktop.
Creating scaled workload in parallel using neutron API
This file contains 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
#!/bin/bash | |
set -x | |
OS_TOKEN=$(keystone token-get | grep " id " | awk '{ print $4 }') | |
NEUTRON_URL=${NEUTRON_URL:-"http://10.84.25.29:9696/"} | |
NOVA_URL=${NOVA_URL:-"http://10.84.25.29:8774/v2/"} | |
TENANT_FLAG=${TENANT_FLAG:-''} | |
#net_id=a89ecda4-15ea-447e-a723-aa5da86a8135 #cassnet | |
net_id=a3274945-0b4d-4b68-a5a1-d90d7a811013 #zknet | |
net_num=1 | |
nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic net-id=${net_id} --num-instances=25 tmp1vm${net_num} & | |
#nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic net-id=${net_id} --num-instances=25 xscalevm${net_num} & | |
#nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic net-id=${net_id} --num-instances=25 xscalevm${net_num} & | |
#par_stride=200 | |
#for ((i=8201; i<8202; i+=${par_stride})); do | |
# for ((par=0; par<${par_stride}; par++)); do | |
# net_num=$(expr ${i} + ${par}) | |
# (date > /tmp/launch${net_num}; \ | |
# #net_id=$(neutron --os-token ${OS_TOKEN} --os-url ${NEUTRON_URL} net-create scalenet${net_num} ${TENANT_FLAG} | grep " id " | awk '{ print $4 }'); \ | |
# #echo ${net_id} > /tmp/netid-${net_num}; \ | |
# #sn_id=$(neutron --os-token ${OS_TOKEN} --os-url ${NEUTRON_URL} subnet-create ${TENANT_FLAG} ${net_id} 1.1.1.0/24 | grep " id " | awk '{ print $4 }'); \ | |
# #echo ${sn_id} > /tmp/snid-${net_num}; \ | |
# #port_id=$(neutron --os-token ${OS_TOKEN} --os-url ${NEUTRON_URL} port-create ${TENANT_FLAG} --name scaleport${net_num} ${net_id} | grep " id " | awk '{ print $4 }'); \ | |
# | |
# | |
# net_id=a89ecda4-15ea-447e-a723-aa5da86a8135 | |
# port_id=$(neutron --os-token ${OS_TOKEN} --os-url ${NEUTRON_URL} port-create ${TENANT_FLAG} --name scaleport${net_num} ${net_id} | grep " id " | awk '{ print $4 }'); \ | |
# echo ${port_id} > /tmp/portid-${net_num}; \ | |
# vm_id=$(nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic port-id=${port_id} xscalevm${net_num} | grep " id " | awk '{ print $4}'); \ | |
# echo ${vm_id} > /tmp/vmid-${net_num}; \ | |
# ) & | |
# | |
# #(net_id=$(cat /tmp/netid-${net_num}); \ | |
# # port_id=$(neutron --os-token ${OS_TOKEN} --os-url ${NEUTRON_URL} port-create --name scaleport${net_num} ${net_id} | grep " id " | awk '{ print $4 }'); \ | |
# # echo ${port_id} > /tmp/portid-${net_num}; \ | |
# # vm_id=$(nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic port-id=${port_id} xscalevm${net_num} | grep " id " | awk '{ print $4}'); \ | |
# # echo ${vm_id} > /tmp/vmid-${net_num}; \ | |
# #) & | |
# done | |
# #sleep 2 | |
#done | |
#par_stride=1 | |
#for ((i=8201; i<8211; i+=${par_stride})); do | |
# for ((par=0; par<${par_stride}; par++)); do | |
# vm_num=$(expr ${i} + ${par}) | |
# (port_id=$(cat /tmp/portid-${vm_num}); \ | |
# vm_id=$(nova --os-auth-token ${OS_TOKEN} boot --image cirros --flavor 1 --nic port-id=${port_id} xscalevm${vm_num} | grep " id " | awk '{ print $4}'); \ | |
# echo ${vm_id} > /tmp/vmid-${vm_num}; \ | |
# ) & | |
# done | |
# #sleep 2 | |
#done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment