summaryrefslogtreecommitdiffstats
path: root/src/ovs
diff options
context:
space:
mode:
authorMichal Weglicki <michalx.weglicki@intel.com>2015-07-24 10:42:38 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2015-08-06 09:40:55 +0000
commit06468e123bdcbf5930abdf9d5d9e2432a7159839 (patch)
treeffb137fcace56e1fec6b3f064ffe0d609e56f807 /src/ovs
parentcb5400b079ec8aacfd6dac73cbf59b74bbcb4e1e (diff)
Vanilla OVS support implementation
JIRA: VSPERF-57 This patch implements Vanilla OVS support.It contains: * New IVswitch implementation: OvsVanilla, * New configuration contants, * New mandatory configuration variable: VSWITCH_VANILLA_PHY_PORT_NAMES for Vanilla OVS has been added, * Virtual ports are not yet implemented, * Some kernel modules wrapping methods has been moved from dpdk.py to tools. * Fixed bug where ovsdb hasn't been killed at the end of test case run on some platforms. Change-Id: I21a0d84dbc4004aae564d5547387a2563f2d1e5b Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> Reviewed-by: Eugene Snider <Eugene.Snider@huawei.com> Reviewed-by: Gurpreet Singh <gurpreet.singh@spirent.com> Reviewed-by: Tv Rao <tv.rao@freescale.com> Reviewed-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Billy O Mahony <billy.o.mahony@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Diffstat (limited to 'src/ovs')
-rw-r--r--src/ovs/daemon.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/ovs/daemon.py b/src/ovs/daemon.py
index 323644c6..db096353 100644
--- a/src/ovs/daemon.py
+++ b/src/ovs/daemon.py
@@ -44,12 +44,12 @@ class VSwitchd(tasks.Process):
"""
_ovsdb_pid = None
_logfile = _LOG_FILE_VSWITCHD
+ _ovsdb_pidfile_path = os.path.join(settings.getValue('LOG_DIR'),
+ "ovsdb_pidfile.pid")
-
- _expect = r'EAL: Master l*core \d+ is ready'
_proc_name = 'ovs-vswitchd'
- def __init__(self, timeout=30, vswitchd_args=None):
+ def __init__(self, timeout=30, vswitchd_args=None, expected_cmd=None):
"""Initialise the wrapper with a specific start timeout and extra
parameters.
@@ -60,8 +60,8 @@ class VSwitchd(tasks.Process):
"""
self._logger = logging.getLogger(__name__)
self._timeout = timeout
+ self._expect = expected_cmd;
vswitchd_args = vswitchd_args or []
-
self._cmd = ['sudo', '-E', _OVS_VSWITCHD_BIN] + vswitchd_args
# startup/shutdown
@@ -72,6 +72,7 @@ class VSwitchd(tasks.Process):
:returns: None
:raises: pexpect.EOF, pexpect.TIMEOUT
"""
+
self._reset_ovsdb()
self._start_ovsdb() # this has to be started first
@@ -79,6 +80,7 @@ class VSwitchd(tasks.Process):
super(VSwitchd, self).start()
self.relinquish()
except (pexpect.EOF, pexpect.TIMEOUT) as exc:
+ logging.error("Exception during VSwitch start.")
self._kill_ovsdb()
raise exc
@@ -125,10 +127,11 @@ class VSwitchd(tasks.Process):
self._logger,
'Creating ovsdb configuration database...')
- self._ovsdb_pid = tasks.run_background_task(
+ tasks.run_background_task(
['sudo', _OVSDB_SERVER_BIN,
'--remote=punix:%s' % os.path.join(_OVS_VAR_DIR, 'db.sock'),
- '--remote=db:Open_vSwitch,Open_vSwitch,manager_options'],
+ '--remote=db:Open_vSwitch,Open_vSwitch,manager_options',
+ '--pidfile=' + self._ovsdb_pidfile_path , '--overwrite-pidfile'],
self._logger,
'Starting ovsdb-server...')
@@ -137,6 +140,19 @@ class VSwitchd(tasks.Process):
:returns: None
"""
- if self._ovsdb_pid:
- tasks.run_task(['sudo', 'kill', '-15', str(self._ovsdb_pid)],
+ with open (self._ovsdb_pidfile_path, "r") as pidfile:
+ ovsdb_pid = pidfile.read().strip()
+
+ self._logger.info("Killing ovsdb with pid: " + ovsdb_pid)
+
+ if ovsdb_pid:
+ tasks.run_task(['sudo', 'kill', '-15', str(ovsdb_pid)],
self._logger, 'Killing ovsdb-server...')
+
+ @staticmethod
+ def getDbSockPath():
+ """Method returns location of db.sock file
+
+ :returns: path to db.sock file.
+ """
+ return os.path.join(_OVS_VAR_DIR, 'db.sock')