Bug #5409

vCenter drivers cosume too much time searching for objects

Added by Javi Fontan almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:09/26/2017
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

0%

Category:vCenter
Target version:Release 5.4.2
Resolution:fixed Pull request:
Affected Versions:OpenNebula 5.4

Description

The method find_by_ref walks over the xml pool extracting info using xpath. This is too slow when several calls are made as each do the same xpath calls. This info can be cached in a hash.

    def self.find_by_ref(the_class, attribute, ref, vcenter_uuid, pool = nil)
        pool = one_pool(the_class, false) if pool.nil?
        element = pool.find{|e|
            e["#{attribute}"] == ref &&
            (!e["TEMPLATE/OPENNEBULA_MANAGED"] || e["TEMPLATE/OPENNEBULA_MANAGED"] != "NO") &&
            (e["TEMPLATE/VCENTER_INSTANCE_ID"] == vcenter_uuid ||
             e["USER_TEMPLATE/VCENTER_INSTANCE_ID"] == vcenter_uuid)}

        return element
    end

Associated revisions

Revision ff43b789
Added by Javi Fontan almost 4 years ago

B #5409: cache objects when searching by ref in vcenter drivers

Revision 434a33c9
Added by Javi Fontan almost 4 years ago

B #5409: cache objects when searching by ref in vcenter drivers

(cherry picked from commit ff43b789678d9eb4daebf485758c0853c1887370)

Revision 8be52177
Added by Jaime Melis almost 4 years ago

B #5409: return the object in find_by_ref

Revision c32d5de8
Added by Jaime Melis almost 4 years ago

B #5409: return the object in find_by_ref

(cherry picked from commit 8be52177034a63f918e5117bf44f09cd2048f943)

History

#1 Updated by Javi Fontan almost 4 years ago

  • Status changed from Pending to Closed
  • Resolution set to fixed

Also available in: Atom PDF