<div dir="ltr"><div dir="ltr" style="font-family:arial,sans-serif;font-size:14px"><div>It's allowed to create duplicate sg with the same name.</div><div>so exception happens when creating instance with the duplicate sg name.</div>
<div>code following:</div><div>        ....</div><div><div>        security_groups = kwargs.get('security_groups', [])</div><div>        security_group_ids = []</div><div><br></div><div>        # TODO(arosen) Should optimize more to do direct query for security</div>
<div>        # group if len(security_groups) == 1</div><div>        if len(security_groups):</div><div>            search_opts = {'tenant_id': instance['project_id']}</div><div>            user_security_groups = neutron.list_security_groups(</div>
<div>                **search_opts).get('security_groups')</div><div><br></div><div>        for security_group in security_groups:</div><div>            name_match = None</div><div>            uuid_match = None</div>
<div>            for user_security_group in user_security_groups:</div><div>                if user_security_group['name'] == security_group:</div><div>                    if name_match:---------------exception happened here</div>
<div>                        raise exception.NoUniqueMatch(</div><div>                            _("Multiple security groups found matching"</div><div>                              " '%s'. Use an ID to be more specific.") %</div>
<div>                               security_group)</div><div><br></div><div>                    name_match = user_security_group['id']</div><div>      ....</div><div><br></div><div>so it's maybe improper to create instance with the sg name parameter. appreciation if any response. </div>
<div><br></div></div></div></div>