diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 12 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/security_groups.py | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 25d6c1c81..c5cc1feb0 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -544,6 +544,18 @@ class CloudController(object): else: values['cidr'] = '0.0.0.0/0' + if source_security_group_name: + # Open everything if an explicit port range or type/code are not + # specified, but only if a source group was specified. + ip_proto_upper = ip_protocol.upper() if ip_protocol else '' + if ip_proto_upper == 'ICMP' and not from_port and not to_port: + from_port = -1 + to_port = -1 + elif (ip_proto_upper in ['TCP', 'UDP'] and not from_port + and not to_port): + from_port = 1 + to_port = 65535 + if ip_protocol and from_port and to_port: ip_protocol = str(ip_protocol) diff --git a/nova/api/openstack/compute/contrib/security_groups.py b/nova/api/openstack/compute/contrib/security_groups.py index 9a4cdc7e8..bc4551ec7 100644 --- a/nova/api/openstack/compute/contrib/security_groups.py +++ b/nova/api/openstack/compute/contrib/security_groups.py @@ -436,6 +436,18 @@ class SecurityGroupRulesController(SecurityGroupControllerBase): else: values['cidr'] = '0.0.0.0/0' + if group_id: + # Open everything if an explicit port range or type/code are not + # specified, but only if a source group was specified. + ip_proto_upper = ip_protocol.upper() if ip_protocol else '' + if ip_proto_upper == 'ICMP' and not from_port and not to_port: + from_port = -1 + to_port = -1 + elif (ip_proto_upper in ['TCP', 'UDP'] and not from_port + and not to_port): + from_port = 1 + to_port = 65535 + if ip_protocol and from_port and to_port: ip_protocol = str(ip_protocol) |
