Skip to content
This repository has been 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

Open
rcarson opened this issue Mar 2, 2015 · 0 comments
Open

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

rcarson opened this issue Mar 2, 2015 · 0 comments

Comments

@rcarson
Copy link

rcarson commented Mar 2, 2015

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant