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

This commit is contained in:
Christian González authored and GitHub committed 2021-11-29 20:02:51 +01:00
1 parent 0ad85efe1e
commit 014447a3d6
5 files changed
+19 -7

No files matched your search

@@ -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
@@ -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
@@ -26,5 +26,6 @@ begin
puts vmdb.to_status
rescue StandardError => e
puts e
STDERR.puts e.message
exit(-1)
end
+5 -2
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
@@ -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;
}