Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Fallback to Matching Bond Devices Against HWADDR #304

Open
bensallen opened this issue Jan 24, 2022 · 1 comment
Open

Support Fallback to Matching Bond Devices Against HWADDR #304

bensallen opened this issue Jan 24, 2022 · 1 comment

Comments

@bensallen
Copy link
Member

Similar to what is currently done for normal interfaces at https://github.com/warewulf/warewulf3/blob/development/provision/initramfs/init#L428, fallback to matching against HWADDR for bonding devices. Currently only interface names are matched against in bondup().

@bensallen
Copy link
Member Author

Will generalize https://github.com/warewulf/warewulf3/blob/development/provision/initramfs/init#L428 into a function so it can be called there and within bondup. Something like:

find_interface() {
    local HWADDR=$1
    local DEV 
    for DEV in $(echo /sys/class/net/* | xargs -n1 /usr/bin/basename | grep -v lo); do
        local DEVHWADDR=$(cat /sys/class/net/$DEV/address)
        # Use GUID if IB
        if [ ${#DEVHWADDR} -eq 59 ]; then
            DEVHWADDR=$(expr substr $DEVHWADDR 37 23)
        fi
        if [ $DEVHWADDR == $HWADDR ]; then
            echo $DEV
            return 0
        fi
    done
    return 1
}

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

No branches or pull requests

1 participant