Fix iptables rule removal warnings from QoS extension
Since iptables chain removal "cascades", it will remove rules in other chains that jump to it. Because of this, there is no need to explicitly remove these jump rules, as it will just generate a warning of the type: "Tried to remove rule that was not there". Trivialfix Change-Id: I0638562400f3bcac689d94eb2a44eae9d2890782
This commit is contained in:
parent
c7e144e9b4
commit
8afe3beb7f
|
@ -142,16 +142,12 @@ class QosLinuxbridgeAgentDriver(qos.QosLinuxAgentDriver):
|
|||
def _delete_outgoing_qos_chain_for_port(self, port):
|
||||
chain_name = self._dscp_chain_name(
|
||||
const.EGRESS_DIRECTION, port['device'])
|
||||
chain_rule = self._dscp_rule(
|
||||
const.EGRESS_DIRECTION, port['device'])
|
||||
# Iptables chain removal "cascades", and will remove rules in
|
||||
# other chains that jump to it, like those added above.
|
||||
if self._qos_chain_is_empty(port, 4):
|
||||
self.iptables_manager.ipv4['mangle'].remove_chain(chain_name)
|
||||
self.iptables_manager.ipv4['mangle'].remove_rule('POSTROUTING',
|
||||
chain_rule)
|
||||
if self._qos_chain_is_empty(port, 6):
|
||||
self.iptables_manager.ipv6['mangle'].remove_chain(chain_name)
|
||||
self.iptables_manager.ipv6['mangle'].remove_rule('POSTROUTING',
|
||||
chain_rule)
|
||||
|
||||
def _set_dscp_mark_rule(self, port, dscp_value):
|
||||
chain_name = self._dscp_chain_name(
|
||||
|
|
|
@ -242,9 +242,6 @@ class QosLinuxbridgeAgentDriverTestCase(base.BaseTestCase):
|
|||
self._dscp_rule_tag(self.port['device'])),
|
||||
mock.call.remove_chain(
|
||||
dscp_chain_name),
|
||||
mock.call.remove_rule(
|
||||
"POSTROUTING",
|
||||
self._dscp_postrouting_rule(self.port['device']))
|
||||
]
|
||||
with mock.patch.object(
|
||||
self.qos_driver, "iptables_manager") as iptables_manager:
|
||||
|
|
Loading…
Reference in New Issue