mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
bug #3612: do not consider hybrid ips as nice
This commit is contained in:
parent
90a69ef0d9
commit
196265c121
@ -404,36 +404,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
end if !options[:all]
|
||||
end
|
||||
|
||||
if vm.has_elements?("/VM/USER_TEMPLATE/HYPERVISOR")
|
||||
vm_information = vm.to_hash['VM']
|
||||
hybridvisor = vm_information['USER_TEMPLATE']['HYPERVISOR'].to_s
|
||||
isHybrid = %w{vcenter ec2 azure softlayer}.include? hybridvisor
|
||||
|
||||
if isHybrid
|
||||
vm_tmplt = vm_information['TEMPLATE']
|
||||
nic = {"NETWORK" => "-",
|
||||
"IP" => "-",
|
||||
"MAC"=> "-",
|
||||
"VLAN"=>"no",
|
||||
"BRIDGE"=>"-"}
|
||||
|
||||
case hybridvisor
|
||||
when "vcenter"
|
||||
nic["IP"] = vm_tmplt['GUEST_IP'] if vm_tmplt['GUEST_IP']
|
||||
when "ec2"
|
||||
nic["IP"] = vm_tmplt['IP_ADDRESS'] if vm_tmplt['IP_ADDRESS']
|
||||
when "azure"
|
||||
nic["IP"] = vm_tmplt['IPADDRESS'] if vm_tmplt['IPADDRESS']
|
||||
when "softlayer"
|
||||
nic["IP"] = vm_tmplt['PRIMARYIPADDRESS'] if vm_tmplt['PRIMARYIPADDRESS']
|
||||
else
|
||||
isHybrid = false
|
||||
end
|
||||
|
||||
vm_nics = [nic]
|
||||
end
|
||||
end
|
||||
|
||||
sg_nics = []
|
||||
|
||||
if (vm.has_elements?("/VM/TEMPLATE/NIC/SECURITY_GROUPS"))
|
||||
@ -448,33 +418,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
end
|
||||
|
||||
if vm.has_elements?("/VM/TEMPLATE/NIC") || vm_nics
|
||||
if vm.has_elements?("/VM/TEMPLATE/NIC")
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % "VM NICS",false)
|
||||
|
||||
# vm_nics is defined for hybridvisors. If there are both IP from
|
||||
# the hybridvisor and from OpenNebula nics check if the IP is the
|
||||
# same as one of IPs generated by OpenNebula and show standard
|
||||
# information. If it's a different IP show all the information.
|
||||
#
|
||||
# The template can already contain one NIC not controled by
|
||||
# OpenNebula and we want to show also that info.
|
||||
if vm_nics
|
||||
if vm.has_elements?("/VM/TEMPLATE/NIC")
|
||||
nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
||||
ips = nics.map {|n| n['IP'] }
|
||||
ip = vm_nics.first['IP']
|
||||
|
||||
if ips.include? ip
|
||||
vm_nics = nics
|
||||
else
|
||||
vm_nics += nics
|
||||
end
|
||||
end
|
||||
else
|
||||
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
||||
end
|
||||
|
||||
nic_default = {"NETWORK" => "-",
|
||||
"IP" => "-",
|
||||
"MAC"=> "-",
|
||||
@ -482,7 +429,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
"BRIDGE"=>"-"}
|
||||
|
||||
array_id = 0
|
||||
|
||||
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
||||
vm_nics.each {|nic|
|
||||
|
||||
next if nic.has_key?("CLI_DONE")
|
||||
|
@ -2143,41 +2143,10 @@ function printNics(vm_info){
|
||||
|
||||
var nics = []
|
||||
|
||||
if (isHybrid)
|
||||
{
|
||||
nic = {};
|
||||
nic.NIC_ID = 0;
|
||||
nic.ATTACH = "NO";
|
||||
nic.NETWORK = "-";
|
||||
nic.MAC = "-";
|
||||
|
||||
switch(vm_info.USER_TEMPLATE.HYPERVISOR.toLowerCase())
|
||||
{
|
||||
case "ec2":
|
||||
nic.IP = vm_info.TEMPLATE.IP_ADDRESS?vm_info.TEMPLATE.IP_ADDRESS:"--";
|
||||
break;
|
||||
case "azure":
|
||||
nic.IP = vm_info.TEMPLATE.IPADDRESS?vm_info.TEMPLATE.IPADDRESS:"--";
|
||||
break;
|
||||
case "softlayer":
|
||||
nic.IP = vm_info.TEMPLATE.PRIMARYIPADDRESS?vm_info.TEMPLATE.PRIMARYIPADDRESS:"--";
|
||||
break;
|
||||
default:
|
||||
nic.IP = "--";
|
||||
}
|
||||
|
||||
nics = [nic];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($.isArray(vm_info.TEMPLATE.NIC))
|
||||
nics = vm_info.TEMPLATE.NIC
|
||||
else if (!$.isEmptyObject(vm_info.TEMPLATE.NIC))
|
||||
nics = [vm_info.TEMPLATE.NIC]
|
||||
}
|
||||
|
||||
|
||||
if ($.isArray(vm_info.TEMPLATE.NIC))
|
||||
nics = vm_info.TEMPLATE.NIC
|
||||
else if (!$.isEmptyObject(vm_info.TEMPLATE.NIC))
|
||||
nics = [vm_info.TEMPLATE.NIC]
|
||||
|
||||
if (!nics.length){
|
||||
html += '\
|
||||
|
@ -8273,52 +8273,51 @@ function isNICAttachSupported(vm_info){
|
||||
// Return the IP or several IPs of a VM
|
||||
function ip_str(vm, divider){
|
||||
var divider = divider || "<br>"
|
||||
var isHybrid = calculate_isHybrid(vm);
|
||||
var nic = vm.TEMPLATE.NIC;
|
||||
var ips = [];
|
||||
|
||||
if (nic == undefined) {
|
||||
if (isHybrid) {
|
||||
switch(vm.USER_TEMPLATE.HYPERVISOR.toLowerCase()) {
|
||||
case "vcenter":
|
||||
ip = vm.TEMPLATE.GUEST_IP?vm.TEMPLATE.GUEST_IP:"--";
|
||||
break;
|
||||
case "ec2":
|
||||
ip = vm.TEMPLATE.IP_ADDRESS?vm.TEMPLATE.IP_ADDRESS:"--";
|
||||
break;
|
||||
case "azure":
|
||||
ip = vm.TEMPLATE.IPADDRESS?vm.TEMPLATE.IPADDRESS:"--";
|
||||
break;
|
||||
case "softlayer":
|
||||
ip = vm.TEMPLATE.PRIMARYIPADDRESS?vm.TEMPLATE.PRIMARYIPADDRESS:"--";
|
||||
break;
|
||||
default:
|
||||
ip = "--";
|
||||
}
|
||||
} else {
|
||||
return '--';
|
||||
}
|
||||
} else {
|
||||
if (nic != undefined) {
|
||||
if (!$.isArray(nic)){
|
||||
nic = [nic];
|
||||
}
|
||||
|
||||
ip = '';
|
||||
$.each(nic, function(index,value){
|
||||
if (value.IP){
|
||||
ip += value.IP+divider;
|
||||
ips.push(value.IP);
|
||||
}
|
||||
|
||||
if (value.IP6_GLOBAL){
|
||||
ip += value.IP6_GLOBAL+divider;
|
||||
ips.push(value.IP6_GLOBAL);
|
||||
}
|
||||
|
||||
if (value.IP6_ULA){
|
||||
ip += value.IP6_ULA+divider;
|
||||
ips.push(value.IP6_ULA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return ip;
|
||||
if (vm.TEMPLATE.GUEST_IP && ($.inArray(vm.TEMPLATE.GUEST_IP, ips) == -1)) {
|
||||
ips.push(vm.TEMPLATE.GUEST_IP);
|
||||
}
|
||||
|
||||
if (vm.TEMPLATE.AWS_IP_ADDRESS) {
|
||||
ips.push(vm.TEMPLATE.AWS_IP_ADDRESS);
|
||||
}
|
||||
|
||||
if (vm.TEMPLATE.AZ_IPADDRESS) {
|
||||
ips.push(vm.TEMPLATE.AZ_IPADDRESS);
|
||||
}
|
||||
|
||||
if (vm.TEMPLATE.SL_PRIMARYIPADDRESS) {
|
||||
ips.push(vm.TEMPLATE.SL_PRIMARYIPADDRESS);
|
||||
}
|
||||
|
||||
|
||||
if (ips.length > 0) {
|
||||
return ips.join(divider);
|
||||
} else {
|
||||
return '--';
|
||||
}
|
||||
};
|
||||
|
||||
// returns true if the vnc button should be enabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user