Merge "Reduce the number of db/rpc calls to get instance rules"
This commit is contained in:
commit
af2d79bafa
@ -1329,6 +1329,11 @@ def security_group_rule_get_by_security_group(context, security_group_id,
|
||||
context, security_group_id, columns_to_join=columns_to_join)
|
||||
|
||||
|
||||
def security_group_rule_get_by_instance(context, instance_uuid):
|
||||
"""Get all rules for a given instance."""
|
||||
return IMPL.security_group_rule_get_by_instance(context, instance_uuid)
|
||||
|
||||
|
||||
def security_group_rule_destroy(context, security_group_rule_id):
|
||||
"""Deletes a security group rule."""
|
||||
return IMPL.security_group_rule_destroy(context, security_group_rule_id)
|
||||
|
@ -4356,6 +4356,15 @@ def security_group_rule_get_by_security_group(context, security_group_id,
|
||||
return query.all()
|
||||
|
||||
|
||||
@require_context
|
||||
def security_group_rule_get_by_instance(context, instance_uuid):
|
||||
return (_security_group_rule_get_query(context).
|
||||
join('parent_group', 'instances').
|
||||
filter_by(uuid=instance_uuid).
|
||||
options(joinedload('grantee_group')).
|
||||
all())
|
||||
|
||||
|
||||
@require_context
|
||||
def security_group_rule_create(context, values):
|
||||
return _security_group_rule_create(context, values)
|
||||
|
Loading…
Reference in New Issue
Block a user