From 5a89fe11f1efb1136758f4dc20ae0854fcf41b59 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Mon, 6 May 2013 22:42:51 -0700 Subject: Remove security_group_handler Now that nova's security groups are more plugable and decoupled from the database the security_group_handler code is not very useful so this patch removes it. A little info about the security_group_handler: The security_group_handle code was added to provide a hook into nova security groups so that one could get security group add/delete/update notification and proxy them somewhere else (i.e quantum). Trying to actually using this method opens one up to several transactional issues because in the current implemenation the security group is commited to the nova database before security_group_handler is called. Implements blueprint: remove-security-group-handler Change-Id: I45047fe8dbb81555505e03309838910113080c37 --- nova/db/sqlalchemy/api.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'nova/db') diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 72ade9857..d789b04a5 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1441,7 +1441,7 @@ def instance_create(context, values): def _get_sec_group_models(session, security_groups): models = [] - _existed, default_group = security_group_ensure_default(context, + default_group = security_group_ensure_default(context, session=session) if 'default' in security_groups: models.append(default_group) @@ -3227,17 +3227,11 @@ def security_group_create(context, values, session=None): def security_group_ensure_default(context, session=None): - """Ensure default security group exists for a project_id. - - Returns a tuple with the first element being a bool indicating - if the default security group previously existed. Second - element is the dict used to create the default security group. - """ + """Ensure default security group exists for a project_id.""" try: default_group = security_group_get_by_name(context, context.project_id, 'default', columns_to_join=[], session=session) - return (True, default_group) except exception.NotFound: values = {'name': 'default', 'description': 'default', @@ -3255,7 +3249,7 @@ def security_group_ensure_default(context, session=None): 'parent_group_id': default_group.id, } security_group_rule_create(context, rule_values) - return (False, default_group) + return default_group @require_context -- cgit