<div dir="ltr">Ok. I think the bug/1289195 cover it, so we can continue the discussion there.<div><br></div><div>thanks!Xurong</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-12 15:44 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 12/03/14 03:17, Xurong Yang wrote:<br>
> Hi,Lingxian & marios<br>
> Thank for response. yes,personally speaking, it should be using UUID<br>
> instead of 'name' such as network_id port_id as name(not the key) can't<br>
> differentiate security groups. so, i don't know that how about other<br>
> folks's view, maybe we need fix it.<br>
><br>
</div>agreed. OK does the existing bug at<br>
<a href="https://bugs.launchpad.net/neutron/+bug/1289195" target="_blank">https://bugs.launchpad.net/neutron/+bug/1289195</a> cover you? If so let's<br>
continue the discussion there (or create a new one)<br>
<br>
thanks! marios<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
> thanks,Xurong<br>
><br>
><br>
> 2014-03-11 21:33 GMT+08:00 <a href="mailto:marios@redhat.com">marios@redhat.com</a> <<a href="mailto:mandreou@redhat.com">mandreou@redhat.com</a>>:<br>
><br>
>> 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>
>> 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>
>><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<br>
>> 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>
>>> _______________________________________________<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>
>><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>
><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>