F #4302: Several vCenter driver fixes (#4681)

- VMs with name one-xxx was not been monitored
- Change NSX_STATUS='' on hosts with no NSX
- Changes on checkings in VNM driver
- Change an error ocurring connecting to NSX Manager

Co-authored-by: mouyaq <amoya@opennebula.io>
This commit is contained in:
Angel Luis Moya Gonzalezandmouyaq authored and GitHub committed 2020-05-08 11:34:54 +02:00
1 parent 86bb514d45
commit 21e7715425
5 files changed
+11 -14

No files matched your search

+2 -4
View File
@@ -124,7 +124,7 @@ class NsxMonitor
# 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"
@nsx_status = ''
return false
end
@@ -147,9 +147,7 @@ class NsxMonitor
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)
nsx_client = NSXDriver::NSXClient.new_from_id(@host_id.to_i)
if @one_item['TEMPLATE/NSX_TYPE'] == NSXDriver::NSXConstants::NSXV
# URL to test a connection
-3
View File
@@ -852,9 +852,6 @@ class VcenterMonitor
vms = []
vms_hash.each do |vm_ref, info|
# Skip VMs starting with one- in vcenter
next if info['name'].match(/^one-(\d*)(-(.*))?$/)
one_uuid = "#{vm_ref}#{@vc_uuid}"
vm = { :uuid => one_uuid,
+2 -6
View File
@@ -65,13 +65,9 @@ if OpenNebula.is_error?(rc)
raise err_msg
end
# Exit with error if NSX_STATUS != OK
# Exit if there is no NSX
nsx_status = one_host['TEMPLATE/NSX_STATUS']
unless nsx_status == 'OK'
OpenNebula.log_error('NSX_STATUS is not OK')
OpenNebula.error_message('NSX_STATUS is not OK')
exit 1
end
exit 0 if nsx_status.nil?
# Clear rules
nsx_client = NSXDriver::NSXClient.new_from_id(one_host['ID'])
+4
View File
@@ -67,6 +67,10 @@ if OpenNebula.is_error?(rc)
raise err_msg
end
# Exit if there is no NSX
nsx_status = one_host['TEMPLATE/NSX_STATUS']
exit 0 if nsx_status.nil?
# OpenNebula VM
vmid = template_xml.xpath('//VM/ID')
one_vm = VCenterDriver::VIHelper.one_item(OpenNebula::VirtualMachine, vmid)
+3 -1
View File
@@ -60,8 +60,10 @@ if OpenNebula.is_error?(rc)
raise err_msg
end
# Exit with error if NSX_STATUS != OK
# Exit if there is no NSX
nsx_status = one_host['TEMPLATE/NSX_STATUS']
exit 0 if nsx_status.nil?
unless nsx_status == 'OK'
OpenNebula.log_error('NSX_STATUS is not OK')
OpenNebula.error_message('NSX_STATUS is not OK')