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

F #5564: Manage Libvirtd failure at VM monitoring (#1628)

This commit is contained in:
Christian González 2021-11-29 20:02:51 +01:00 committed by GitHub
parent 0ad85efe1e
commit 014447a3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 7 deletions

View File

@ -4,4 +4,9 @@ require_relative '../../../lib/kvm'
KVM.load_conf
puts DomainList.wilds_info
begin
puts DomainList.info
rescue StandardError => e
STDERR.puts e.message
exit(-1)
end

View File

@ -4,4 +4,9 @@ require_relative '../../../lib/kvm'
KVM.load_conf
puts DomainList.info
begin
puts DomainList.info
rescue StandardError => e
STDERR.puts e.message
exit(-1)
end

View File

@ -26,5 +26,6 @@ begin
puts vmdb.to_status
rescue StandardError => e
puts e
STDERR.puts e.message
exit(-1)
end

View File

@ -89,15 +89,18 @@ module ProcessList
def self.retrieve_names
text, _e, s = KVM.virsh(:list, '')
names = []
return names if s.exitstatus != 0
if s.exitstatus != 0
raise 'Error retrieving names. Check Libvirtd service is up.'
end
lines = text.split(/\n/)[2..-1]
# rubocop:disable Style/RedundantAssignment
names = lines.map do |line|
line.split(/\s+/).delete_if {|d| d.empty? }[1]
end
# rubocop:enable Style/RedundantAssignment
names
end

View File

@ -69,7 +69,6 @@ void MonitorDriverProtocol::_monitor_vm(unique_ptr<monitor_msg_t> msg)
NebulaLog::warn("MDP", "Failed to monitor VM for host " +
to_string(msg->oid()) + ": " + msg->payload());
hm->error_monitor(msg->oid(), msg->payload());
return;
}
@ -269,7 +268,6 @@ void MonitorDriverProtocol::_state_vm(unique_ptr<monitor_msg_t> msg)
NebulaLog::warn("MDP", "Failed to monitor VM state for host " +
to_string(msg->oid()) + ": " + msg->payload());
hm->error_monitor(msg->oid(), msg->payload());
return;
}