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

F #3859: Fixes for monitoring

- empty VM list
- Use rsync for host sync by default
- Prevent race condition between monitord and IM module
This commit is contained in:
Ruben S. Montero 2020-03-06 12:10:42 +01:00
parent fdec8da57c
commit f4d6f8d97e
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
6 changed files with 31 additions and 25 deletions

View File

@ -359,14 +359,15 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
print_update_info(total - size, total, host['NAME'])
if options[:rsync]
sync_cmd = "rsync -Laz --delete #{REMOTES_LOCATION}" \
" #{host['NAME']}:#{remote_dir}"
else
if options[:ssh]
sync_cmd = "ssh #{host['NAME']}" \
" rm -rf '#{remote_dir}' 2>/dev/null;" \
" mkdir -p '#{remote_dir}' 2>/dev/null &&" \
" scp -rp #{REMOTES_LOCATION}/*" \
" #{host['NAME']}:#{remote_dir} 2> /dev/null"
else
sync_cmd = "rsync -Laz --delete #{REMOTES_LOCATION}" \
" #{host['NAME']}:#{remote_dir}"
end
retries = 3

View File

@ -77,13 +77,12 @@ CommandParser::CmdParser.new(ARGV) do
:description => 'Force probe upgrade in onehost sync'
}
RSYNC = {
:name => 'rsync',
:large => '--rsync',
:description => 'Use rsync to synchronize remotes. In case some '\
'probes are no longer in the fronted ithey will be '\
'deleted in the hosts. rsync command must be '\
'installed in the frontend and nodes.'
SSH = {
:name => 'ssh',
:large => '--ssh',
:description => 'Use SSH to synchronize remotes. In case some '\
'probes are no longer in the fronted they will be '\
'deleted in the hosts.'
}
TYPE = {
@ -95,7 +94,7 @@ CommandParser::CmdParser.new(ARGV) do
}
CREAT_OPTIONS = [IM, VMM, OneClusterHelper::CLUSTER, TYPE]
SYNC_OPTIONS = [OneClusterHelper::CLUSTER, FORCE, RSYNC]
SYNC_OPTIONS = [OneClusterHelper::CLUSTER, FORCE, SSH]
########################################################################
# Formatters for arguments

View File

@ -146,12 +146,13 @@ class InformationManagerDriver < OpenNebulaDriver
end
# Use SCP to sync:
sync_cmd = "scp -r #{@local_scripts_base_path}/* " \
"#{hostname}:#{@remote_scripts_base_path}"
#sync_cmd = "scp -r #{@local_scripts_base_path}/* " \
# "#{hostname}:#{@remote_scripts_base_path}"
# Use rsync to sync:
# sync_cmd = "rsync -Laz #{REMOTES_LOCATION} " \
# #{hostname}:#{@remote_dir}"
sync_cmd = "rsync -Laz --delete #{@local_scripts_base_path}" \
" #{hostname}:#{@remote_scripts_base_path}"
cmd = LocalCommand.run(sync_cmd, log_method(hostid))
if cmd.code != 0

View File

@ -558,6 +558,8 @@ module DomainList
lines = text.split(/\n/)[2..-1]
return @vms if lines.nil?
names = lines.map do |line|
line.split(/\s+/).delete_if {|d| d.empty? }[1]
end

View File

@ -153,6 +153,7 @@ class VirtualMachineDB
# check missing VMs
# ----------------------------------------------------------------------
uuids = @db.execute("SELECT uuid FROM #{@dataset}").flatten!
uuids ||= []
(uuids - monitor_ids).each do |uuid|
vm_db = @db.execute(

View File

@ -936,12 +936,6 @@ void Nebula::start(bool bootstrap_only)
goto error_mad;
}
rc = im->start();
if ( rc != 0 )
{
throw runtime_error("Could not start the Information Manager");
}
}
// ---- Transfer Manager ----
@ -1195,11 +1189,19 @@ void Nebula::start(bool bootstrap_only)
marketm->init_managers();
}
// ---- Start the Request Manager ----
// ---- Start the Request Manager & Information Manager----
// This modules recevie request from users / monitor and need to be
// started in last place when all systems are up
rc = rm->start();
if (!cache)
{
if ( im->start() != 0 )
{
throw runtime_error("Could not start the Information Manager");
}
}
if ( rc != 0 )
if ( rm->start() != 0 )
{
throw runtime_error("Could not start the Request Manager");
}