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

M #-: Check for known and calculated path

To avoid issues monitoring wild VMs. Also make actual_path
monitoring more robust.
This commit is contained in:
Tino Vazquez 2020-05-18 02:31:43 +02:00
parent b22c569ab2
commit bcbcbceb06
No known key found for this signature in database
GPG Key ID: 2FE9C32E94AEABBE
2 changed files with 7 additions and 3 deletions

View File

@ -686,7 +686,6 @@ module VCenterDriver
# @return [vCenter_disk] the proper disk
def query_disk(one_disk, keys, vc_disks)
index = one_disk['DISK_ID']
cloned = one_disk["CLONE"].nil? || one_disk["CLONE"] == "YES"
unmanaged = "opennebula.disk.#{index}"
managed = "opennebula.mdisk.#{index}"
@ -706,8 +705,12 @@ module VCenterDriver
end
# Try to find the disk using the path known by OpenNebula
path = !cloned ? one_disk['SOURCE'] : disk_real_path(one_disk, index)
query = vc_disks.select {|dev| path == dev[:path_wo_ds]}
source_path = one_disk['SOURCE']
calculated_path = disk_real_path(one_disk, index)
query = vc_disks.select { |dev|
source_path == dev[:path_wo_ds] ||
calculated_path == dev[:path_wo_ds]
}
end
return nil if query.size != 1

View File

@ -463,6 +463,7 @@ module VirtualMachineMonitor
str_info << 'VCENTER_RP_NAME="' << rp_name << '" ' << "\n"
info_disks.each do |disk|
next if disk[1].no_exists?
str_info << "DISK_#{disk[0]}_ACTUAL_PATH=\"[" <<
disk[1].ds.name << '] ' << disk[1].path << '" ' << "\n"
end