Re: [openstack-dev] [nova][neutron]A Question about creating instance with duplication sg_name

2014-03-12 Thread mar...@redhat.com
On 12/03/14 03:17, Xurong Yang wrote:
 Hi,Lingxian  marios
 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.
 
agreed. OK does the existing bug at
https://bugs.launchpad.net/neutron/+bug/1289195 cover you? If so let's
continue the discussion there (or create a new one)

thanks! marios


 thanks,Xurong
 
 
 2014-03-11 21:33 GMT+08:00 mar...@redhat.com mandr...@redhat.com:
 
 On 11/03/14 10:20, Xurong Yang wrote:
 It's allowed to create duplicate sg with the same name.
 so exception happens when creating instance with the duplicate sg name.

 Hi Xurong - fyi there is a review open which raises this particular
 point at https://review.openstack.org/#/c/79270/2 (together with
 associated bug).

 imo we shouldn't be using 'name' to distinguish security groups - that's
 what the UUID is for,

 thanks, marios

 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:---exception happened here
 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.
 appreciation if any response.



 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

 
 
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [nova][neutron]A Question about creating instance with duplication sg_name

2014-03-12 Thread Xurong Yang
Ok. I think the bug/1289195 cover it, so we can continue the discussion
there.

thanks!Xurong


2014-03-12 15:44 GMT+08:00 mar...@redhat.com mandr...@redhat.com:

 On 12/03/14 03:17, Xurong Yang wrote:
  Hi,Lingxian  marios
  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.
 
 agreed. OK does the existing bug at
 https://bugs.launchpad.net/neutron/+bug/1289195 cover you? If so let's
 continue the discussion there (or create a new one)

 thanks! marios


  thanks,Xurong
 
 
  2014-03-11 21:33 GMT+08:00 mar...@redhat.com mandr...@redhat.com:
 
  On 11/03/14 10:20, Xurong Yang wrote:
  It's allowed to create duplicate sg with the same name.
  so exception happens when creating instance with the duplicate sg name.
 
  Hi Xurong - fyi there is a review open which raises this particular
  point at https://review.openstack.org/#/c/79270/2 (together with
  associated bug).
 
  imo we shouldn't be using 'name' to distinguish security groups - that's
  what the UUID is for,
 
  thanks, marios
 
  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:---exception happened
 here
  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.
  appreciation if any response.
 
 
 
  ___
  OpenStack-dev mailing list
  OpenStack-dev@lists.openstack.org
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 
 
 
  ___
  OpenStack-dev mailing list
  OpenStack-dev@lists.openstack.org
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 
 
 
 
  ___
  OpenStack-dev mailing list
  OpenStack-dev@lists.openstack.org
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 


 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [nova][neutron]A Question about creating instance with duplication sg_name

2014-03-11 Thread Lingxian Kong
Hi Xurong:

If Neutron is used for security-group functionality, do not come back to
Nova for that. The security-group in Nova is just for backward
compatiblity, IMHO.


2014-03-11 16:20 GMT+08:00 Xurong Yang ido...@gmail.com:

 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:---exception happened here
 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.
 appreciation if any response.


 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




-- 
*---*
*Lingxian Kong*
Huawei Technologies Co.,LTD.
IT Product Line CloudOS PDU
China, Xi'an
Mobile: +86-18602962792
Email: konglingx...@huawei.com; anlin.k...@gmail.com
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [nova][neutron]A Question about creating instance with duplication sg_name

2014-03-11 Thread mar...@redhat.com
On 11/03/14 10:20, Xurong Yang wrote:
 It's allowed to create duplicate sg with the same name.
 so exception happens when creating instance with the duplicate sg name.

Hi Xurong - fyi there is a review open which raises this particular
point at https://review.openstack.org/#/c/79270/2 (together with
associated bug).

imo we shouldn't be using 'name' to distinguish security groups - that's
what the UUID is for,

thanks, marios

 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:---exception happened here
 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.
 appreciation if any response.
 
 
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [nova][neutron]A Question about creating instance with duplication sg_name

2014-03-11 Thread Xurong Yang
Hi,Lingxian  marios
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.

thanks,Xurong


2014-03-11 21:33 GMT+08:00 mar...@redhat.com mandr...@redhat.com:

 On 11/03/14 10:20, Xurong Yang wrote:
  It's allowed to create duplicate sg with the same name.
  so exception happens when creating instance with the duplicate sg name.

 Hi Xurong - fyi there is a review open which raises this particular
 point at https://review.openstack.org/#/c/79270/2 (together with
 associated bug).

 imo we shouldn't be using 'name' to distinguish security groups - that's
 what the UUID is for,

 thanks, marios

  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:---exception happened here
  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.
  appreciation if any response.
 
 
 
  ___
  OpenStack-dev mailing list
  OpenStack-dev@lists.openstack.org
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 


 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev