From a70d3f379e7551851cffffcdd77410210235c47c Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Wed, 24 Aug 2016 10:07:48 +0300 Subject: better logger for master_daemon verify root priveleges in dpdk_* scripts call to functions of show status instead of calling process --- scripts/dpdk_nic_bind.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts/dpdk_nic_bind.py') 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() -- cgit 1.2.3-korg