Rename check_active to check_create_complete, since "active" is
really a detail of Instance state, and so it seems wrong for other
resources which take a long time to create but are not Instance
based (e.g WaitConditions). This change will also allow us to
align other stack "state check" functions with the state we're
checking for in a consistent way (e.g check_delete_complete etc)
Fixes bug #
1178591
Change-Id: I55a824e6ba3de87cedd0b844e7f4e1294917533a
if callable(getattr(self, 'handle_create', None)):
create_data = self.handle_create()
yield
- while not self.check_active(create_data):
+ while not self.check_create_complete(create_data):
yield
except greenlet.GreenletExit:
# Older versions of greenlet erroneously had GreenletExit inherit
else:
self.state_set(self.CREATE_COMPLETE)
- def check_active(self, create_data):
+ def check_create_complete(self, create_data):
'''
Check if the resource is active (ready to move to the CREATE_COMPLETE
state). By default this happens as soon as the handle_create() method
def handle_create(self):
return self.resize(int(self.properties['Size']), raise_on_error=True)
- def check_active(self, creator):
+ def check_create_complete(self, creator):
if creator is None:
return True
return server
- def check_active(self, server):
+ def check_create_complete(self, server):
if server.status == 'ACTIVE':
return True
self.m.StubOutWithMock(eventlet, 'sleep')
self.m.StubOutWithMock(instance.Instance, 'handle_create')
- self.m.StubOutWithMock(instance.Instance, 'check_active')
+ self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
cookie = object()
for x in range(num):
instance.Instance.handle_create().AndReturn(cookie)
- instance.Instance.check_active(cookie).AndReturn(False)
+ instance.Instance.check_create_complete(cookie).AndReturn(False)
eventlet.sleep(mox.IsA(int)).AndReturn(None)
- instance.Instance.check_active(cookie).MultipleTimes().AndReturn(True)
+ instance.Instance.check_create_complete(
+ cookie).MultipleTimes().AndReturn(True)
def _stub_lb_reload(self, expected_list, unset=True):
if unset:
'test_instance_status_build')
instance.resource_id = 1234
- # Bind new fake get method which Instance.check_active will call
+ # Bind fake get method which Instance.check_create_complete will call
def activate_status(server):
server.status = 'ACTIVE'
return_server.get = activate_status.__get__(return_server)
'test_instance_status_build')
instance.resource_id = 1234
- # Bind new fake get method which Instance.check_active will call
+ # Bind fake get method which Instance.check_create_complete will call
def activate_status(server):
if hasattr(server, '_test_check_iterations'):
server._test_check_iterations += 1
self.m.StubOutWithMock(eventlet, 'sleep')
self.m.StubOutWithMock(instance.Instance, 'handle_create')
- self.m.StubOutWithMock(instance.Instance, 'check_active')
+ self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
cookie = object()
for x in range(num):
instance.Instance.handle_create().AndReturn(cookie)
- instance.Instance.check_active(cookie).AndReturn(False)
+ instance.Instance.check_create_complete(cookie).AndReturn(False)
eventlet.sleep(mox.IsA(int)).AndReturn(None)
- instance.Instance.check_active(cookie).MultipleTimes().AndReturn(True)
+ instance.Instance.check_create_complete(
+ cookie).MultipleTimes().AndReturn(True)
def create_instance_group(self, t, stack, resource_name):
resource = asc.InstanceGroup(resource_name,
self.stack_id = stack.store()
self.m.StubOutWithMock(instance.Instance, 'handle_create')
- self.m.StubOutWithMock(instance.Instance, 'check_active')
+ self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
for cookie in (object(), object()):
instance.Instance.handle_create().AndReturn(cookie)
- instance.Instance.check_active(cookie).AndReturn(True)
+ instance.Instance.check_create_complete(cookie).AndReturn(True)
self.m.StubOutWithMock(instance.Instance, 'FnGetAtt')
return stack
self.stack_id = stack.store()
self.m.StubOutWithMock(instance.Instance, 'handle_create')
- self.m.StubOutWithMock(instance.Instance, 'check_active')
+ self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
cookie = object()
instance.Instance.handle_create().AndReturn(cookie)
- instance.Instance.check_active(cookie).AndReturn(True)
+ instance.Instance.check_create_complete(cookie).AndReturn(True)
self.m.StubOutWithMock(wc.WaitConditionHandle, 'keystone')
wc.WaitConditionHandle.keystone().MultipleTimes().AndReturn(self.fc)