share_manage.py (manila-11.0.0) | : | share_manage.py (manila-11.0.1) | ||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
# NOTE(vponomaryov): compatibility actions are required between API and | # NOTE(vponomaryov): compatibility actions are required between API and | |||
# DB layers for 'name' and 'description' API params that are | # DB layers for 'name' and 'description' API params that are | |||
# represented in DB as 'display_name' and 'display_description' | # represented in DB as 'display_name' and 'display_description' | |||
# appropriately. | # appropriately. | |||
name = share_data.get('display_name', share_data.get('name')) | name = share_data.get('display_name', share_data.get('name')) | |||
description = share_data.get( | description = share_data.get( | |||
'display_description', share_data.get('description')) | 'display_description', share_data.get('description')) | |||
share = { | share = { | |||
'host': share_data['service_host'], | 'host': share_data['service_host'], | |||
'export_location': share_data['export_path'], | 'export_location_path': share_data['export_path'], | |||
'share_proto': share_data['protocol'].upper(), | 'share_proto': share_data['protocol'].upper(), | |||
'share_type_id': share_data['share_type_id'], | 'share_type_id': share_data['share_type_id'], | |||
'display_name': name, | 'display_name': name, | |||
'display_description': description, | 'display_description': description, | |||
} | } | |||
if share_data.get('is_public') is not None: | if share_data.get('is_public') is not None: | |||
share['is_public'] = share_data['is_public'] | share['is_public'] = share_data['is_public'] | |||
driver_options = share_data.get('driver_options', {}) | driver_options = share_data.get('driver_options', {}) | |||
skipping to change at line 88 | skipping to change at line 88 | |||
data = body['share'] | data = body['share'] | |||
for parameter in required_parameters: | for parameter in required_parameters: | |||
if parameter not in data: | if parameter not in data: | |||
msg = _("Required parameter %s not found") % parameter | msg = _("Required parameter %s not found") % parameter | |||
raise exc.HTTPUnprocessableEntity(explanation=msg) | raise exc.HTTPUnprocessableEntity(explanation=msg) | |||
if not data.get(parameter): | if not data.get(parameter): | |||
msg = _("Required parameter %s is empty") % parameter | msg = _("Required parameter %s is empty") % parameter | |||
raise exc.HTTPUnprocessableEntity(explanation=msg) | raise exc.HTTPUnprocessableEntity(explanation=msg) | |||
if isinstance(data['export_path'], dict): | ||||
# the path may be inside this dictionary | ||||
try: | ||||
data['export_path'] = data['export_path']['path'] | ||||
except KeyError: | ||||
msg = ("Export path must be a string, or a dictionary " | ||||
"with a 'path' item") | ||||
raise exc.HTTPUnprocessableEntity(explanation=msg) | ||||
if not share_utils.extract_host(data['service_host'], 'pool'): | if not share_utils.extract_host(data['service_host'], 'pool'): | |||
msg = _("service_host parameter should contain pool.") | msg = _("service_host parameter should contain pool.") | |||
raise exc.HTTPBadRequest(explanation=msg) | raise exc.HTTPBadRequest(explanation=msg) | |||
try: | try: | |||
utils.validate_service_host( | utils.validate_service_host( | |||
context, share_utils.extract_host(data['service_host'])) | context, share_utils.extract_host(data['service_host'])) | |||
except exception.ServiceNotFound as e: | except exception.ServiceNotFound as e: | |||
raise exc.HTTPNotFound(explanation=e) | raise exc.HTTPNotFound(explanation=e) | |||
except exception.PolicyNotAuthorized as e: | except exception.PolicyNotAuthorized as e: | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 10 lines changed or added |