B #1598: find_by_ref take account of vcenter_uuid (#1603)

This commit is contained in:
Sergio Semedi Barranco authored and Tino Vazquez committed 2018-01-08 12:46:10 +01:00
1 parent a56500b6cd
commit 2299aa3723
1 file changed
+4 -2
@@ -55,10 +55,12 @@ 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|
next if vcenter_uuid != e["TEMPLATE/VCENTER_INSTANCE_ID"]
ref = e[attribute]
hash[ref] = {
opennebula_object: e,
@@ -85,7 +87,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]