1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-01 05:47:01 +03:00

Feature #3227: Add vCenter and Hybrid IPs to VMs in Sunstone

This commit is contained in:
Tino Vazquez 2014-10-07 16:01:53 +02:00 committed by Ruben S. Montero
parent 897ccbd378
commit af330690a2

View File

@ -967,31 +967,55 @@ function str_start_time(vm){
// Return the IP or several IPs of a VM
function ip_str(vm){
var nic = vm.TEMPLATE.NIC;
if (nic == undefined){
return '--';
if (vm.USER_TEMPLATE.HYPERVISOR)
{
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
{
var nic = vm.TEMPLATE.NIC;
if (!$.isArray(nic)){
nic = [nic];
if (nic == undefined){
return '--';
}
if (!$.isArray(nic)){
nic = [nic];
}
ip = '';
$.each(nic, function(index,value){
if (value.IP){
ip += value.IP+'<br />';
}
if (value.IP6_GLOBAL){
ip += value.IP6_GLOBAL+'<br />';
}
if (value.IP6_ULA){
ip += value.IP6_ULA+'<br />';
}
});
}
ip = '';
$.each(nic, function(index,value){
if (value.IP){
ip += value.IP+'<br />';
}
if (value.IP6_GLOBAL){
ip += value.IP6_GLOBAL+'<br />';
}
if (value.IP6_ULA){
ip += value.IP6_ULA+'<br />';
}
});
return ip;
};