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 dbd6d45457
commit 504f496d6b
2 changed files with 7 additions and 10 deletions

View File

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

View File

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