Antoni Segura Puimedon has uploaded a new change for review. Change subject: netinfo: add bridge option reporting ......................................................................
netinfo: add bridge option reporting This patch adds reporting of the bridge options that reside in /sys/class/net/<bridge_name>/bridge/<opt_name> Change-Id: I91ecc4bb652c5f676e62297aa3d6640bfee596fd Signed-off-by: Antoni S. Puimedon <asegu...@redhat.com> --- M lib/vdsm/netinfo.py M vdsm_api/vdsmapi-schema.json 2 files changed, 25 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/26749/1 diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index bfc316c..1734966 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -65,6 +65,7 @@ BONDING_MASTERS = '/sys/class/net/bonding_masters' BONDING_SLAVES = '/sys/class/net/%s/bonding/slaves' BONDING_OPT = '/sys/class/net/%s/bonding/%s' +BRIDGING_OPT = '/sys/class/net/%s/bridge/%s' _BONDING_FAILOVER_MODES = frozenset(('1', '3')) _BONDING_LOADBALANCE_MODES = frozenset(('0', '2', '4', '5', '6')) _IFCFG_ZERO_SUFFIXED = frozenset( @@ -176,6 +177,24 @@ with open(path) as optFile: opts[os.path.basename(path)] = [ el for el in optFile.read().rstrip().split(' ') if el] + return opts + + +def bridgeOpts(bridge, keys=None): + """Returns a dictionary of bridge option name and value. E.g., + {'max_age': '2000', 'gc_timer': '332'}""" + BR_KEY_BLACKLIST = ('flush',) + if keys is None: + paths = iglob(BRIDGING_OPT % (bridge, '*')) + else: + paths = (BRIDGING_OPT % (bridge, key) for key in keys) + opts = {} + for path in paths: + key = os.path.basename(path) + if key in BR_KEY_BLACKLIST: + continue + with open(path) as optFile: + opts[key] = optFile.read().rstrip() return opts @@ -512,7 +531,8 @@ info.update({'gateway': getgateway(gateways, link.name), 'ipv6gateway': ipv6routes.get(link.name, '::'), 'ports': ports(link.name), - 'stp': bridge_stp_state(link.name)}) + 'stp': bridge_stp_state(link.name), + 'opts': bridgeOpts(link.name)}) return info diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json index 31bd869..2523df1 100644 --- a/vdsm_api/vdsmapi-schema.json +++ b/vdsm_api/vdsmapi-schema.json @@ -589,6 +589,9 @@ # # @qosOutbound: #optional BandwidthParams for outgoing traffic. # +# @bridge_opts: A map containing information about the bridge specific options. +# (new in version 4.15.0) +# # Since: 4.10.0 # XXX: Add types for IP Address? ## @@ -597,7 +600,7 @@ 'netmask': 'str', 'gateway': 'str', 'ipv6addrs': ['str'], 'ipv6gateway': 'str', 'mtu': 'uint', 'cfg': 'StringMap', 'bridged': 'bool', '*qosInbound': 'BandwidthParams', - '*qosOutbound': 'BandwidthParams'}} + '*qosOutbound': 'BandwidthParams', 'opts': 'StringMap'}} ## # @NetInfoBridgelessNetwork: -- To view, visit http://gerrit.ovirt.org/26749 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I91ecc4bb652c5f676e62297aa3d6640bfee596fd Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <asegu...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches