aboutsummaryrefslogtreecommitdiffstats
path: root/planning
diff options
context:
space:
mode:
authorArne Sund <arnels@stortinget.samfundet.no>2015-03-18 22:15:03 +0100
committerArne Sund <arnels@stortinget.samfundet.no>2015-03-18 22:15:03 +0100
commitc2c7feb03209a7d1c5f12e8e5b40fbf56902a1f8 (patch)
treec6d0d99da7cdef653cd901c2f2422919da477b19 /planning
parentecd17a782e1d54307c74a812b42f3141cd636c97 (diff)
If distro7 switch came before distro6 switch, things broke
Diffstat (limited to 'planning')
-rw-r--r--planning/planning.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/planning/planning.cpp b/planning/planning.cpp
index e6c14a5..ac2e10d 100644
--- a/planning/planning.cpp
+++ b/planning/planning.cpp
@@ -683,6 +683,9 @@ int Planner::do_work(int distro_placements[NUM_DISTRO])
in_addr_t subnet_address = inet_addr(FIRST_SUBNET_ADDRESS);
num_ports_used.clear();
vector<in_addr_t> distro_mgmt_ip;
+ for (unsigned i = 0; i < NUM_DISTRO + 1; i++) {
+ distro_mgmt_ip.push_back(htonl(ntohl(inet_addr(FIRST_MGMT_ADDRESS))+ 1 + i * 64));
+ }
for (unsigned i = 0; i < switches.size(); ++i) {
const auto distro_it = switches_to_distros.find(i);
if (distro_it == switches_to_distros.end()) {
@@ -691,12 +694,7 @@ int Planner::do_work(int distro_placements[NUM_DISTRO])
unsigned int distro = distro_it->second;
int port_num = num_ports_used[distro]++;
- if(distro_mgmt_ip.size() < distro + 1) {
- distro_mgmt_ip.push_back(htonl(ntohl(inet_addr(FIRST_MGMT_ADDRESS))+ 2 + distro * 64));
- }
- else {
- distro_mgmt_ip[distro] = htonl(ntohl(distro_mgmt_ip[distro]) + 1);
- }
+ distro_mgmt_ip[distro] = htonl(ntohl(distro_mgmt_ip[distro]) + 1);
fprintf(patchlist, "e%u-%u %s %s %s %s %s\n",
switches[i].row * 2 - 1, switches[i].num + 1,