Skip to content

Commit

Permalink
Identifying rabbit port based on openstack HA or contrail HA
Browse files Browse the repository at this point in the history
setup.

Change-Id: I0bc98c367ed4a69998626fea12132f9d2a9ce213
Closes-Bug: 1616178
  • Loading branch information
cijohnson committed Nov 14, 2016
1 parent c787d1e commit fcaad56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 3 additions & 10 deletions fabfile/tasks/provision.py
Expand Up @@ -684,18 +684,15 @@ def fixup_ceilometer_conf_common():
sudo("openstack-config --set %s database connection %s" % (conf_file, value))
amqp_server_ip = get_openstack_amqp_server()
sudo("openstack-config --set %s DEFAULT rabbit_host %s" % (conf_file, amqp_server_ip))
# If HA is enabled, then use the frontend HAProxy Rabbit port
rabbit_port = "5672"
if get_openstack_internal_vip():
rabbit_port = "5673"
sudo("openstack-config --set %s notification workload_partitioning %s" %
(conf_file, "True"))
sudo("openstack-config --set %s compute workload_partitioning %s" %
(conf_file, "True"))
sudo("openstack-config --set %s coordination backend_url %s%s%s" %
(conf_file, "kazoo://", env.roledefs['database'][0], ":2181"))
sudo("openstack-config --set %s DEFAULT rabbit_port %s" % (conf_file,
rabbit_port))
get_openstack_amqp_port()))
value = "/var/log/ceilometer"
sudo("openstack-config --set %s DEFAULT log_dir %s" % (conf_file, value))
value = "a74ca26452848001921c"
Expand Down Expand Up @@ -1041,16 +1038,11 @@ def setup_identity_service_node(*args):
"""Provisions identity services in one or list of nodes.
USAGE: fab setup_identity_service_node:user@1.1.1.1,user@2.2.2.2"""
amqp_server_ip = get_openstack_amqp_server()
rabbit_port = "5672"

# If HA is enabled, then use the frontend HAProxy Rabbit port
if get_openstack_internal_vip():
rabbit_port = "5673"

conf_file = '/etc/keystone/keystone.conf'
keystone_configs = {'DEFAULT' : {'notification_driver' : 'messaging',
'rabbit_host' : '%s' % amqp_server_ip,
'rabbit_port' : '%s' % rabbit_port }
'rabbit_port' : '%s' % get_openstack_amqp_port() }
}
for host_string in args:
for section, key_values in keystone_configs.iteritems():
Expand All @@ -1069,6 +1061,7 @@ def setup_image_service_node(*args):
glance_configs = {'DEFAULT' : {'notification_driver' : 'messaging',
'rpc_backend' : 'rabbit',
'rabbit_host' : '%s' % amqp_server_ip,
'rabbit_port' : '%s' % get_openstack_amqp_port(),
'rabbit_password' : 'guest'}
}
if openstack_sku == 'havana':
Expand Down
10 changes: 10 additions & 0 deletions fabfile/utils/host.py
Expand Up @@ -305,6 +305,16 @@ def get_openstack_amqp_server():
return get_from_testbed_dict('openstack','amqp_host',
(rabbit_vip or hstr_to_ip(get_control_host_string(env.roledefs[amqp_in_role][0]))))

def get_openstack_amqp_port():
rabbit_port = 5672
if get_from_testbed_dict('openstack', 'manage_amqp', 'no') == 'yes':
if get_openstack_internal_vip():
rabbit_port = 5673
else:
if get_contrail_internal_vip():
rabbit_port = 5673
return get_from_testbed_dict('openstack','amqp_port', rabbit_port)

def get_contrail_amqp_server():
"""Returns first cfgm ip in case of non HA setup and
contrail_internal_vip in case of HA setup
Expand Down

0 comments on commit fcaad56

Please sign in to comment.