From: Ondrej Lichtner olichtne@redhat.com
The recently added functionality of clearing tc configuration broke recipes that already used netem functionality directly from the configuration XML part. The problem was with trying to clear tc configuration twice.
To fixed this I moved the new functions to be called after deconfigure() takes care of it's own tc configuration. For this to work I also had to add a check for interface existence since deconfigure() can remove the device completely if NetworkManager is used.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Slave/InterfaceManager.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py index 05bd71e..452bd89 100644 --- a/lnst/Slave/InterfaceManager.py +++ b/lnst/Slave/InterfaceManager.py @@ -520,6 +520,13 @@ class Device(object): self._conf_dict = None
def _clear_tc_qdisc(self): + try: + #checks device existence as it might have been removed by + #calling self.deconfigure() + exec_cmd("ip l show %s" % self._name, log_outputs=False) + except: + return + exec_cmd("tc qdisc replace dev %s root pfifo" % self._name) out, _ = exec_cmd("tc filter show dev %s" % self._name) ingress_handles = re.findall("ingress (\d+):", out) @@ -532,6 +539,13 @@ class Device(object): exec_cmd("tc qdisc del dev %s ingress" % self._name)
def _clear_tc_filters(self): + try: + #checks device existence as it might have been removed by + #calling self.deconfigure() + exec_cmd("ip l show %s" % self._name, log_outputs=False) + except: + return + out, _ = exec_cmd("tc filter show dev %s" % self._name) egress_prefs = re.findall("pref (\d+) .* handle", out)
@@ -552,10 +566,10 @@ class Device(object): m_dev.clear_configuration()
if self._conf != None: - self._clear_tc_qdisc() - self._clear_tc_filters() self.down() self.deconfigure() + self._clear_tc_qdisc() + self._clear_tc_filters() self.destroy() self._conf = None self._conf_dict = None
Fri, Aug 26, 2016 at 12:05:45PM CEST, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
The recently added functionality of clearing tc configuration broke recipes that already used netem functionality directly from the configuration XML part. The problem was with trying to clear tc configuration twice.
To fixed this I moved the new functions to be called after deconfigure() takes care of it's own tc configuration. For this to work I also had to add a check for interface existence since deconfigure() can remove the device completely if NetworkManager is used.
For tracking purposes, it is good to have "fixes" tag here. Please add.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
lnst/Slave/InterfaceManager.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py index 05bd71e..452bd89 100644 --- a/lnst/Slave/InterfaceManager.py +++ b/lnst/Slave/InterfaceManager.py @@ -520,6 +520,13 @@ class Device(object): self._conf_dict = None
def _clear_tc_qdisc(self):
try:
#checks device existence as it might have been removed by
#calling self.deconfigure()
exec_cmd("ip l show %s" % self._name, log_outputs=False)
except:
return
exec_cmd("tc qdisc replace dev %s root pfifo" % self._name) out, _ = exec_cmd("tc filter show dev %s" % self._name) ingress_handles = re.findall("ingress (\\d+):", out)
@@ -532,6 +539,13 @@ class Device(object): exec_cmd("tc qdisc del dev %s ingress" % self._name)
def _clear_tc_filters(self):
try:
#checks device existence as it might have been removed by
#calling self.deconfigure()
exec_cmd("ip l show %s" % self._name, log_outputs=False)
except:
return
out, _ = exec_cmd("tc filter show dev %s" % self._name) egress_prefs = re.findall("pref (\\d+) .* handle", out)
@@ -552,10 +566,10 @@ class Device(object): m_dev.clear_configuration()
if self._conf != None:
self._clear_tc_qdisc()
self._clear_tc_filters() self.down() self.deconfigure()
self._clear_tc_qdisc()
self._clear_tc_filters() self.destroy() self._conf = None self._conf_dict = None
-- 2.9.3 _______________________________________________ LNST-developers mailing list lnst-developers@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahoste...
lnst-developers@lists.fedorahosted.org