← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1588118] [NEW] In lbaasv2, when I create a listener, the function _check_pool_loadbalancer_match is not used at the suitable place

 

Public bug reported:

In lbaasv2,listener can be created with para loadbalancer and
default_pool_id.the code is following:

if default_pool_id:
	self._check_pool_exists(context, default_pool_id)
	# Get the loadbalancer from the default_pool_id
	if not lb_id:
		default_pool = self.db.get_pool(context, default_pool_id)
		lb_id = default_pool.loadbalancer.id
		listener['loadbalancer_id'] = lb_id
elif not lb_id:
	raise sharedpools.ListenerMustHaveLoadbalancer()
if default_pool_id and lb_id:
	self._check_pool_loadbalancer_match(
		context, default_pool_id, lb_id)

function _check_pool_loadbalancer_match is used to make sure default_pool has the same lb_id as given.
But if listener is created with no lb_id,lb_id is set to default_pool.loadbalancer.id.
So the check _check_pool_loadbalancer_match does repeated.
The following is better:

if default_pool_id:
	self._check_pool_exists(context, default_pool_id)
	# Get the loadbalancer from the default_pool_id
	if not lb_id:
		default_pool = self.db.get_pool(context, default_pool_id)
		listener['loadbalancer_id'] = default_pool.loadbalancer.id
elif not lb_id:
	raise sharedpools.ListenerMustHaveLoadbalancer()
if default_pool_id and lb_id:
	self._check_pool_loadbalancer_match(
		context, default_pool_id, lb_id)

** Affects: neutron
     Importance: Undecided
     Assignee: JingLiu (liu-jing5)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => JingLiu (liu-jing5)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1588118

Title:
  In lbaasv2,when I create a listener,the function
  _check_pool_loadbalancer_match is not used  at the suitable place

Status in neutron:
  New

Bug description:
  In lbaasv2,listener can be created with para loadbalancer and
  default_pool_id.the code is following:

  if default_pool_id:
  	self._check_pool_exists(context, default_pool_id)
  	# Get the loadbalancer from the default_pool_id
  	if not lb_id:
  		default_pool = self.db.get_pool(context, default_pool_id)
  		lb_id = default_pool.loadbalancer.id
  		listener['loadbalancer_id'] = lb_id
  elif not lb_id:
  	raise sharedpools.ListenerMustHaveLoadbalancer()
  if default_pool_id and lb_id:
  	self._check_pool_loadbalancer_match(
  		context, default_pool_id, lb_id)

  function _check_pool_loadbalancer_match is used to make sure default_pool has the same lb_id as given.
  But if listener is created with no lb_id,lb_id is set to default_pool.loadbalancer.id.
  So the check _check_pool_loadbalancer_match does repeated.
  The following is better:

  if default_pool_id:
  	self._check_pool_exists(context, default_pool_id)
  	# Get the loadbalancer from the default_pool_id
  	if not lb_id:
  		default_pool = self.db.get_pool(context, default_pool_id)
  		listener['loadbalancer_id'] = default_pool.loadbalancer.id
  elif not lb_id:
  	raise sharedpools.ListenerMustHaveLoadbalancer()
  if default_pool_id and lb_id:
  	self._check_pool_loadbalancer_match(
  		context, default_pool_id, lb_id)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1588118/+subscriptions


Follow ups