~secroft/obinstall/fabric-fix

« back to all changes in this revision

Viewing changes to 05-add_physical_nodes.sh

  • Committer: Scott Croft
  • Date: 2016-08-04 05:00:27 UTC
  • Revision ID: scott@canonical.com-20160804050027-mm8rxzuvoblrv6zk
Fixed fabric detection to make it so it doesn't matter the number and updated all scripts accordingly

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#
20
20
 
21
21
 
22
 
set -aux
 
22
set -ax
23
23
# If user is not root then exit
24
24
if [ "$(id -u)" != "0" ]; then
25
25
  echo "Must be run with sudo or by root"
126
126
#sleeping for 2 minutes so all nodes can commission and then execute properly adding them to the correct fabric
127
127
#
128
128
 
129
 
sleep 120
 
129
sleep 180
130
130
 
131
 
# ##Only used for 2vlan setup## Get vlan number for fabric-2
 
131
# ##Only used for 2vlan setup## Get vlan number for second fabric and fabrics
132
132
#
133
133
 
134
 
vlanid=$(maas admin vlans read 1 |grep id |grep -v vid | awk -F, '{print $1}'|awk '{print $2}')
135
 
#sub_net="172.27.`expr ${ob_number} + 2`.0/23"
136
 
sub_net="172.27.${ob_number}.0/23"
137
 
 
138
 
# Configure first usb interface for fabric-1 and proper subnet
 
134
declare maas_fabric=()
 
135
for fab_ric in $(maas admin fabrics read |grep name|grep fabric|awk -F\" '{print $4}')
 
136
do
 
137
    echo "Fabric $fab_ric"
 
138
    maas_fabric=("${maas_fabric[@]}" "$fab_ric")
 
139
done
 
140
 
 
141
vlanid=$(maas admin vlans read "${maas_fabric[2]}" |grep id |grep -v vid | awk -F, '{print $1}'|awk '{print $2}')
 
142
 
 
143
sub_net="172.27.((ob_number+2)).0/23"
 
144
 
 
145
# Configure second usb interface for second fabric and proper subnet
139
146
#
140
147
 
141
148
for nodenum in {01..10}
142
149
do
143
150
     interface=$(maas admin nodes read hostname=node${nodenum}ob${ob_number} |grep enx | cut -d '"' -f4)
144
151
     system_id=$(maas admin nodes read hostname=node${nodenum}ob${ob_number} |grep system_id | cut -d'"' -f4)
145
 
     maas admin machine update $system_id cpu_count=4 memory=16384
146
152
     maas admin interface update $system_id $interface vlan=$vlanid
147
 
     maas admin interface link-subnet $system_id $interface mode=auto subnet="$sub_net"
 
153
     maas admin interface update $system_id $interface name=eth1
 
154
     maas admin interface link-subnet $system_id eth1 mode=auto subnet="$sub_net"
148
155
done