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

Feature #3843: Do not show local network details when VM is running on hybrid host

This commit is contained in:
Tino Vazquez 2015-08-24 19:07:16 +02:00
parent 1423e169ac
commit 64bf5bc837
2 changed files with 39 additions and 22 deletions

View File

@ -46,6 +46,13 @@ private
end
end
EXTERNAL_IP_ATTRS = [
'GUEST_IP',
'AWS_IP_ADDRESS',
'AZ_IPADDRESS',
'SL_PRIMARYIPADDRESS'
];
class OneVMHelper < OpenNebulaHelper::OneHelper
MULTIPLE={
@ -505,6 +512,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
vm_monitoring = vm.to_hash['VM']['MONITORING']
# Find out if it is a hybrid VM to avoid showing local IPs
isHybrid=false
vm_monitoring.each{|key, value|
if EXTERNAL_IP_ATTRS.include? key
isHybrid=true
end
}
order_attrs = %w(CPU MEMORY NETTX NETRX)
vm_monitoring_sort = []
@ -674,7 +689,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
end
end
if vm.has_elements?("/VM/TEMPLATE/NIC")
if vm.has_elements?("/VM/TEMPLATE/NIC") and !isHybrid
puts
CLIHelper.print_header(str_h1 % "VM NICS",false)
@ -777,7 +792,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
vm.delete_element("/VM/TEMPLATE/NIC")
end if !options[:all]
if vm.has_elements?("/VM/TEMPLATE/SECURITY_GROUP_RULE")
if vm.has_elements?("/VM/TEMPLATE/SECURITY_GROUP_RULE") and !isHybrid
puts
CLIHelper.print_header(str_h1 % "SECURITY",false)
puts

View File

@ -618,26 +618,6 @@ define(function(require) {
var nic = element.TEMPLATE.NIC;
var ips = [];
if (nic != undefined) {
if (!$.isArray(nic)) {
nic = [nic];
}
$.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);
}
});
}
var monitoring = element.MONITORING;
if (monitoring) {
var externalIP;
@ -648,6 +628,28 @@ define(function(require) {
}
})
}
else
{
if (nic != undefined) {
if (!$.isArray(nic)) {
nic = [nic];
}
$.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);
}
});
}
}
if (ips.length > 0) {
return ips.join(divider);