diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-06-17 15:39:00 +0300 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2016-06-17 15:39:00 +0300 |
commit | 3207f14a91cc01b44b28ba541e5968f58a7e5ec2 (patch) | |
tree | 385b01222b2ad25a9b98403634b7e0b4161c40ea /scripts/automation/trex_control_plane/server/trex_server.py | |
parent | 0e3621ee07983ce18b83761a794356e910702c42 (diff) |
add ctrl+c as first try to kill daemons/TRex.
master daemon change directory to "/" to deal with case it's directory was deleted and update_trex() was used.
remove check connection to daemons as part of init of client (can be done manually per needed daemon)
Diffstat (limited to 'scripts/automation/trex_control_plane/server/trex_server.py')
-rwxr-xr-x | scripts/automation/trex_control_plane/server/trex_server.py | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/scripts/automation/trex_control_plane/server/trex_server.py b/scripts/automation/trex_control_plane/server/trex_server.py index 5e278a74..3da629ec 100755 --- a/scripts/automation/trex_control_plane/server/trex_server.py +++ b/scripts/automation/trex_control_plane/server/trex_server.py @@ -387,23 +387,14 @@ class CTRexServer(object): return trex_cmds_list - def kill_all_trexes(self): + # Silently tries to kill TRexes with given signal. + # Responsibility of client to verify with get_trex_cmds. + def kill_all_trexes(self, signal_name): logger.info('Processing kill_all_trexes() command.') trex_cmds_list = self.get_trex_cmds() - if not trex_cmds_list: - return False for pid, cmd in trex_cmds_list: - logger.info('Killing process %s %s' % (pid, cmd)) - run_command('kill %s' % pid) - ret_code_ps, _, _ = run_command('ps -p %s' % pid) - if not ret_code_ps: - logger.info('Killing with -9.') - run_command('kill -9 %s' % pid) - ret_code_ps, _, _ = run_command('ps -p %s' % pid) - if not ret_code_ps: - logger.info('Could not kill process.') - raise Exception('Could not kill process %s %s' % (pid, cmd)) - return True + logger.info('Killing with signal %s process %s %s' % (signal_name, pid, cmd)) + os.kill(int(pid), signal_name) def wait_until_kickoff_finish (self, timeout = 40): |