"lbaas delete l7 rule" Parameter Passing Error
Description:
Could not delete lbaas l7 rule from l7 policy properly.
In plugin side, we tried to delete the records of l7
rules in the database by the following code
"self.db.self.db.delete_l7policy_rule(context, id, l7policy_id)".
However, in db side, the func delete_l7policy_rule is defined as
" def delete_l7policy_rule(self, context, id):"
Therefore, the parameter "l7policy_id", could not be handled.
As a result, when delete lbaas l7 rule,
the following mistakes will happen:
"TypeError: delete_l7policy_rule() takes exactly 3 arguments (4 given)"
Story: 2005361
Task: 30333
Change-Id: I7c08708ff9d8600b880c4948d41d966c816405fd
(cherry picked from commit 3bf5e2c026
)
This commit is contained in:
parent
f7aa233108
commit
e22276df05
|
@ -1041,7 +1041,7 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
self._call_driver_operation(context, driver.l7rule.delete,
|
||||
rule_db)
|
||||
else:
|
||||
self.db.delete_l7policy_rule(context, id, l7policy_id)
|
||||
self.db.delete_l7policy_rule(context, id)
|
||||
|
||||
def get_l7policy_rules(self, context, l7policy_id,
|
||||
filters=None, fields=None):
|
||||
|
|
|
@ -23,6 +23,7 @@ from oslo_utils import uuidutils
|
|||
from webob import exc
|
||||
|
||||
from neutron_lbaas.extensions import healthmonitor_max_retries_down as hm_down
|
||||
from neutron_lbaas.extensions import l7
|
||||
from neutron_lbaas.extensions import lb_network_vip
|
||||
from neutron_lbaas.extensions import loadbalancerv2
|
||||
from neutron_lbaas.extensions import sharedpools
|
||||
|
@ -33,6 +34,27 @@ _uuid = uuidutils.generate_uuid
|
|||
_get_path = test_base._get_path
|
||||
|
||||
|
||||
class TestL7ExtensionTestCase(base.ExtensionTestCase):
|
||||
fmt = 'json'
|
||||
|
||||
def setUp(self):
|
||||
super(TestL7ExtensionTestCase, self).setUp()
|
||||
self.setup_extension(
|
||||
'neutron_lbaas.extensions.loadbalancerv2.LoadBalancerPluginBaseV2',
|
||||
constants.LOADBALANCERV2, l7.L7, 'lbaas')
|
||||
|
||||
def test_delete_l7policy_rule(self):
|
||||
entity_id = _uuid()
|
||||
res = self.api.delete(
|
||||
test_base._get_path('lbaas/l7policies/l7pid1/rules',
|
||||
id=entity_id, fmt=self.fmt))
|
||||
delete_entity = getattr(self.plugin.return_value,
|
||||
"delete_l7policy_rule")
|
||||
delete_entity.assert_called_with(mock.ANY, entity_id,
|
||||
l7policy_id='l7pid1')
|
||||
self.assertEqual(res.status_int, exc.HTTPNoContent.code)
|
||||
|
||||
|
||||
class TestLoadBalancerExtensionV2TestCase(base.ExtensionTestCase):
|
||||
fmt = 'json'
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Correct the parameter passing error when using lbaas to delete l7 rule.
|
Loading…
Reference in New Issue