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: Ie36a6f52ad5dbbbb371b2295c1f26268a90ffcc2
Closes-Bug: 1456891
  • Loading branch information
cijohnson committed May 22, 2015
1 parent 7473023 commit d157402
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions fabfile/tasks/provision.py
Expand Up @@ -919,14 +919,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 d157402

Please sign in to comment.