Skip to content

Commit

Permalink
Merge pull request #18145 from jakesmith/HPCC-30848-esp-globals
Browse files Browse the repository at this point in the history
HPCC-30848 Ensure globals are available in bare-metal esp

Reviewed-By: Kevin wang <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Dec 15, 2023
2 parents 08425ea + 55eec12 commit c834127
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions esp/platform/espcfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,18 +400,6 @@ CEspConfig::CEspConfig(IProperties* inputs, IPropertyTree* envpt, IPropertyTree*
if (sdsSessionNeeded && !daliservers.isEmpty())
initSDSSessionCleaner(isDetachedFromDali());

#ifndef _CONTAINERIZED
// Copy the 'cost' tree as provided in environment.xml to the globalConfiguration IPropertyTree,
// so that it is available to the functions that calculate storage and workunit costs
// (Thor, hThor and eclagent are already using globalConfiguration, so this copying is not nessary anywhere else)
IPropertyTree * espConfigCost = m_envpt->queryPropTree("cost");
if (espConfigCost)
{
Owned <IPropertyTree> global = getGlobalConfig();
IPropertyTree * cost = global->hasProp("cost") ? global->queryPropTree("cost") : global->addPropTree("cost");
mergeConfiguration(*cost, *espConfigCost, nullptr, false);
}
#endif
initializeStorageGroups(daliClientActive());

const unsigned dafilesrvConnectTimeout = m_cfg->getPropInt("@dafilesrvConnectTimeout", 10)*1000;
Expand Down
11 changes: 11 additions & 0 deletions esp/platform/espp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,18 @@ int init_main(int argc, const char* argv[])
else
{
envpt.setown(createPTreeFromXMLFile(cfgfile, ipt_caseInsensitive));

// NB: esp has no standard component config in bare-metal, this is loading defaultYaml only
espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr));

// legacy esp.xml will contain a generated global section if present in the environment.
// replace the empty stub created by loadConfiguration with this environment globals section.
Owned<IPropertyTree> global = envpt->queryPropTree("global");
if (global)
{
Owned<IPropertyTree> currentConfig = getComponentConfig();
replaceComponentConfig(currentConfig, global);
}
}
Owned<IPropertyTree> procpt = NULL;
if (envpt)
Expand Down
3 changes: 3 additions & 0 deletions initfiles/componentfiles/configxml/esp.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<expert>
<xsl:copy-of select="/Environment/Software/Globals/@* | /Environment/Software/Globals/*"/>
</expert>
<storage>
<xsl:copy-of select="/Environment/Software/RemoteStorage/*"/>
</storage>
<xsl:copy-of select="/Environment/Hardware/cost"/>
</global>
</xsl:copy>
Expand Down

0 comments on commit c834127

Please sign in to comment.