Merge lp:~cpe-sa/obinstall/next-network-mode-fix into lp:obinstall/next
Status: | Needs review |
---|---|
Proposed branch: | lp:~cpe-sa/obinstall/next-network-mode-fix |
Merge into: | lp:obinstall/next |
Diff against target: |
350 lines (+202/-110) 1 file modified
network/network-mode.sh (+202/-110) |
To merge this branch: | bzr merge lp:~cpe-sa/obinstall/next-network-mode-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
CPE SA | Pending | ||
Review via email: mp+319011@code.launchpad.net |
Description of the change
Clean up and rewrite of network.sh.
-Sets both eth0 and eth1 to appropriate fabrics/subnets
-Handles errors
-New force mode to do a partial change if nodes aren't ready/broken.
-Output is color coded by nic/vlan/subnet
-Performs a single read of maas for all system ids vs calling maas admin node 10 x
-Performs a single read of maas to get both fabric and vlan id based on subnet
-Uses proper bash 4.x parameter substitution
-Maas queries use jq instead of the unholy trinity of echo+grep+cut
Output:
$ ./network-mode.sh
Usage: network-mode.sh <options>
Options:
-s|--
-d|--dual-network Configure secondary interfaces on ndoes 1-10 on a second VLAN
-f|--force Run even if nodes are not in Ready state
$ ./network-mode.sh -s
Configuring OrangeBox20 for Single Network mode:
Logging in as admin to maas server @ http://
Getting state of nodes on OrangeBox20
node01ob20 Ready
node03ob20 Ready
node04ob20 Ready
node07ob20 Ready
node08ob20 Ready
node09ob20 Ready
node02ob20 Ready
node05ob20 Ready
node06ob20 Ready
node10ob20 Ready
Mikrotik: Successfully configured router for Single Network Mode!
MAAS: Successfully set eth0 on node01ob20 (4y3h8a) to use vlan 5002
MAAS: Successfully linked eth0 on node01ob20 (4y3h8a) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node01ob20 (4y3h8a) to use vlan 5002
MAAS: Successfully linked eth1 on node01ob20 (4y3h8a) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node02ob20 (kqyg3f) to use vlan 5002
MAAS: Successfully linked eth0 on node02ob20 (kqyg3f) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node02ob20 (kqyg3f) to use vlan 5002
MAAS: Successfully linked eth1 on node02ob20 (kqyg3f) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node03ob20 (4y3h8c) to use vlan 5002
MAAS: Successfully linked eth0 on node03ob20 (4y3h8c) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node03ob20 (4y3h8c) to use vlan 5002
MAAS: Successfully linked eth1 on node03ob20 (4y3h8c) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node04ob20 (4y3h8d) to use vlan 5002
MAAS: Successfully linked eth0 on node04ob20 (4y3h8d) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node04ob20 (4y3h8d) to use vlan 5002
MAAS: Successfully linked eth1 on node04ob20 (4y3h8d) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node05ob20 (erfb86) to use vlan 5002
MAAS: Successfully linked eth0 on node05ob20 (erfb86) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node05ob20 (erfb86) to use vlan 5002
MAAS: Successfully linked eth1 on node05ob20 (erfb86) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node06ob20 (4ewpx6) to use vlan 5002
MAAS: Successfully linked eth0 on node06ob20 (4ewpx6) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node06ob20 (4ewpx6) to use vlan 5002
MAAS: Successfully linked eth1 on node06ob20 (4ewpx6) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node07ob20 (4y3h8g) to use vlan 5002
MAAS: Successfully linked eth0 on node07ob20 (4y3h8g) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node07ob20 (4y3h8g) to use vlan 5002
MAAS: Successfully linked eth1 on node07ob20 (4y3h8g) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node08ob20 (4y3h8h) to use vlan 5002
MAAS: Successfully linked eth0 on node08ob20 (4y3h8h) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node08ob20 (4y3h8h) to use vlan 5002
MAAS: Successfully linked eth1 on node08ob20 (4y3h8h) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node09ob20 (4y3h8k) to use vlan 5002
MAAS: Successfully linked eth0 on node09ob20 (4y3h8k) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node09ob20 (4y3h8k) to use vlan 5002
MAAS: Successfully linked eth1 on node09ob20 (4y3h8k) to subnet 172.27.20.0/23
MAAS: Successfully set eth0 on node10ob20 (tsq84y) to use vlan 5002
MAAS: Successfully linked eth0 on node10ob20 (tsq84y) to subnet 172.27.20.0/23
MAAS: Successfully set eth1 on node10ob20 (tsq84y) to use vlan 5002
MAAS: Successfully linked eth1 on node10ob20 (tsq84y) to subnet 172.27.20.0/23
Successfully configured OrangeBox20 for Single Network Mode!
Unmerged revisions
- 22. By Craig Bender
-
Check for existing links before updating link to subnet, otherwise an alias gets created
- 21. By Craig Bender
-
Fixed network mode script
Example of trying to run script when nodes aren't ready/broken:
$ ./network-mode.sh -d
Configuring OrangeBox20 for Dual Network mode:
Logging in as admin to maas server @ http:// 172.27. 20.1/MAAS. ..OK!
Getting state of nodes on OrangeBox20
ERROR: This script requires that all nodes are in a "Ready" or "Broken" state
Please ensure the all nodes are "Ready" and try again.
node01ob20 Deployed
node03ob20 Deployed
node04ob20 Deployed
node07ob20 Deployed
node08ob20 Deployed
node09ob20 Deployed
node02ob20 Deployed
node05ob20 Deployed
node06ob20 Deployed
node10ob20 Ready