From 3e454bf9fd9cc9e6c7def01e7c0c73c229b42dd2 Mon Sep 17 00:00:00 2001 From: Sergio Semedi Barranco Date: Thu, 21 Dec 2017 16:58:35 +0100 Subject: [PATCH] B #1598: find_by_ref take account of vcenter_uuid (#1603) --- src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb b/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb index 5ff25a2c7f..69fabc62ef 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/vi_helper.rb @@ -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]