Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-69 _has_link() in lib/corosync.py returns wrong status in case of …
…link state is Unknown (#82) * GH-69 _has_link() in lib/corosync.py returns wrong status in case of link state is Unknown Fixes #69. The _has_link function does not account for the "unknown" state. This function should use ioctl to retrieve the current attributes of the network interface in question and should check to see if it is both up and running. Signed-off-by: Will Johnson <[email protected]> * - The failing test has an interface with 17 characters. Update the ifreq structure to allow 17 characters. Signed-off-by: Will Johnson <[email protected]> * - Fix spelling Signed-off-by: Will Johnson <[email protected]> * A quick test running in the python repel shows that if the ifr_name is a c_char * 17 the ifr_flags will always be 0, which is not what we want. Setting the type to 16 characters, however, does work, and matches the length specified in /usr/src/kernels/3.10.0-957.1.3.el7_lustre.x86_64/include/uapi/linux/if.h Signed-off-by: Will Johnson <[email protected]> * - Unfortunately, the socket does not return the operstate, which indicates the operational state of the ethernet device. NetLink is an alternative but would require writing a small and complex socket library to get the state. The path of least resistance is to check the value in "/sys/class/net/<devicename>/operstate". This will be one of the valid values listed in https://www.kernel.org/doc/Documentation/networking/operstates.txt. Ultimately, the has_link method should return True if the state is "up", otherwise False. Signed-off-by: Will Johnson <[email protected]> * - Fix tests Signed-off-by: Will Johnson <[email protected]>
- Loading branch information