Revert "Kill hung frame listeners on each verify networks event"

This reverts commit 7fff2f88a6.
Closes-Bug: 1470729

Change-Id: Ia51205f73ad546e3a17d4986de8f381fe7573161
This commit is contained in:
Dmitry Shulyak 2015-07-02 06:39:25 +00:00
parent 7fff2f88a6
commit 1aa4d997c7
1 changed files with 12 additions and 19 deletions

View File

@ -22,7 +22,6 @@ module MCollective
class Net_probe<RPC::Agent
def startup_hook
@pattern = "/var/tmp/net-probe-dump*"
@piddir = '/var/run/net_probe'
end
action "multicast_listen" do
@ -43,7 +42,7 @@ module MCollective
end
action "start_frame_listeners" do
kill_frame_listeners
cleanup_netprobe
start_frame_listeners
end
@ -100,6 +99,11 @@ module MCollective
end
end
def cleanup_netprobe
status = run("pkill net_probe.py && sleep 2 && pgrep net_probe.py")
reply.fail! "Cant stop net_probe.py execution." unless status == 1
end
def start_frame_listeners
validate :interfaces, String
config = {
@ -114,6 +118,9 @@ module MCollective
config.merge!(JSON.parse(request[:config]))
end
# we want to be sure that there is no frame listeners running
stop_frame_listeners
# wipe out old stuff before start
Dir.glob(@pattern).each do |file|
File.delete file
@ -195,23 +202,9 @@ module MCollective
f
end
def kill_frame_listeners
net_probe_pattern = 'net_probe.py'
Dir.glob('/proc/[0-9]*/cmdline').each do |proc|
if File.read(proc).include? net_probe_pattern
Process.kill('KILL', proc.split('/')[2].to_i)
end
end
# and wipe out all old pidfiles
Dir.glob(File.join(@piddir, '*')).each do |pidfile|
File.unlink(pidfile)
end
end
def stop_frame_listeners
pidfiles = Dir.glob(File.join(@piddir, '*'))
piddir = "/var/run/net_probe"
pidfiles = Dir.glob(File.join(piddir, '*'))
# Send SIGINT to all PIDs in piddir.
pidfiles.each do |f|
begin
@ -233,7 +226,7 @@ module MCollective
end
end
end
pidfiles = Dir.glob(File.join(@piddir, '*'))
pidfiles = Dir.glob(File.join(piddir, '*'))
end
end
end