Skip to content

Commit

Permalink
vmconfig: Sort host list before usage.
Browse files Browse the repository at this point in the history
We assumed that the hosts in the config file are sorted
by number, but MiniEdit has its own order.

Signed-off-by: Alexandru Copot <[email protected]>
  • Loading branch information
ketotek committed May 25, 2014
1 parent 4f46fda commit 1e63bcc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vlab/vmconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ def create_vm_configs(self):

self.links = links

for i in xrange(len(self.topo_config_data['hosts'])):
host_data = self.topo_config_data['hosts'][i]
sorted_hosts = sorted(self.topo_config_data['hosts'], key=lambda k: int(k['number']))

for i in xrange(len(sorted_hosts)):
host_data = sorted_hosts[i]
hostname = host_data['opts']['hostname']
host_config = {'options': host_data['opts'],
'links': links[hostname]}
Expand Down

0 comments on commit 1e63bcc

Please sign in to comment.