Skip to content

Commit

Permalink
Closes-Bug: #1602866 - Prevent Old Params Cluster from being added to…
Browse files Browse the repository at this point in the history
… 3.1 SM onwards

This will show error message if we add cluster json without provision section in parameters.
NEEDS TO GO IN AFTER UI SUPPORT OF NEW PARAMS

Also changed how external_keystone_ip is calculated

Change-Id: I279977f2579521af429726568096ea484abe029c
  • Loading branch information
nitishkrishna committed Jul 13, 2016
1 parent aeb3aec commit 6625ddd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/server_mgr_main.py
Expand Up @@ -810,6 +810,12 @@ def validate_smgr_put(self, validation_data, request, data=None,
for item in remove_list:
data.pop(item, None)

if 'parameters' in data and obj_name == 'cluster':
if 'provision' not in data['parameters']:
msg = ("Old Parameters format is no longer supported for cluster parameters. Please use the new format")
self._smgr_log.log(self._smgr_log.ERROR,msg)
self.log_and_raise_exception(msg)

if 'roles' in data:
if 'storage-compute' in data['roles'] and 'compute' not in data['roles']:
msg = "role 'storage-compute' needs role 'compute' in provision file"
Expand Down Expand Up @@ -861,7 +867,7 @@ 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", None)
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:
Expand Down Expand Up @@ -3852,7 +3858,7 @@ 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", None)
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {})
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
openstack_ip = ''
self_ip = server.get("ip_address", "")
Expand Down Expand Up @@ -3975,7 +3981,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", None)
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {})
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
mysql_allowed_hosts = []
internal_vip = openstack_ha_params.get("internal_vip", None)
Expand Down

0 comments on commit 6625ddd

Please sign in to comment.