Skip to content

Commit

Permalink
Merge "Closes-Bug: #1597934 - External Openstack Scenario is disentan…
Browse files Browse the repository at this point in the history
…gled from External Keystone" into R3.1
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 21, 2016
2 parents c4e3a29 + a113852 commit 91289f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
33 changes: 11 additions & 22 deletions src/server_mgr_main.py
Expand Up @@ -867,17 +867,13 @@ def validate_non_openstack_cluster(self, cluster_id):
else:
msg = "Cluster with only Openstack role is supported only with new cluster params format with Openstack section\n"
self.log_and_raise_exception(msg)
configured_external_keystone_params = cluster_openstack_params.get("keystone", {})
if configured_external_keystone_params:
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
else:
configured_external_keystone_ip = None
configured_external_openstack_ip = cluster_openstack_params.get("external_openstack_ip", None)
configured_nova_params = cluster_openstack_params.get("nova", None)
if configured_nova_params:
configured_nova_rabbit_servers = configured_nova_params.get("rabbit_hosts", None)
else:
configured_nova_rabbit_servers = None
if configured_external_keystone_ip and configured_nova_rabbit_servers:
if configured_external_openstack_ip and configured_nova_rabbit_servers:
pass
else:
msg = "In a Cluster with no Openstack role, you need to configure both openstack::keystone::ip and openstack::nova::rabbit_hosts to point to an external Openstack\n"
Expand All @@ -896,15 +892,10 @@ def validate_openstack_only_cluster(self, cluster_id):
self.log_and_raise_exception(msg)

openstack_manage_amqp_check = cluster_openstack_params.get("openstack_manage_amqp", None)
configured_nova_params = cluster_openstack_params.get("nova", None)
if configured_nova_params:
configured_nova_neutron_ip = configured_nova_params.get("neutron_ip_to_use", None)
else:
configured_nova_neutron_ip = None
if configured_nova_neutron_ip and openstack_manage_amqp_check:
if openstack_manage_amqp_check:
pass
else:
msg = "In a Cluster with only Openstack role defined, you need to configure both openstack::openstack_manage_amqp = true and openstck::nova::neutron_ip_to_use pointing to a Cfgm node\n"
msg = "In a Cluster with only Openstack role defined, you need to configure openstack::openstack_manage_amqp = true\n"
self.log_and_raise_exception(msg)

def _validate_roles(self, cluster_id):
Expand Down Expand Up @@ -3862,12 +3853,11 @@ def storage_get_control_network_mask(
server_params = server.get('parameters', {})
cluster_openstack_prov_params = (
cluster_params.get("provision", {})).get("openstack", {})
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {})
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
configured_external_openstack_ip = cluster_openstack_prov_params.get("external_openstack_ip", None)
openstack_ip = ''
self_ip = server.get("ip_address", "")
if configured_external_keystone_ip:
openstack_ip = configured_external_keystone_ip
if configured_external_openstack_ip:
openstack_ip = configured_external_openstack_ip
elif self_ip in role_ips_dict['openstack']:
openstack_ip = self_ip
elif 'openstack' in role_ips_dict and len(role_ips_dict['openstack']):
Expand All @@ -3885,7 +3875,7 @@ def storage_get_control_network_mask(
subnet_address = str(IPNetwork(
openstack_ip + "/" + subnet_mask).network)

if openstack_ip == configured_external_keystone_ip:
if openstack_ip == configured_external_openstack_ip:
return '"' + str(IPNetwork(subnet_address).network) + '/' + str(IPNetwork(subnet_address).prefixlen) + '"'
if (self.get_control_net(cluster_servers))[openstack_ip]:
intf_control = eval((self.get_control_net(cluster_servers))[openstack_ip])
Expand Down Expand Up @@ -3985,8 +3975,7 @@ def build_calculated_cluster_params(
# Build mysql_allowed_hosts list
contrail_ha_params = cluster_contrail_prov_params.get("ha", {})
openstack_ha_params = cluster_openstack_prov_params.get("ha", {})
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {})
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
configured_external_openstack_ip = cluster_openstack_prov_params.get("external_openstack_ip", None)
mysql_allowed_hosts = []
internal_vip = openstack_ha_params.get("internal_vip", None)
if internal_vip:
Expand Down Expand Up @@ -4072,8 +4061,8 @@ def build_calculated_cluster_params(
# Build openstack parameters for openstack modules
self_ip = server.get("ip_address", "")
openstack_ips = [x["ip_address"] for x in cluster_servers if "openstack" in eval(x.get('roles', '[]'))]
if configured_external_keystone_ip:
openstack_ip = configured_external_keystone_ip
if configured_external_openstack_ip:
openstack_ip = configured_external_openstack_ip
external_openstack_ip_list = []
external_openstack_ip_list.append(openstack_ip)
openstack_params["openstack_ip_list"] = external_openstack_ip_list
Expand Down
9 changes: 4 additions & 5 deletions src/server_mgr_puppet.py
Expand Up @@ -47,12 +47,11 @@ def storage_get_control_network_mask(self, provision_params,
#openstack_ip = cluster_params.get("internal_vip", None)
cluster_openstack_prov_params = (
cluster_params.get("provision", {})).get("openstack", {})
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None)
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
configured_external_openstack_ip = cluster_openstack_prov_params.get("external_openstack_ip", None)
openstack_ip = ''
self_ip = server.get("ip_address", "")
if configured_external_keystone_ip:
openstack_ip = configured_external_keystone_ip
if configured_external_openstack_ip:
openstack_ip = configured_external_openstack_ip
elif self_ip in role_ips_dict['openstack']:
openstack_ip = self_ip
elif 'openstack' in role_ips_dict and len(role_ips_dict['openstack']):
Expand All @@ -71,7 +70,7 @@ def storage_get_control_network_mask(self, provision_params,
subnet_address = str(IPNetwork(
openstack_ip + "/" + subnet_mask).network)

if openstack_ip == configured_external_keystone_ip:
if openstack_ip == configured_external_openstack_ip:
return '"' + str(IPNetwork(subnet_address).network) + '/' + str(IPNetwork(subnet_address).prefixlen) + '"'

self._smgr_log.log(self._smgr_log.DEBUG, "control-net : %s" % str( provision_params['control_net']))
Expand Down

0 comments on commit 91289f4

Please sign in to comment.