Permalink
Browse files

Merge pull request #3517 from garonsky/issue-2964_Change_thor_master_…

…without_delete

HPCC-2964 Configmgr - Allow swapping of Thor Master

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
  • Loading branch information...
2 parents e8651c3 + 18eda8c commit 9362daa3fba837dec2372359b9983cdfae501438 @richardkchapman richardkchapman committed Oct 17, 2012
Showing with 31 additions and 8 deletions.
  1. +21 −7 deployment/deployutils/configenvhelper.cpp
  2. +10 −1 esp/files/scripts/configmgr/configmgr.js
@@ -1276,15 +1276,29 @@ bool CConfigEnvHelper::AddNewNodes(IPropertyTree* pThor, const char* szType, int
continue;
StringBuffer sName;
+ StringBuffer sThorMasterProcess;
+ sThorMasterProcess.appendf("./%s", XML_TAG_THORMASTERPROCESS);
+
sName.appendf("temp%d", i + 1);
- // Add process node
- IPropertyTree* pProcessNode = createPTree(szType);
- pProcessNode->addProp(XML_ATTR_NAME, sName);
- pProcessNode->addProp(XML_ATTR_COMPUTER, computers[i]->queryProp(XML_ATTR_NAME));
- if (nPort != 0) pProcessNode->addPropInt(XML_ATTR_PORT, nPort);
- addNode(pProcessNode, pThor);
- }
+ IPropertyTree *pTree = (szType == NULL || strcmp(szType, XML_TAG_THORMASTERPROCESS) != 0) ? NULL : pThor->queryPropTree(sThorMasterProcess.str());
+ bool bAdd = false;
+
+ if (pTree == NULL)
+ {
+ bAdd = true;
+ pTree = createPTree(szType);
+ }
+
+ pTree->setProp(XML_ATTR_NAME,sName);
+ pTree->setProp(XML_ATTR_COMPUTER, computers[i]->queryProp(XML_ATTR_NAME));
+
+ if (nPort != 0)
+ pTree->setPropInt(XML_ATTR_PORT, nPort);
+
+ if (bAdd == true)
+ addNode(pTree, pThor);
+ }
RenameThorInstances(pThor);
UpdateThorAttributes(pThor);
@@ -2545,6 +2545,14 @@ function onMenuItemClickThorTopologyDelete(p_sType, p_aArgs, p_oValue) {
},
top.document.navDT.getFileName(true) + 'Operation=Delete&XmlArgs=' + xmlStr);
}
+
+function onMenuItemClickThorTopologySwapMaster(p_sType, p_aArgs, p_oValue)
+{
+ var slavesPerNode = getAttrValFromArr(rows.Attributes, 'slavesPerNode');
+
+ top.document.navDT.promptThorTopology(top.document.navDT, "Master", true, slavesPerNode);
+}
+
function onMenuItemClickThorTopology(p_sType, p_aArgs, p_oValue) {
if (top.document.forms['treeForm'].isLocked.value === 'false')
return;
@@ -2649,7 +2657,8 @@ function onContextMenuBeforeShow(p_sType, p_aArgs) {
],
"ThorClusterMaster": [
{ text: "Add Slaves...", onclick: { fn: onMenuItemClickThorTopology} },
- { text: "Add Spares...", onclick: { fn: onMenuItemClickThorTopology} }
+ { text: "Add Spares...", onclick: { fn: onMenuItemClickThorTopology} },
+ { text: "Swap Master", onclick: { fn: onMenuItemClickThorTopologySwapMaster} },
],
"ThorClusterSlave": [
{ text: "Add Spares...", onclick: { fn: onMenuItemClickThorTopology} }

0 comments on commit 9362daa

Please sign in to comment.