Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Maintain VM order
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Mar 8, 2017
1 parent 60abb03 commit aa6276f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def add_vm(self, vm):
Add, and assigns a new VM ID to the infrastructure
"""
with self._lock:
# Set the ID of the pos in the list
vm.im_id = len(self.vm_list)
self.vm_list.append(vm)

def add_cont_msg(self, msg):
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_im_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def test_inf_addresources5(self):
self.assertLess(delay, 17)
self.assertGreater(delay, 14)

self.assertEqual(len(vms), 6)
self.assertEqual(vms, [0, 1, 2, 3, 4, 5])
self.assertEqual(cloud.launch.call_count, 3)
self.assertEqual(cloud.launch.call_args_list[0][0][3], 1)
self.assertEqual(cloud.launch.call_args_list[1][0][3], 3)
Expand All @@ -537,7 +537,7 @@ def test_inf_addresources5(self):
self.assertGreater(delay, 4)
Config.MAX_SIMULTANEOUS_LAUNCHES = 1

self.assertEqual(len(vms), 6)
self.assertEqual(vms, [6, 7, 8, 9, 10, 11])
self.assertEqual(cloud.launch.call_count, 3)
self.assertEqual(cloud.launch.call_args_list[0][0][3], 1)
self.assertEqual(cloud.launch.call_args_list[1][0][3], 3)
Expand Down

0 comments on commit aa6276f

Please sign in to comment.