Exemple #1
0
 def authorize_security_group(self, context, rule_body):
     neutron = clients.neutron(context)
     try:
         os_security_group_rule = neutron.create_security_group_rule(
             {'security_group_rule': rule_body})['security_group_rule']
     except neutron_exception.OverQuotaClient:
         raise exception.RulesPerSecurityGroupLimitExceeded()
     except neutron_exception.Conflict as ex:
         raise exception.InvalidPermissionDuplicate()
Exemple #2
0
 def authorize_security_group(self, context, rule_body):
     nova = clients.nova(context)
     try:
         os_security_group_rule = nova.security_group_rules.create(
             rule_body['security_group_id'], rule_body.get('protocol'),
             rule_body.get('port_range_min', -1),
             rule_body.get('port_range_max', -1),
             rule_body.get('remote_ip_prefix'),
             rule_body.get('remote_group_id'))
     except nova_exception.Conflict:
         raise exception.InvalidPermissionDuplicate()
     except nova_exception.OverLimit:
         raise exception.RulesPerSecurityGroupLimitExceeded()