Antoni Segura Puimedon has uploaded a new change for review. Change subject: tc: Integrate Host QoS with network deletion via setupNetworks ......................................................................
tc: Integrate Host QoS with network deletion via setupNetworks This patch makes it possible to leverage the network.tc package to remove outbound Host network Quality of Service. When deleting the last shaped network of a device the qdiscs will be deleted so that they go back to being the kernel default (just a single pfifo_fast, at the moment). Change-Id: I28a3676af1553052e7cdea515faa29e847b7d3c0 Signed-off-by: Antoni S. Puimedon <[email protected]> --- M vdsm/network/api.py M vdsm/network/configurators/qos.py 2 files changed, 31 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/31440/1 diff --git a/vdsm/network/api.py b/vdsm/network/api.py index 7a8d920..f4ca052 100755 --- a/vdsm/network/api.py +++ b/vdsm/network/api.py @@ -475,6 +475,9 @@ # it still has users and thus does not allow its removal configurator.removeLibvirtNetwork(network) netEnt.remove() + # We must remove the QoS last so that no devices nor networks mark the + # QoS as used + configurator.removeQoS(netEnt) def clientSeen(timeout): diff --git a/vdsm/network/configurators/qos.py b/vdsm/network/configurators/qos.py index e1f444c..12ec3b1 100644 --- a/vdsm/network/configurators/qos.py +++ b/vdsm/network/configurators/qos.py @@ -20,6 +20,8 @@ import os from distutils.version import StrictVersion +from vdsm import netinfo + from .. import tc _NON_VLANNED_ID = 5000 _DEFAULT_CLASSID = '%x' % _NON_VLANNED_ID @@ -48,7 +50,32 @@ def remove_outbound(top_device): """Removes the qosOutbound configuration from the device and restores pfifo_fast if it was the last QoSed network on the device""" - raise NotImplementedError + description = top_device.description + vlan_tag = description.get('vlan_tag') + device = description['log_dev'] + class_id = _NON_VLANNED_ID if vlan_tag is None else '%x' % vlan_tag + try: + tc.filter.delete( + device, pref=_NON_VLANNED_ID if vlan_tag is None else vlan_tag) + except tc.TrafficControlException as tce: + if tce.errCode != errno.EINVAL: # no filter exists + raise + + qdiscs = list(tc._qdiscs(device)) + root_qdisc_handle = _root_qdisc(qdiscs)['handle'] + try: + tc.cls.delete(device, classid=root_qdisc_handle + class_id) + except tc.TrafficControlException as tce: + if tce.errCode != errno.ENOENT: + raise + + cls = list(tc._classes(parent=root_qdisc_handle)) + if (not cls or + (len(cls) == 1 and not netinfo.ifaceUsed(device) and + cls['handle'] == root_qdisc_handle + _DEFAULT_CLASSID)): + # No (or only the networkless default) traffic class remains + tc._qdisc_del(device) + tc._qdisc_del(device, kind='ingress') def _fresh_qdisc_conf_out(dev, vlan_tag, class_id, qos): -- To view, visit http://gerrit.ovirt.org/31440 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I28a3676af1553052e7cdea515faa29e847b7d3c0 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
