mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
im-collectd: Add mutex to the sync command
This commit is contained in:
1 parent
0efc81f0ef
commit
9146b2ef35
1 file changed
+8
-1
@@ -189,12 +189,19 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
host_errors = Array.new
|
||||
lock = Mutex.new
|
||||
|
||||
ts = hs_threads.map do |t|
|
||||
Thread.new {
|
||||
t.each do |host|
|
||||
sync_cmd = "scp -rp #{REMOTES_LOCATION}/. #{host}:#{remote_dir} 2> /dev/null"
|
||||
`#{sync_cmd} 2>/dev/null`
|
||||
host_errors << host if !$?.success?
|
||||
|
||||
if !$?.success?
|
||||
lock.synchronize {
|
||||
host_errors << host
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user