-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·64 lines (52 loc) · 1.8 KB
/
init.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash -f
###########################################################################
# Copyright 2016 IBM Corp.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
source perf/perf.rc
# start OVN
ovn_start
# Move our proc to shield
#cset shield --force --shield `cat sandbox/ovn-nb/ovsdb-server.pid`
#cset shield --force --shield `cat sandbox/ovn-sb/ovsdb-server.pid`
# if database process CPU pinning defined, do it
[ $NB_CPU ] && pin sandbox/ovn-nb/ovsdb-server.pid $NB_CPU
[ $SB_CPU ] && pin sandbox/ovn-sb/ovsdb-server.pid $SB_CPU
# create management network
net_add n1
# create logical networks
for i in `seq $NETS`; do
ovn-nbctl ls-add br$i
done
# create and connect simulated hypervisors
for i in `seq $HOSTS`; do
(sim_add hv$i
as hv$i
ovs-vsctl add-br br-phys
y=$(expr $i / 256)
x=$(expr $i % 256)
ovn_attach n1 br-phys 192.168.$y.$x
# if hypervisor processes CPU pinning defined, do it
if [ $HV_CPU ]; then
for pid in `find sandbox/hv$i -name *pid`; do
#cset shield --force --shield `cat $pid`
[ $HV_CPU ] && pin $pid $HV_CPU
done
fi ) &
case $i in
*5|*0) echo Inited hypervisor $i; wait ;;
esac
done
wait
## let all the components calm down
#sleep 3