1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

F #4302: Resolve some issues (#4572)

This commit is contained in:
Angel Luis Moya Gonzalez 2020-04-21 16:06:35 +02:00 committed by GitHub
parent 8b34f35896
commit 459433e80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 12 deletions

View File

@ -41,6 +41,7 @@ class NsxMonitor
attr_accessor :nsx_status
def initialize(host_id)
@host_id = host_id
@nsx_client = nil
@nsx_status = ''
return unless nsx_ready?
@ -118,8 +119,7 @@ class NsxMonitor
def nsx_ready?
@one_item = VCenterDriver::VIHelper
.one_item(OpenNebula::Host,
@vi_client.instance_variable_get(:@host_id).to_i)
.one_item(OpenNebula::Host, @host_id.to_i)
# Check if NSX_MANAGER is into the host template
if [nil, ''].include?(@one_item['TEMPLATE/NSX_MANAGER'])

View File

@ -297,8 +297,8 @@ class ClusterMonitor
customizations.each do |c|
t = 'CUSTOMIZATION = [ '
t << %(<NAME = "#{c.name}", >)
t << %(<TYPE = "#{c.type}" ]\n>)
t << %Q<NAME = "#{c.name}", >
t << %Q<TYPE = "#{c.type}" ]\n>
text << t
end
@ -494,7 +494,7 @@ class ClusterMonitor
vm_info << "IMPORT_TEMPLATE=\"#{vm_template64}\","
end
vm_info << "POLL=\"#{self.info.gsub('"', '\\"')}\"]"
vm_info << "POLL=\"#{self.info.gsub('"', "\\\"")}\"]"
rescue StandardError => e
vm_info = error_monitoring(e, vm_ref, info)
end

View File

@ -16,14 +16,28 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
HID=$2
HNAME=$3
STDIN=`cat -`
CLIENT_PID_FILE=/tmp/one-monitord-$HID.pid
(
[ -f /tmp/one-monitord-client.pid ] || exit 0
running_pid=$(cat /tmp/one-monitord-client.pid)
pids=$(ps axuwww | grep -e "/monitord-client.rb vcenter" | grep -v grep | awk '{ print $2 }' | grep -v "^${running_pid}$")
[ -f $CLIENT_PID_FILE ] || exit 0
running_pid=$(cat $CLIENT_PID_FILE)
pids=$(ps axuwww | grep -e "/monitord-client.rb.*${HID} " | grep -v grep | \
awk '{ print $2 }' | grep -v "^${running_pid}$")
if [ -n "$pids" ]; then
kill -6 $pids
kill $pids
fi
) > /dev/null
oned=`ps auxwww | grep oned | grep -v grep | wc -l`
if [ ${oned} -eq 0 ]; then
kill ${running_pid}
fi
) > /dev/null

View File

@ -35,7 +35,8 @@ $LOAD_PATH << RUBY_LIB_LOCATION
require 'nsx_driver'
require_relative '../../../lib/nsx.rb'
host_id = ARGV[1]
host = ARGV[-1]
host_id = ARGV[-2]
# Vcenter and NSX connection
begin

View File

@ -18,7 +18,8 @@
require_relative '../../../lib/vcenter.rb'
host_id = ARGV[1]
host = ARGV[-1]
host_id = ARGV[-2]
begin
# Vcenter connection