diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-08-24 10:07:48 +0300 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-08-24 10:07:48 +0300 |
commit | a70d3f379e7551851cffffcdd77410210235c47c (patch) | |
tree | 1aa148ca6f506e2afe48d850e542931357a1357f /scripts/dpdk_nic_bind.py | |
parent | 8634fdc567b948b35c2a87cea4679aff3995cba6 (diff) |
better logger for master_daemon
verify root priveleges in dpdk_* scripts
call to functions of show status instead of calling process
Diffstat (limited to 'scripts/dpdk_nic_bind.py')
-rwxr-xr-x | scripts/dpdk_nic_bind.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/dpdk_nic_bind.py b/scripts/dpdk_nic_bind.py index d9df92e0..36f18adb 100755 --- a/scripts/dpdk_nic_bind.py +++ b/scripts/dpdk_nic_bind.py @@ -41,6 +41,7 @@ import texttable sys.path.remove(text_tables_path) import re import termios +import getpass # The PCI device class for ETHERNET devices ETHERNET_CLASS = "0200" @@ -544,6 +545,8 @@ def show_status(): to the user what devices are bound to the igb_uio driver, the kernel driver or to no driver''' global dpdk_drivers + if not devices: + get_nic_details() kernel_drv = [] dpdk_drv = [] no_drv = [] @@ -598,6 +601,8 @@ def show_table(): '''Function called when the script is passed the "--table" option. Similar to show_status() function, but shows more info: NUMA etc.''' global dpdk_drivers + if not devices: + get_nic_details() dpdk_drv = [] for d in devices.keys(): if devices[d].get("Driver_str") in dpdk_drivers: @@ -695,4 +700,7 @@ def main(): do_arg_actions() if __name__ == "__main__": + if getpass.getuser() != 'root': + print('Please run this program as root/with sudo') + exit(1) main() |