[Kimchi-devel] [PATCH] Adding 'link_detected' to netinfo.py
Daniel Henrique Barboza
danielhb at linux.vnet.ibm.com
Tue Nov 4 13:25:12 UTC 2014
'Link_detected' returns 'yes' if the network card is attached
to a cable (or other media), 'no' if it's disconnected and
'n/a' if the link state can't be determined (if the network
interface is down).
This is an information that might be useful for some
plug-ins - Ginger, for instance - to present to the user.
Example of the updated netinfo.get_interface_info call:
$ sudo PYTHONPATH=src python
Python 2.7.5 (default, Sep 25 2014, 13:52:19)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from kimchi import netinfo
>>> netinfo.get_interface_info('em1')
{'status': 'active', 'name': 'em1', 'ipaddr': '', 'netmask': '', 'link_detected': 'no', 'type': 'nic'}
---- with em1 interface down -----
>>> netinfo.get_interface_info('em1')
{'status': 'inactive', 'name': 'em1', 'ipaddr': '', 'netmask': '', 'link_detected': 'n/a', 'type': 'nic'}
>>>
Daniel Henrique Barboza (1):
netinfo.py: adding 'link_detected' to get_interface_info
src/kimchi/netinfo.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--
1.8.3.1
More information about the Kimchi-devel
mailing list