Skip to content
This repository was archived by the owner on Apr 15, 2021. It is now read-only.
This repository was archived by the owner on Apr 15, 2021. It is now read-only.

How to match /proc/net/bonding/bond* interfaces to bond class #15

Description

@rcarson

Hey, I have added a bond class to proc/net/bonding/init.py but I would like to know how I can get /proc/net/bonding/bond0 to match. This is the code in proc/net/bonding/init.py

"""/proc/net/bonding handlers"""

from procfs.core import File, Dict

class bond(File):
    """/proc/net/bonding/bond*
    """

    def __len__(self):
        return len(self.read())

    def _parse(self, content):
        lines = content.splitlines()
        count = 0
        data = Dict()
        for line in lines:
            if line:
                key, value = line.split(':', 1)
                key = key.strip().replace(' ', '_').lower()
                data[key] = value.strip()
        return data

If I change the class name to bond0 everything works as expected for the bond0 interface, but we have up to 10 bonds per host. Once I understand how I can get /proc/net/bonding/bond* files to create the right class I can submit a pull request. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions