mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #4215: Show VM floating IPs in onevm and sunstone
This commit is contained in:
parent
034943e6b1
commit
cb8d84849e
@ -170,16 +170,11 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
vm_nics.each do |nic|
|
||||
if nic.has_key?("IP")
|
||||
ips.push(nic["IP"])
|
||||
end
|
||||
|
||||
if nic.has_key?("IP6_GLOBAL")
|
||||
ips.push(nic["IP6_GLOBAL"])
|
||||
end
|
||||
|
||||
if nic.has_key?("IP6_ULA")
|
||||
ips.push(nic["IP6_ULA"])
|
||||
["IP", "IP6_GLOBAL", "IP6_ULA",
|
||||
"VROUTER_IP", "VROUTER_IP6_GLOBAL", "VROUTER_IP6_ULA"].each do |attr|
|
||||
if nic.has_key?(attr)
|
||||
ips.push(nic[attr])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -735,37 +730,31 @@ in the frontend machine.
|
||||
|
||||
next if nic.has_key?("CLI_DONE")
|
||||
|
||||
if nic.has_key?("IP6_LINK")
|
||||
shown_ips << nic["IP6_LINK"]
|
||||
["IP6_LINK", "IP6_ULA", "IP6_GLOBAL"].each do |attr|
|
||||
if nic.has_key?(attr)
|
||||
shown_ips << nic[attr]
|
||||
|
||||
ip6_link = {"IP" => nic.delete("IP6_LINK"),
|
||||
"CLI_DONE" => true,
|
||||
"DOUBLE_ENTRY" => true}
|
||||
vm_nics.insert(array_id+1,ip6_link)
|
||||
ipstr = {"IP" => nic.delete(attr),
|
||||
"CLI_DONE" => true,
|
||||
"DOUBLE_ENTRY" => true}
|
||||
vm_nics.insert(array_id+1,ipstr)
|
||||
|
||||
array_id += 1
|
||||
array_id += 1
|
||||
end
|
||||
end
|
||||
|
||||
if nic.has_key?("IP6_ULA")
|
||||
shown_ips << nic["IP6_ULA"]
|
||||
["VROUTER_IP", "VROUTER_IP6_LINK",
|
||||
"VROUTER_IP6_ULA", "VROUTER_IP6_GLOBAL"].each do |attr|
|
||||
if nic.has_key?(attr)
|
||||
shown_ips << nic[attr]
|
||||
|
||||
ip6_link = {"IP" => nic.delete("IP6_ULA"),
|
||||
"CLI_DONE" => true,
|
||||
"DOUBLE_ENTRY" => true}
|
||||
vm_nics.insert(array_id+1,ip6_link)
|
||||
ipstr = {"IP" => nic.delete(attr) + " (VRouter)",
|
||||
"CLI_DONE" => true,
|
||||
"DOUBLE_ENTRY" => true}
|
||||
vm_nics.insert(array_id+1,ipstr)
|
||||
|
||||
array_id += 1
|
||||
end
|
||||
|
||||
if nic.has_key?("IP6_GLOBAL")
|
||||
shown_ips << nic["IP6_GLOBAL"]
|
||||
|
||||
ip6_link = {"IP" => nic.delete("IP6_GLOBAL"),
|
||||
"CLI_DONE" => true,
|
||||
"DOUBLE_ENTRY" => true}
|
||||
vm_nics.insert(array_id+1,ip6_link)
|
||||
|
||||
array_id += 1
|
||||
array_id += 1
|
||||
end
|
||||
end
|
||||
|
||||
shown_ips << nic["IP"] if nic.has_key?("IP")
|
||||
|
@ -261,6 +261,15 @@ define(function(require) {
|
||||
'SL_PRIMARYIPADDRESS'
|
||||
];
|
||||
|
||||
var NIC_IP_ATTRS = [
|
||||
"IP",
|
||||
"IP6_GLOBAL",
|
||||
"IP6_ULA",
|
||||
"VROUTER_IP",
|
||||
"VROUTER_IP6_GLOBAL",
|
||||
"VROUTER_IP6_ULA"
|
||||
];
|
||||
|
||||
var EXTERNAL_NETWORK_ATTRIBUTES = [
|
||||
'GUEST_IP',
|
||||
'GUEST_IP_ADDRESSES',
|
||||
@ -662,17 +671,11 @@ define(function(require) {
|
||||
}
|
||||
|
||||
$.each(nic, function(index, value) {
|
||||
if (value.IP) {
|
||||
ips.push(value.IP);
|
||||
}
|
||||
|
||||
if (value.IP6_GLOBAL) {
|
||||
ips.push(value.IP6_GLOBAL);
|
||||
}
|
||||
|
||||
if (value.IP6_ULA) {
|
||||
ips.push(value.IP6_ULA);
|
||||
}
|
||||
$.each(NIC_IP_ATTRS, function(j, attr){
|
||||
if (value[attr]) {
|
||||
ips.push(value[attr]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -262,13 +262,27 @@ define(function(require) {
|
||||
});
|
||||
}
|
||||
|
||||
function ipTr(attr){
|
||||
var v = "--";
|
||||
|
||||
if (nic[attr] != undefined){
|
||||
v = nic[attr];
|
||||
|
||||
if (nic["VROUTER_"+attr] != undefined){
|
||||
v += ("<br/>" + nic["VROUTER_"+attr] + Locale.tr(" (VRouter)"));
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
nic_dt_data.push({
|
||||
NIC_ID : nic.NIC_ID,
|
||||
NETWORK : nic.NETWORK,
|
||||
IP : (nic.IP ? nic.IP : "--"),
|
||||
IP : ipTr("IP"),
|
||||
MAC : nic.MAC,
|
||||
IP6_ULA : (nic.IP6_ULA ? nic.IP6_ULA : "--"),
|
||||
IP6_GLOBAL : (nic.IP6_GLOBAL ? nic.IP6_GLOBAL : "--"),
|
||||
IP6_ULA : ipTr("IP6_ULA"),
|
||||
IP6_GLOBAL : ipTr("IP6_GLOBAL"),
|
||||
ACTIONS : actions,
|
||||
SECURITY_GROUP_RULES : secgroups
|
||||
});
|
||||
@ -287,10 +301,10 @@ define(function(require) {
|
||||
},
|
||||
{"data": "NIC_ID", "defaultContent": ""},
|
||||
{"data": "NETWORK", "defaultContent": ""},
|
||||
{"data": "IP", "defaultContent": ""},
|
||||
{"data": "IP", "defaultContent": "", "class": "nowrap"},
|
||||
{"data": "MAC", "defaultContent": ""},
|
||||
{"data": "IP6_ULA", "defaultContent": ""},
|
||||
{"data": "IP6_GLOBAL", "defaultContent": ""},
|
||||
{"data": "IP6_ULA", "defaultContent": "", "class": "nowrap"},
|
||||
{"data": "IP6_GLOBAL", "defaultContent": "", "class": "nowrap"},
|
||||
{"data": "ACTIONS", "defaultContent": "", "orderable": false},
|
||||
{"defaultContent": "", "orderable": false}
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user