Get rid of create state in Instance

We don't want to store any state in the Instance object, instead take
advantage of the new mechanism whereby the result of handle_create() is
passed to check_active().

This makes the autoscaling code uglier for now (since it must still store
the instance state in the instance), but this will go away when we move to
using co-routines to create resources in parallel.

Change-Id: Ib11c8da22900453eb9713eba5106859c8a09dbe2
This commit is contained in:
Zane Bitter
2013-04-23 13:21:28 +02:00
parent 9bd13ec4d5
commit f3454692fb
5 changed files with 21 additions and 19 deletions

View File

@@ -88,11 +88,12 @@ class AutoScalingTest(unittest.TestCase):
self.m.StubOutWithMock(instance.Instance, 'handle_create')
self.m.StubOutWithMock(instance.Instance, 'check_active')
cookie = object()
for x in range(num):
instance.Instance.handle_create().AndReturn(None)
instance.Instance.check_active(None).AndReturn(False)
instance.Instance.handle_create().AndReturn(cookie)
instance.Instance.check_active(cookie).AndReturn(False)
eventlet.sleep(mox.IsA(int)).AndReturn(None)
instance.Instance.check_active(None).MultipleTimes().AndReturn(True)
instance.Instance.check_active(cookie).MultipleTimes().AndReturn(True)
def _stub_lb_reload(self, expected_list, unset=True):
if unset: