Dan Kenigsberg has uploaded a new change for review. Change subject: tc: unsetPortMirroring: deleting a target twice is fine ......................................................................
tc: unsetPortMirroring: deleting a target twice is fine We should not explode if a mirroring target is already gone when unsetPortMirroring is called. Change-Id: I90f90164557548d38aa0e6991c4020055f892edb Signed-off-by: Dan Kenigsberg <[email protected]> --- M vdsm/tc.py 1 file changed, 17 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/7630/1 diff --git a/vdsm/tc.py b/vdsm/tc.py index 570c410..47a7b96 100644 --- a/vdsm/tc.py +++ b/vdsm/tc.py @@ -47,13 +47,21 @@ def _delTarget(network, parent, target): - filt = list(filters(network, parent))[0] - filt.actions.remove(MirredAction(target)) - if filt.actions: + fs = list(filters(network, parent)) + if fs: + filt = fs[0] + else: + return set([]) + + acts = set(filt.actions) + acts.discard(MirredAction(target)) + + if acts: + filt = Filter(prio=filt.prio, handle=filt.handle, actions=acts) filter_replace(network, parent, filt) else: filter_del(network, target, parent, filt.prio) - return filt.actions + return acts def setPortMirroring(network, target): @@ -71,8 +79,11 @@ # TODO handle the case where we have partial definitions on device due to # vdsm crash acts = _delTarget(network, QDISC_INGRESS, target) - qdisc_id = _qdiscs_of_device(network).next() - acts += _delTarget(network, qdisc_id, target) + try: + qdisc_id = _qdiscs_of_device(network).next() + acts |= _delTarget(network, qdisc_id, target) + except StopIteration: + pass if not acts: qdisc_del(network, 'root') -- To view, visit http://gerrit.ovirt.org/7630 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I90f90164557548d38aa0e6991c4020055f892edb Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
