1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00

B #5869: Filter out unsupported CPU models

Decided to format it as a patch than an entire rewrite of the probe script.
This could be rewritten to populate the models array with the supported only.
This commit is contained in:
Anton Todorov 2022-06-08 15:45:09 +03:00 committed by Ruben S. Montero
parent 542fb9873d
commit 7961ae2416
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -28,7 +28,7 @@ begin
models = []
cmd = 'virsh -r -c qemu:///system capabilities'
capabilities, e, s = Open3.capture3(cmd)
capabilities, _e, s = Open3.capture3(cmd)
exit(-1) unless s.success?
cap_xml = REXML::Document.new(capabilities)
@ -87,7 +87,8 @@ begin
end
cmd = "virsh -r -c qemu:///system cpu-models #{a}"
cpu_models, e, s = Open3.capture3(cmd)
cpu_models, _e, s = Open3.capture3(cmd)
break unless s.success?
cpu_models.each_line do |l|
@ -98,6 +99,21 @@ begin
end
end
# Filter out the unsupported CPU models
cmd = 'virsh -c qemu:///system domcapabilities kvm'
domcapabilities, _e, s = Open3.capture3(cmd)
if s.success?
domcap_xml = REXML::Document.new(domcapabilities)
domcap_xml = domcap_xml.root
cpu_mode_custom_elem = domcap_xml.elements["cpu/mode[@name='custom',@supported='yes']"]
cpu_mode_custom_elem.elements.each("model[@usable='no']") do |m|
models.delete(m.text)
end if cpu_mode_custom_elem
end
machines.uniq!
models.uniq!