From c2971871dd1380b88d58f29211a3e8478aca477a Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 12 Oct 2015 07:15:54 +0100 Subject: Add Pylint to VSPERF commit gate Initial pylint config file has been created to follow current code structure and design. A few issues have been fixed, so currently 56 of 67 files have rating 10/10. There are still issues to be fixed, mainly TODOs/FIXMEs and missing impelentation of abstract class members. Change-Id: Icf5b12c2150258f8ac657f8d50b47a697d1660a0 JIRA: VSPERF-91 Signed-off-by: Martin Klozik Reviewed-by: Maryam Tahhan Reviewed-by: Fatih Degirmenci Reviewed-by: Gene Snider Reviewed-by: Al Morton Reviewed-by: Tv Rao Reviewed-by: Brian Castelli --- src/dpdk/dpdk.py | 5 ++--- src/ovs/daemon.py | 16 +++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py index 0a63c161..e1a8e657 100644 --- a/src/dpdk/dpdk.py +++ b/src/dpdk/dpdk.py @@ -318,9 +318,8 @@ def _unbind_nics(): except subprocess.CalledProcessError: _LOGGER.error('Unable to unbind NICs %s', str(settings.getValue('WHITELIST_NICS'))) - '''Rebind NICs to their original drivers - using the Intel DPDK ``dpdk_nic_bind.py`` tool. - ''' + # Rebind NICs to their original drivers + # using the Intel DPDK ``dpdk_nic_bind.py`` tool. for i, nic in enumerate(settings.getValue('WHITELIST_NICS')): try: if nic_drivers[i] != '': diff --git a/src/ovs/daemon.py b/src/ovs/daemon.py index db096353..0d518ea9 100644 --- a/src/ovs/daemon.py +++ b/src/ovs/daemon.py @@ -44,9 +44,7 @@ class VSwitchd(tasks.Process): """ _ovsdb_pid = None _logfile = _LOG_FILE_VSWITCHD - _ovsdb_pidfile_path = os.path.join(settings.getValue('LOG_DIR'), - "ovsdb_pidfile.pid") - + _ovsdb_pidfile_path = os.path.join(settings.getValue('LOG_DIR'), "ovsdb_pidfile.pid") _proc_name = 'ovs-vswitchd' def __init__(self, timeout=30, vswitchd_args=None, expected_cmd=None): @@ -60,7 +58,7 @@ class VSwitchd(tasks.Process): """ self._logger = logging.getLogger(__name__) self._timeout = timeout - self._expect = expected_cmd; + self._expect = expected_cmd vswitchd_args = vswitchd_args or [] self._cmd = ['sudo', '-E', _OVS_VSWITCHD_BIN] + vswitchd_args @@ -84,7 +82,7 @@ class VSwitchd(tasks.Process): self._kill_ovsdb() raise exc - def kill(self): + def kill(self, signal='-15', sleep=2): """Kill ``ovs-vswitchd`` instance if it is alive. :returns: None @@ -93,7 +91,7 @@ class VSwitchd(tasks.Process): self._kill_ovsdb() - super(VSwitchd, self).kill() + super(VSwitchd, self).kill(signal, sleep) # helper functions @@ -131,7 +129,7 @@ class VSwitchd(tasks.Process): ['sudo', _OVSDB_SERVER_BIN, '--remote=punix:%s' % os.path.join(_OVS_VAR_DIR, 'db.sock'), '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', - '--pidfile=' + self._ovsdb_pidfile_path , '--overwrite-pidfile'], + '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile'], self._logger, 'Starting ovsdb-server...') @@ -140,7 +138,7 @@ class VSwitchd(tasks.Process): :returns: None """ - with open (self._ovsdb_pidfile_path, "r") as pidfile: + with open(self._ovsdb_pidfile_path, "r") as pidfile: ovsdb_pid = pidfile.read().strip() self._logger.info("Killing ovsdb with pid: " + ovsdb_pid) @@ -150,7 +148,7 @@ class VSwitchd(tasks.Process): self._logger, 'Killing ovsdb-server...') @staticmethod - def getDbSockPath(): + def get_db_sock_path(): """Method returns location of db.sock file :returns: path to db.sock file. -- cgit 1.2.3-korg