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

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 Gonzalez 2020-05-08 11:34:54 +02:00 committed by GitHub
parent 86bb514d45
commit 21e7715425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 14 deletions

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

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,

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'])

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)

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')