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

B #1716: CPU Model broken if not exists CUSTOMIZATION attribute (#1717)

This commit is contained in:
Abel Coronado 2018-02-07 14:57:34 +01:00 committed by Tino Vázquez
parent 21a11b5b58
commit bea47e2094
2 changed files with 23 additions and 17 deletions

View File

@ -276,7 +276,13 @@ define(function(require) {
success: function (request, kvmInfo){
var m = $("#machine-type").html();
if (m === undefined){
machines = kvmInfo[0].set_kvm_machines;
if (kvmInfo.length !== 0){
machines = kvmInfo[0].set_kvm_machines;
cpus = kvmInfo[0].set_cpu_models;
} else {
machines = kvmInfo;
cpus = kvmInfo;
}
var html = "<select id=\"machine-type\" wizard_field=\"MACHINE\">";
html += '<option value="">' + " " + '</option>';
@ -289,8 +295,6 @@ define(function(require) {
$("#kvm-info").append(html);
cpus = kvmInfo[0].set_cpu_models;
var html = "<select wizard_field=\"MODEL\">";
html += '<option value="">' + " " + '</option>';
html += '<option value="host-passthrough">host-passthrough</option>';

View File

@ -631,22 +631,24 @@ get '/infrastructure' do
set = Set.new
xml.each('HOST/TEMPLATE/CUSTOMIZATION') do |customization|
set.add(customization['NAME'])
if !xml['HOST/TEMPLATE/CUSTOMIZATION'].nil?
xml.each('HOST/TEMPLATE/CUSTOMIZATION') do |customization|
set.add(customization['NAME'])
end
infrastructure[:vcenter_customizations] = set.to_a
set_cpu_models = Set.new
set_kvm_machines = Set.new
xml.each('HOST/TEMPLATE') do |kvm|
set_cpu_models += kvm['KVM_CPU_MODELS'].split(" ")
set_kvm_machines += kvm['KVM_MACHINES'].split(" ")
end
infrastructure[:kvm_info] = { :set_cpu_models => set_cpu_models.to_a, :set_kvm_machines => set_kvm_machines.to_a }
end
infrastructure[:vcenter_customizations] = set.to_a
set_cpu_models = Set.new
set_kvm_machines = Set.new
xml.each('HOST/TEMPLATE') do |kvm|
set_cpu_models += kvm['KVM_CPU_MODELS'].split(" ")
set_kvm_machines += kvm['KVM_MACHINES'].split(" ")
end
infrastructure[:kvm_info] = { :set_cpu_models => set_cpu_models.to_a, :set_kvm_machines => set_kvm_machines.to_a }
[200, infrastructure.to_json]
end