fix --excluded of meter-label-rule-create is not working

rule['excluded'] is boolean type, should not be compared with 'true'

Closes-Bug: #1248002
Change-Id: Ie78c307ede1f7124c58354825a411474ff6c1234
This commit is contained in:
Siming Yin 2013-12-11 15:28:46 +08:00
parent 1020281a0a
commit efee9afd72
2 changed files with 7 additions and 10 deletions

View File

@ -154,7 +154,7 @@ class IptablesMeteringDriver(abstract_driver.MeteringAbstractDriver):
if rule['direction'] == 'egress':
dir = '-o ' + ext_dev
if rule['excluded'] == 'true':
if rule['excluded']:
ipt_rule = dir + ' -d ' + remote_ip + ' -j RETURN'
im.ipv4['filter'].add_rule(rules_chain, ipt_rule, wrap=False,
top=True)

View File

@ -142,9 +142,8 @@ class IptablesDriverTestCase(base.BaseTestCase):
'',
wrap=False),
call.add_rule('neutron-meter-r-eeef45da-c60',
'-i qg-7d411f48-ec -d 20.0.0.0/24 -j '
'neutron-meter-l-eeef45da-c60',
wrap=False, top=False)]
'-i qg-7d411f48-ec -d 20.0.0.0/24 -j RETURN',
wrap=False, top=True)]
self.v4filter_inst.assert_has_calls(calls)
@ -194,9 +193,8 @@ class IptablesDriverTestCase(base.BaseTestCase):
wrap=False, top=False),
call.empty_chain('neutron-meter-r-c5df2fe5-c60', wrap=False),
call.add_rule('neutron-meter-r-c5df2fe5-c60',
'-o qg-6d411f48-ec -d 10.0.0.0/24 -j '
'neutron-meter-l-c5df2fe5-c60',
wrap=False, top=False),
'-o qg-6d411f48-ec -d 10.0.0.0/24 -j RETURN',
wrap=False, top=True),
call.add_rule('neutron-meter-r-c5df2fe5-c60',
'-i qg-6d411f48-ec -d 20.0.0.0/24 -j '
'neutron-meter-l-c5df2fe5-c60',
@ -358,9 +356,8 @@ class IptablesDriverTestCase(base.BaseTestCase):
'',
wrap=False),
call.add_rule('neutron-meter-r-eeef45da-c60',
'-i qg-7d411f48-ec -d 20.0.0.0/24 -j '
'neutron-meter-l-eeef45da-c60',
wrap=False, top=False),
'-i qg-7d411f48-ec -d 20.0.0.0/24 -j RETURN',
wrap=False, top=True),
call.remove_chain('neutron-meter-l-c5df2fe5-c60', wrap=False),
call.remove_chain('neutron-meter-r-c5df2fe5-c60', wrap=False),
call.add_chain('neutron-meter-l-c5df2fe5-c60', wrap=False),