[openstack-dev] [neutron]The duplicate name of security group

Xurong Yang idopra at gmail.com
Mon Mar 10 10:15:25 UTC 2014


More detail:
It's allowed to create duplicate sg with the same name.
so exception happens when creating instance with the duplicate sg name.
code following:
        ....
        security_groups = kwargs.get('security_groups', [])
        security_group_ids = []

        # TODO(arosen) Should optimize more to do direct query for security
        # group if len(security_groups) == 1
        if len(security_groups):
            search_opts = {'tenant_id': instance['project_id']}
            user_security_groups = neutron.list_security_groups(
                **search_opts).get('security_groups')

        for security_group in security_groups:
            name_match = None
            uuid_match = None
            for user_security_group in user_security_groups:
                if user_security_group['name'] == security_group:
                    if name_match:
                        raise exception.NoUniqueMatch(
                            _("Multiple security groups found matching"
                              " '%s'. Use an ID to be more specific.") %
                               security_group)

                    name_match = user_security_group['id']
      ....

so it's maybe improper to create instance with the sg name parameter. any
commend?



2014-03-07 16:25 GMT+08:00 黎林果 <lilinguo8212 at gmail.com>:

> Hi stackers,
>
>
> The duplicate name of sg may cause some problems, do you think so?
>
> https://bugs.launchpad.net/neutron/+bug/1289195
>
> Thanks!
>
> Lee Li
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140310/10f26769/attachment.html>


More information about the OpenStack-dev mailing list