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

B #1654: find_by_ref fix (#1655)

This commit is contained in:
Sergio Semedi Barranco 2018-01-18 18:10:54 +01:00 committed by Tino Vázquez
parent 85eefbe4ce
commit 5baf68b4e9

View File

@ -55,10 +55,13 @@ class VIHelper
end
end
def self.create_ref_hash(attribute, pool)
def self.create_ref_hash(attribute, pool, vcenter_uuid)
hash = {}
pool.each_element(Proc.new do |e|
vcenter_instance_id = e["TEMPLATE/VCENTER_INSTANCE_ID"] || e["USER_TEMPLATE/VCENTER_INSTANCE_ID"]
next if vcenter_uuid != vcenter_instance_id
ref = e[attribute]
hash[ref] = {
opennebula_object: e,
@ -85,7 +88,7 @@ class VIHelper
@ref_hash ||= {}
if @ref_hash[attribute].nil? || @ref_hash[attribute] == {}
@ref_hash[attribute] = create_ref_hash(attribute, pool)
@ref_hash[attribute] = create_ref_hash(attribute, pool, vcenter_uuid)
end
e = @ref_hash[attribute][ref]