-
Notifications
You must be signed in to change notification settings - Fork 5
/
quota_openstack.sh
46 lines (37 loc) · 1.52 KB
/
quota_openstack.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#nova flavor-list|awk '/[0-9*]/{print $4}'
#nova-manage network list
#nova-manage network delete 183.134.101.128/27
#nova network-create upnet --bridge=br100 --multi-host=T --fixed-range-v4=158.118.218.1/24 --dns1=8.8.8.8 --gateway=158.118.218.1
#nova-manage floating create --ip_range=183.134.101.144/29 --pool CTC-ZJ-LNA
#tenantID=`keystone tenant-list|awk '/VPN-HKG-2/{print $2}'`
#echo $tenantID
#nova-manage network create upnet2 --bridge=br100 --fixed_range_v4=158.118.218.0/24 --dns1=8.8.8.8 --gateway=158.118.218.65 --project_id="$tenantID"
#nova boot --image centos6_bbr --flavor c1m1d10n10 --key_name _upyun --nic net-id=f57c4025-2226-49b9-ac55-15c922ba2e26 test-vm1
#exit
net_quota(){
burst=7500
band=$((band*135))
echo $band $burst
nova flavor-key $flavor set quota:vif_inbound_average=$band
nova flavor-key $flavor set quota:vif_inbound_peak=$((band+burst*2))
nova flavor-key $flavor set quota:vif_inbound_burst=$burst
nova flavor-key $flavor set quota:vif_outbound_average=$band
nova flavor-key $flavor set quota:vif_outbound_peak=$((band+burst*2))
nova flavor-key $flavor set quota:vif_outbound_burst=$burst
}
mem_quota(){
hard=$((mem*1000000))
soft=$((mem*700000))
echo $hard $soft
nova flavor-key $flavor set quota:mem_hard_limit=$hard
nova flavor-key $flavor set quota:mem_soft_limit=$soft
}
if [ -z $1 ];then
flavor="c1m2d20"
else
flavor=$1
fi
band=`echo $flavor|sed -r 's^.*n(.*)$^\1^g'`
mem=`echo $flavor|sed -r 's^.*m(.*)d.*^\1^g'`
mem_quota
net_quota