mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-28 17:57:22 +03:00
F #4302: Rescue exceptions in vcenter IM
Specifically, in the IM monitor control loop
This commit is contained in:
parent
9bd7cdc079
commit
77a56859e6
@ -87,7 +87,6 @@ AllCops:
|
|||||||
- src/im_mad/remotes/one.d/poll
|
- src/im_mad/remotes/one.d/poll
|
||||||
- src/im_mad/remotes/az.d/poll
|
- src/im_mad/remotes/az.d/poll
|
||||||
- src/im_mad/remotes/lib/vcenter_cluster.rb
|
- src/im_mad/remotes/lib/vcenter_cluster.rb
|
||||||
- src/im_mad/remotes/lib/vcenter_monitor.rb
|
|
||||||
- src/vnm_mad/remotes/ovswitch/post
|
- src/vnm_mad/remotes/ovswitch/post
|
||||||
- src/vnm_mad/remotes/ovswitch/clean
|
- src/vnm_mad/remotes/ovswitch/clean
|
||||||
- src/vnm_mad/remotes/ovswitch/pre
|
- src/vnm_mad/remotes/ovswitch/pre
|
||||||
|
@ -21,11 +21,13 @@ if !ONE_LOCATION
|
|||||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||||
ETC_LOCATION ||= '/etc/one/'
|
ETC_LOCATION ||= '/etc/one/'
|
||||||
VAR_LOCATION ||= '/var/lib/one/'
|
VAR_LOCATION ||= '/var/lib/one/'
|
||||||
|
RUN_LOCATION ||= '/var/run/one'
|
||||||
else
|
else
|
||||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||||
ETC_LOCATION ||= ONE_LOCATION + '/etc/'
|
ETC_LOCATION ||= ONE_LOCATION + '/etc/'
|
||||||
VAR_LOCATION ||= ONE_LOCATION + '/var/'
|
VAR_LOCATION ||= ONE_LOCATION + '/var/'
|
||||||
|
RUN_LOCATION ||= ONE_LOCATION + '/var/run'
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.directory?(GEMS_LOCATION)
|
if File.directory?(GEMS_LOCATION)
|
||||||
@ -87,20 +89,22 @@ class VcenterMonitorManager
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
def update_conf(conf64)
|
def update_conf(conf64)
|
||||||
conftxt = Base64.decode64(conf64)
|
conftxt = Base64.decode64(conf64)
|
||||||
conf = REXML::Document.new(conftxt).root
|
conf = REXML::Document.new(conftxt).root.elements
|
||||||
@mutex.synchronize do
|
@mutex.synchronize do
|
||||||
@conf = {
|
@conf = {
|
||||||
:system_host => conf.elements['PROBES_PERIOD/SYSTEM_HOST'].text.to_i,
|
:system_host => conf['PROBES_PERIOD/SYSTEM_HOST'].text.to_i,
|
||||||
:monitor_host => conf.elements['PROBES_PERIOD/MONITOR_HOST'].text.to_i,
|
:monitor_host => conf['PROBES_PERIOD/MONITOR_HOST'].text.to_i,
|
||||||
:state_vms => conf.elements['PROBES_PERIOD/STATE_VM'].text.to_i,
|
:state_vms => conf['PROBES_PERIOD/STATE_VM'].text.to_i,
|
||||||
:monitor_vm => conf.elements['PROBES_PERIOD/MONITOR_VM'].text.to_i,
|
:monitor_vm => conf['PROBES_PERIOD/MONITOR_VM'].text.to_i,
|
||||||
:beacon_host => conf.elements['PROBES_PERIOD/BEACON_HOST'].text.to_i,
|
:beacon_host => conf['PROBES_PERIOD/BEACON_HOST'].text.to_i,
|
||||||
:address => conf.elements['NETWORK/MONITOR_ADDRESS'].text.to_s,
|
:address => conf['NETWORK/MONITOR_ADDRESS'].text.to_s,
|
||||||
:port => conf.elements['NETWORK/PORT'].text.to_s
|
:port => conf['NETWORK/PORT'].text.to_s
|
||||||
}
|
}
|
||||||
|
|
||||||
# Don't allow intervals lower than the minimum default
|
# Don't allow intervals lower than the minimum default
|
||||||
@conf.each{ |k,v| @conf[k] = 30 if v.is_a?(Integer) && v < MINIMUM_INTERVAL }
|
@conf.each do |k, v|
|
||||||
|
@conf[k] = 30 if v.is_a?(Integer) && v < MINIMUM_INTERVAL
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@conf[:address] = '127.0.0.1' if @conf[:address] == 'auto'
|
@conf[:address] = '127.0.0.1' if @conf[:address] == 'auto'
|
||||||
@ -142,20 +146,24 @@ end
|
|||||||
# to monitord client and trigger operations on the Vcenter logic thread
|
# to monitord client and trigger operations on the Vcenter logic thread
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
class IOThread
|
class IOThread
|
||||||
IO_FIFO = '/tmp/vcenter_monitor.fifo'
|
|
||||||
|
IO_FIFO = RUN_LOCATION + '/vcenter_monitor.fifo'
|
||||||
|
|
||||||
def initialize(vcentermm)
|
def initialize(vcentermm)
|
||||||
@vcentermm = vcentermm
|
@vcentermm = vcentermm
|
||||||
end
|
end
|
||||||
|
|
||||||
def command_loop
|
def command_loop
|
||||||
|
fifo = File.open(IO_FIFO)
|
||||||
loop do
|
loop do
|
||||||
fifo = File.open(IO_FIFO)
|
|
||||||
|
|
||||||
fifo.each_line do |line|
|
fifo.each_line do |line|
|
||||||
action, hid, conf = line.split
|
begin
|
||||||
|
action, hid, conf = line.split
|
||||||
@vcentermm.send(action.to_sym, hid.to_i, conf)
|
@vcentermm.send(action.to_sym, hid.to_i, conf)
|
||||||
|
rescue StandardError => e
|
||||||
|
STDERR.puts 'vcenter_monitor.rb error processing line ' \
|
||||||
|
"#{line}. Error: #{e.message}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user