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

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

This commit is contained in:
Sergio Semedi Barranco 2017-12-21 16:58:35 +01:00 committed by Tino Vázquez
parent 215eb6c697
commit 3e454bf9fd

View File

@ -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]