diff --git a/app/models/miq_request_workflow.rb b/app/models/miq_request_workflow.rb index 71deb47b9bc..f3e597d413e 100644 --- a/app/models/miq_request_workflow.rb +++ b/app/models/miq_request_workflow.rb @@ -822,7 +822,8 @@ def find_respools_under_ci(item) def find_classes_under_ci(item, klass) results = [] return results if item.nil? - node = load_ems_node(item, _log.prefix) + @_find_classes_under_ci_prefix ||= _log.prefix + node = load_ems_node(item, @_find_classes_under_ci_prefix) each_ems_metadata(node.attributes[:object], klass) { |ci| results << ci } unless node.nil? results end @@ -852,7 +853,8 @@ def get_ems_folders(folder, dh = {}, full_path = "") end # Process child folders - node = load_ems_node(folder, _log.prefix) + @_get_ems_folders_prefix ||= _log.prefix + node = load_ems_node(folder, @_get_ems_folders_prefix) node.children.each { |child| get_ems_folders(child.attributes[:object], dh, full_path) } unless node.nil? dh @@ -892,7 +894,8 @@ def find_cluster_above_ci(item, ems_src = nil) def find_class_above_ci(item, klass, _ems_src = nil, datacenter = false) result = nil - node = load_ems_node(item, _log.prefix) + @_find_class_above_ci_prefix ||= _log.prefix + node = load_ems_node(item, @_find_class_above_ci_prefix) klass_name = klass.name.to_sym # Walk the xml document parents to find the requested class while node.kind_of?(XmlHash::Element) @@ -913,7 +916,8 @@ def each_ems_metadata(ems_ci = nil, klass = nil, &_blk) ems_xml = get_ems_metadata_tree(src) ems_node = ems_xml.try(:root) else - ems_node = load_ems_node(ems_ci, _log.prefix) + @_each_ems_metadata_prefix ||= _log.prefix + ems_node = load_ems_node(ems_ci, @_each_ems_metadata_prefix) end klass_name = klass.name.to_sym unless klass.nil? unless ems_node.nil? @@ -1017,7 +1021,8 @@ def allowed_hosts_obj(options = {}) hosts_ids = find_all_ems_of_type(Host).collect(&:id) hosts_ids &= load_ar_obj(src[:storage]).hosts.collect(&:id) unless src[:storage].nil? if datacenter - dc_node = load_ems_node(datacenter, _log.prefix) + @_allowed_hosts_obj_prefix ||= _log.prefix + dc_node = load_ems_node(datacenter, @_allowed_hosts_obj_prefix) hosts_ids &= find_hosts_under_ci(dc_node.attributes[:object]).collect(&:id) end return [] if hosts_ids.blank?