<div dir="ltr">Hi,Lingxian & marios<div>Thank for response. yes,personally speaking, it should be using UUID instead of 'name' such as network_id port_id as name(not the key) can't differentiate security groups. so, i don't know that how about other folks's view, maybe we need fix it.</div>
<div><br></div><div>thanks,Xurong  </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-11 21:33 GMT+08:00 <a href="mailto:marios@redhat.com">marios@redhat.com</a> <span dir="ltr"><<a href="mailto:mandreou@redhat.com" target="_blank">mandreou@redhat.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 11/03/14 10:20, Xurong Yang wrote:<br>
> It's allowed to create duplicate sg with the same name.<br>
> so exception happens when creating instance with the duplicate sg name.<br>
<br>
</div>Hi Xurong - fyi there is a review open which raises this particular<br>
point at <a href="https://review.openstack.org/#/c/79270/2" target="_blank">https://review.openstack.org/#/c/79270/2</a> (together with<br>
associated bug).<br>
<br>
imo we shouldn't be using 'name' to distinguish security groups - that's<br>
what the UUID is for,<br>
<br>
thanks, marios<br>
<div class="HOEnZb"><div class="h5"><br>
> code following:<br>
>         ....<br>
>         security_groups = kwargs.get('security_groups', [])<br>
>         security_group_ids = []<br>
><br>
>         # TODO(arosen) Should optimize more to do direct query for security<br>
>         # group if len(security_groups) == 1<br>
>         if len(security_groups):<br>
>             search_opts = {'tenant_id': instance['project_id']}<br>
>             user_security_groups = neutron.list_security_groups(<br>
>                 **search_opts).get('security_groups')<br>
><br>
>         for security_group in security_groups:<br>
>             name_match = None<br>
>             uuid_match = None<br>
>             for user_security_group in user_security_groups:<br>
>                 if user_security_group['name'] == security_group:<br>
>                     if name_match:---------------exception happened here<br>
>                         raise exception.NoUniqueMatch(<br>
>                             _("Multiple security groups found matching"<br>
>                               " '%s'. Use an ID to be more specific.") %<br>
>                                security_group)<br>
><br>
>                     name_match = user_security_group['id']<br>
>       ....<br>
><br>
> so it's maybe improper to create instance with the sg name parameter.<br>
> appreciation if any response.<br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>