Skip to content

Commit

Permalink
Retrying to create nova-docker in cases where the openstack servrices…
Browse files Browse the repository at this point in the history
… are

starting up after reboot.

Change-Id: I7b73ef25f04c92ca2fa00429a69b04cb5ce508e9
Closes-Bug: 1456891
  • Loading branch information
cijohnson committed May 22, 2015
1 parent 6b7936b commit 04adcca
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions fabfile/tasks/provision.py
Expand Up @@ -923,14 +923,19 @@ def setup_nova_aggregate_node(*args):
while retry:
with settings(warn_only=True):
aggregate_list = sudo("(source /etc/contrail/openstackrc; nova aggregate-list)")
if aggregate_list.failed:
sleep(6)
retry -= 1
continue
break
if hypervisor not in aggregate_list:
sudo("(source /etc/contrail/openstackrc; nova aggregate-create %s nova/%s)" % (hypervisor, hypervisor))
sudo("(source /etc/contrail/openstackrc; nova aggregate-add-host %s %s)" % (hypervisor, host_name))
if aggregate_list.failed: # Services might be starting up after reboot
sleep(6)
retry -= 1
continue
aggregate_details = sudo("(source /etc/contrail/openstackrc;nova aggregate-details %s)" % hypervisor)
if host_name not in aggregate_details:
if hypervisor not in aggregate_list:
create = sudo("(source /etc/contrail/openstackrc; nova aggregate-create %s nova/%s)" % (hypervisor, hypervisor))
if create.failed: # Services might be starting up after reboot
continue
if sudo("(source /etc/contrail/openstackrc; nova aggregate-add-host %s %s)" % (hypervisor, host_name)).failed:
continue # Services might be starting up after reboot
break # Stop retrying as the aggregate is created and compute is added.

@roles('openstack')
@task
Expand Down

0 comments on commit 04adcca

Please sign in to comment.