diff options
author | 2017-11-15 08:24:29 +0000 | |
---|---|---|
committer | 2017-11-15 08:24:29 +0000 | |
commit | 66a2773d89c689d1b8740aa2388164582e9ccb6c (patch) | |
tree | 6d427256960f314d8ac7152f7497f3f6ea033811 /vswitches/ovs.py | |
parent | 31770a64cd8a5c40ee3657ac97e87a900f7aeca5 (diff) | |
parent | b1534957e463b5e34957a8d48ce5c6b0552ffbb4 (diff) |
Merge "teststeps: Improvements and bugfixing of teststeps"
Diffstat (limited to 'vswitches/ovs.py')
-rw-r--r-- | vswitches/ovs.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vswitches/ovs.py b/vswitches/ovs.py index 7e16c142..76cabb0d 100644 --- a/vswitches/ovs.py +++ b/vswitches/ovs.py @@ -91,6 +91,27 @@ class IVSwitchOvs(IVSwitch, tasks.Process): self._logger.info("Vswitchd...Started.") + def restart(self): + """ Restart ``ovs-vswitchd`` instance. ``ovsdb-server`` is not restarted. + + :raises: pexpect.EOF, pexpect.TIMEOUT + """ + self._logger.info("Restarting vswitchd...") + if os.path.isfile(self._vswitchd_pidfile_path): + self._logger.info('Killing ovs-vswitchd...') + with open(self._vswitchd_pidfile_path, "r") as pidfile: + vswitchd_pid = pidfile.read().strip() + tasks.terminate_task(vswitchd_pid, logger=self._logger) + + try: + tasks.Process.start(self) + self.relinquish() + except (pexpect.EOF, pexpect.TIMEOUT) as exc: + logging.error("Exception during VSwitch start.") + self._kill_ovsdb() + raise exc + self._logger.info("Vswitchd...Started.") + def configure(self): """ Configure vswitchd through ovsdb if needed """ @@ -109,6 +130,7 @@ class IVSwitchOvs(IVSwitch, tasks.Process): """ self._logger.info("Terminating vswitchd...") self.kill() + self._bridges = {} self._logger.info("Vswitchd...Terminated.") def add_switch(self, switch_name, params=None): @@ -488,3 +510,8 @@ class IVSwitchOvs(IVSwitch, tasks.Process): """ bridge = self._bridges[switch_name] return 'stp_enable : true' in ''.join(bridge.bridge_info()) + + def validate_restart(self, dummy_result): + """ Validate restart + """ + return True |