When converting a Nova security group to its jclouds representation, the class FindSecurityGroupWithNameAndReturnTrue is used to find a security group in the list of groups in a location by matching on name with a “query object”:
However, it is possible for there to be duplicate group names among the security groups in a location. Say we have a location with two groups, G1 and G2, both with name “foobar”. In such a case, if a security group G3 has ingress rules permitting access from “foobar”, then it is not possible with the Nova /v2/12345/os-security-groups API to know which group is intended, as the only information it returns about referred groups is the tenant id and name:
With this definition of the API the ingress rule is ambiguous. The code for FindSecurityGroupWithNameAndReturnTrue above implicitly assumes that group names are distinct, and so it will arbitrarily assign the security access to whichever of G1 and G2 it encounters first in the find, possibly the wrong group, thus mapping the rule incorrectly.
The fix for this is probably to switch to using the v3 security groups API in Neutron, which returns the actual security group id in the definitions of ingress rules and not just the name.