1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

B #3440: Fix bug on non-nsx clusters attributes (#3878)

For non-NSX Clusters, nsx attributes was shown with
empty values, this changes that behaviour to show only
NSX_STATUS indicating Missing NSX_MANAGER.
This commit is contained in:
Angel Luis Moya Gonzalez 2019-10-25 14:24:26 +02:00 committed by Tino Vázquez
parent d2af903e81
commit a4594ba3d6

View File

@ -112,16 +112,18 @@ class ClusterComputeResource
# ipPort = ip:port
ipPort = urlSplit[2]
nsx_obj['url'] = protocol + ipPort
nsx_obj['version'] = extList.version
nsx_obj['label'] = extList.description.label
elsif extList.key == "com.vmware.nsx.management.nsxt"
nsx_obj['type'] = "NSX-T"
nsx_obj['url'] = extList.server[0].url
nsx_obj['version'] = extList.version
nsx_obj['label'] = extList.description.label
else
next
end
nsx_obj['version'] = extList.version
nsx_obj['label'] = extList.description.label
end
unless nsx_obj.nil?
unless nsx_obj.empty?
nsx_info << "NSX_MANAGER=\"#{nsx_obj['url']}\"\n"
nsx_info << "NSX_TYPE=\"#{nsx_obj['type']}\"\n"
nsx_info << "NSX_VERSION=\"#{nsx_obj['version']}\"\n"
@ -135,6 +137,12 @@ class ClusterComputeResource
.one_item(OpenNebula::Host,
@vi_client.instance_variable_get(:@host_id).to_i)
# Check if NSX_MANAGER is into the host template
if [nil, ""].include?(@one_item["TEMPLATE/NSX_MANAGER"])
@nsx_status = "NSX_STATUS = \"Missing NSX_MANAGER\"\n"
return false
end
# Check if NSX_USER is into the host template
if [nil, ""].include?(@one_item["TEMPLATE/NSX_USER"])
@nsx_status = "NSX_STATUS = \"Missing NSX_USER\"\n"
@ -153,12 +161,6 @@ class ClusterComputeResource
return false
end
# Check if NSX_MANAGER is into the host template
if [nil, ""].include?(@one_item["TEMPLATE/NSX_MANAGER"])
@nsx_status = "NSX_STATUS = \"Missing NSX_MANAGER\"\n"
return false
end
# Try a connection as part of NSX_STATUS
nsx_client = NSXDriver::NSXClient
.new_from_id(@vi_client.instance_variable_get(:@host_id).to_i)