From 67203a54975db6294469b8fb0fcfe20105830c72 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Thu, 17 May 2012 16:49:15 +0200 Subject: [PATCH] Allow engine and metadata server start in any order When the metadata server starts first, it will wait for the engine to come up and only then registers it's hostname and port and becomes available. Signed-off-by: Tomas Sedovic --- bin/heat-metadata | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/heat-metadata b/bin/heat-metadata index 985e0e32..c18ecadd 100755 --- a/bin/heat-metadata +++ b/bin/heat-metadata @@ -45,9 +45,15 @@ LOG = logging.getLogger('heat.metadata') def send_address_to_engine(host, port): con = context.get_admin_context() - resp = rpc.call(con, 'engine', - {'method': 'metadata_register_address', - 'args': {'url': 'http://%s:%s' % (host, port)}}) + while True: + try: + resp = rpc.call(con, 'engine', + {'method': 'metadata_register_address', + 'args': {'url': 'http://%s:%s' % (host, port)}}) + LOG.info('registered the hostname and port with the engine.') + return + except rpc.common.Timeout: + LOG.info('Could not connect to the engine, retrying...') if __name__ == '__main__': -- 2.45.2