Another thing, we get the source group again here when formatting the security group rules:
https://github.com/openstack/nova/blob/f8a01ccdffc13403df77148867ef3821100b5edb/nova/api/openstack/compute/security_groups.py#L71
But if we had the group_id already, then we have group_rule_data in that code and it has what we need, so that should change to either:
if group_rule_data: sg_rule['group'] = group_rule_data elif rule['group_id']: ... else sg_rule['ip_range'] = {'cidr': rule['cidr']}
Or:
if rule['group_id'] and not group_rule_data: ... elif group_rule_data: ... else: ...
Another thing, we get the source group again here when formatting the security group rules:
https:/ /github. com/openstack/ nova/blob/ f8a01ccdffc1340 3df77148867ef38 21100b5edb/ nova/api/ openstack/ compute/ security_ groups. py#L71
But if we had the group_id already, then we have group_rule_data in that code and it has what we need, so that should change to either:
if group_rule_data: 'ip_range' ] = {'cidr': rule['cidr']}
sg_rule['group'] = group_rule_data
elif rule['group_id']:
...
else
sg_rule[
Or:
if rule['group_id'] and not group_rule_data:
...
elif group_rule_data:
...
else:
...