Merge "Add network id verification on share creation"

This commit is contained in:
Jenkins 2014-02-06 16:59:27 +00:00 committed by Gerrit Code Review
commit 8bc48675ec
1 changed files with 9 additions and 1 deletions

View File

@ -198,7 +198,15 @@ class ShareController(wsgi.Controller):
else:
kwargs['snapshot'] = None
kwargs['share_network_id'] = share.get('share_network_id')
share_network_id = share.get('share_network_id')
if share_network_id:
try:
self.share_api.db.share_network_get(context, share_network_id)
except exception.ShareNetworkNotFound as e:
msg = "%s" % e
raise exc.HTTPNotFound(explanation=msg)
else:
kwargs['share_network_id'] = share_network_id
display_name = share.get('display_name')
display_description = share.get('display_description')