diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 1facf1a7c..8973654a8 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -172,6 +172,7 @@ bool amazonInstall = false; string DataFileEnvFile; +string managePackages; string installDir; string HOME = "/root"; @@ -203,13 +204,14 @@ int main(int argc, char *argv[]) noPrompting = false; string password; string cmd; -// struct sysinfo myinfo; +// struct sysinfo myinfo; // hidden options // -f for force use nodeps on rpm install // -o to prompt for process to start offline //default + managePackages = "0"; installDir = installDir + ""; //see if we can determine our own location ostringstream oss; @@ -279,6 +281,7 @@ int main(int argc, char *argv[]) cout << " -s Single Threaded Remote Install" << endl; cout << " -port MariaDB ColumnStore Port Address" << endl; cout << " -i Non-root Install directory, Only use for non-root installs" << endl; + cout << " -m When specified, postConfigure won't try to deploy, install or uninstall packages" << endl; exit (0); } else if( string("-s") == argv[i] ) @@ -297,7 +300,7 @@ int main(int argc, char *argv[]) if ( oldFileName.find("Columnstore.xml") == string::npos ) { cout << " ERROR: Config File is not a Columnstore.xml file name" << endl; exit (1); - } + } } else if( string("-p") == argv[i] ) { i++; @@ -309,7 +312,7 @@ int main(int argc, char *argv[]) if ( password.find("-") != string::npos ) { cout << " ERROR: Valid Password not provided" << endl; exit (1); - } + } } else if( string("-u") == argv[i] ) noPrompting = true; @@ -337,10 +340,13 @@ int main(int argc, char *argv[]) } installDir = argv[i]; } + else if( string("-m") == argv[i] ) { + managePackages = "0"; + } else { cout << " ERROR: Invalid Argument = " << argv[i] << endl; - cout << " Usage: postConfigure [-h][-c][-u][-p][-s][-port][-i]" << endl; + cout << " Usage: postConfigure [-h][-c][-m][-u][-p][-s][-port][-i]" << endl; exit (1); } } @@ -498,14 +504,14 @@ int main(int argc, char *argv[]) pcommand = callReadline(prompt.c_str()); string temp; if (pcommand) { - if (strlen(pcommand) > 0) + if (strlen(pcommand) > 0) temp = pcommand; else temp = singleServerInstall; callFree(pcommand); if (temp == "1") { singleServerInstall = temp; - cout << endl << "Performing the Single Server Install." << endl; + cout << endl << "Performing the Single Server Install." << endl; if ( reuseConfig == "n" ) { //setup to use the single server Columnstore.xml file @@ -676,7 +682,7 @@ int main(int argc, char *argv[]) //module ProcessConfig.xml to setup all apps on the dm if( !updateProcessConfig(IserverTypeInstall) ) cout << "Update ProcessConfig.xml error" << endl; - + //store local query flag try { sysConfig->setConfig(InstallSection, "PMwithUM", "n"); @@ -707,7 +713,7 @@ int main(int argc, char *argv[]) cout << " Module. Check MariaDB ColumnStore Admin Guide for additional information." << endl << endl; while(true) { - if ( pmwithum ) + if ( pmwithum ) prompt = "Local Query feature is Enabled, Do you want to disable? [y,n] (n) > "; else prompt = "Enable Local Query feature? [y,n] (n) > "; @@ -717,7 +723,7 @@ int main(int argc, char *argv[]) if (strlen(pcommand) > 0) answer = pcommand; callFree(pcommand); } - + if ( answer == "y" || answer == "n" ) { cout << endl; break; @@ -816,7 +822,7 @@ int main(int argc, char *argv[]) { //Schema Sync is default as on when Local Query is Selected mysqlRep = true; MySQLRep = "y"; - + try { sysConfig->setConfig(InstallSection, "MySQLRep", MySQLRep); } @@ -824,8 +830,8 @@ int main(int argc, char *argv[]) {} } - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + if ( !writeConfig(sysConfig) ) { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -838,12 +844,12 @@ int main(int argc, char *argv[]) in.seekg(0, std::ios::end); int size = in.tellg(); - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found")) + if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found")) // not running on amazon with ec2-api-tools amazonInstall = false; else { - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed")) + if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed")) amazonInstall = false; else amazonInstall = true; @@ -859,7 +865,7 @@ int main(int argc, char *argv[]) if ( cloud == "disable" ) amazonInstall = false; - + if ( amazonInstall ) { if ( cloud == oam::UnassignedName ) @@ -874,7 +880,7 @@ int main(int argc, char *argv[]) if (pcommand) { if (strlen(pcommand) > 0) enable = pcommand; callFree(pcommand); - + if (enable == "n") { amazonInstall = false; @@ -885,8 +891,8 @@ int main(int argc, char *argv[]) {}; break; - } - } + } + } if ( enable != "y" ) { @@ -905,7 +911,7 @@ int main(int argc, char *argv[]) break; } - } + } else cout << "NOTE: Configured to have ColumnStore use the Amazon AWS CLI Tools" << endl << endl; @@ -919,13 +925,13 @@ int main(int argc, char *argv[]) exit (1); } } - - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + + if ( !writeConfig(sysConfig) ) { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } } - + if ( pmwithum ) cout << endl << "NOTE: Local Query Feature is enabled" << endl; @@ -942,8 +948,8 @@ int main(int argc, char *argv[]) exit(1); } - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + if ( !writeConfig(sysConfig) ) { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } @@ -1025,7 +1031,7 @@ int main(int argc, char *argv[]) exit(1); } - // + // // setup storage // @@ -1111,7 +1117,7 @@ int main(int argc, char *argv[]) cout << "NOTE: Using the default setting for 'NumBlocksPct' at 70%" << endl; else cout << "NOTE: Using previous configuration setting for 'NumBlocksPct' = " << numBlocksPct << "%" << endl; - + string totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory"); cout << " Using previous configuration setting for 'TotalUmMemory' = " << totalUmMemory << endl; @@ -1156,7 +1162,7 @@ int main(int argc, char *argv[]) string percent = "50%"; if (hdfs) { percent = "25%"; - } + } cout << " Setting 'TotalUmMemory' to " << percent << endl; @@ -1193,7 +1199,7 @@ int main(int argc, char *argv[]) cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } - } + } break; } } @@ -1232,7 +1238,7 @@ int main(int argc, char *argv[]) for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++) { HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin(); - + if ( (*listPT).DeviceName == parentOAMModuleName ) { parentOAMModuleIPAddr = (*pt1).IPAddr; parentOAMModuleHostName = (*pt1).HostName; @@ -1330,7 +1336,7 @@ int main(int argc, char *argv[]) if ( moduleType == "pm" ) pmNumber = moduleCount; - if ( moduleType == "um" ) + if ( moduleType == "um" ) umNumber = moduleCount; int moduleID = 1; @@ -1346,7 +1352,7 @@ int main(int argc, char *argv[]) if ( !(sysConfig->getConfig(ModuleSection, ModuleIPAddr).empty()) ) { if ( j+1 < moduleID || j+1 > moduleID + (moduleCount-1) ) { string ModuleHostName = "ModuleHostName" + oam.itoa(j+1) + "-" + oam.itoa(k) + "-" + oam.itoa(i+1); - + sysConfig->setConfig(ModuleSection, ModuleIPAddr, oam::UnassignedIpAddr); sysConfig->setConfig(ModuleSection, ModuleHostName, oam::UnassignedName); } @@ -1380,20 +1386,20 @@ int main(int argc, char *argv[]) string moduleNameDesc = moduleDesc + " #" + oam.itoa(moduleID); PerformanceModule performancemodule; - + if ( newModuleName == parentOAMModuleName ) cout << endl << "*** Parent OAM Module " << moduleNameDesc << " Configuration ***" << endl << endl; else cout << endl << "*** " << moduleNameDesc << " Configuration ***" << endl << endl; - + moduleDisableState = oam::ENABLEDSTATE; - + //setup HostName/IPAddress for each NIC for( unsigned int nicID=1 ; nicID < MAX_NIC+1 ; nicID++ ) { string moduleHostName = oam::UnassignedName; string moduleIPAddr = oam::UnassignedIpAddr; - + DeviceNetworkList::iterator listPT = sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin(); for( ; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end() ; listPT++) { @@ -1405,7 +1411,7 @@ int main(int argc, char *argv[]) moduleDisableState == oam::AUTODISABLEDSTATE ) moduleDisableState = oam::ENABLEDSTATE; } - + HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin(); for( ; pt1 != (*listPT).hostConfigList.end() ; pt1++) { @@ -1417,7 +1423,7 @@ int main(int argc, char *argv[]) } } } - + if ( nicID == 1 ) { if ( moduleDisableState != oam::ENABLEDSTATE ) { string disabled = "y"; @@ -1442,7 +1448,7 @@ int main(int argc, char *argv[]) exit(1); disabled = "y"; } - else + else { string enable = "y"; cout << "Module '" + newModuleName + "' is Disabled. It needs to be enabled to startup MariaDB ColumnStore." << endl; @@ -1472,13 +1478,13 @@ int main(int argc, char *argv[]) } } } - + if ( disabled == "n" ) moduleDisableState = oam::ENABLEDSTATE; - else + else enableModuleCount--; } - + //set Module Disable State string moduleDisableStateParm = "ModuleDisableState" + oam.itoa(moduleID) + "-" + oam.itoa(i+1); try { @@ -1489,12 +1495,12 @@ int main(int argc, char *argv[]) cout << "ERROR: Problem setting ModuleDisableState in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } - + if ( !writeConfig(sysConfig) ) { cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } - + //skip configuration if if DISABLED state if ( moduleDisableState != oam::ENABLEDSTATE) break; @@ -1505,17 +1511,17 @@ int main(int argc, char *argv[]) moduleHostNameFound = true; moduleHostName = oam::UnassignedName; } - + if (moduleIPAddr.empty()) moduleIPAddr = oam::UnassignedIpAddr; - + string newModuleIPAddr; - + while (true) { newModuleHostName = moduleHostName; if (amazonInstall) { - if ( moduleHostName == oam::UnassignedName && + if ( moduleHostName == oam::UnassignedName && newModuleName == "pm1" && nicID == 1) { //get local instance name (pm1) @@ -1538,7 +1544,7 @@ int main(int argc, char *argv[]) { //check if need to create instance or user enter ID string create = "y"; - + while(true) { pcommand = callReadline("Create Instance for " + newModuleName + " [y,n] (y) > "); @@ -1555,27 +1561,27 @@ int main(int argc, char *argv[]) if ( noPrompting ) exit(1); } - - + + if ( create == "y" ) { ModuleIP moduleip; moduleip.moduleName = newModuleName; - + string AmazonVPCNextPrivateIP = "autoassign"; try { oam.getSystemConfig("AmazonVPCNextPrivateIP", AmazonVPCNextPrivateIP); } catch(...) {} - + moduleip.IPaddress = AmazonVPCNextPrivateIP; - + newModuleHostName = launchInstance(moduleip); if ( newModuleHostName == oam::UnassignedName ) { cout << "launch Instance failed for " + newModuleName << endl; exit (1); } - + prompt = ""; } else @@ -1587,8 +1593,8 @@ int main(int argc, char *argv[]) } else { - if ( moduleHostName == oam::UnassignedName && - newModuleName == "pm1" && nicID == 1) + if ( moduleHostName == oam::UnassignedName && + newModuleName == "pm1" && nicID == 1) { char hostname[128]; gethostname(hostname, sizeof hostname); @@ -1603,11 +1609,11 @@ int main(int argc, char *argv[]) pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) + if (strlen(pcommand) > 0) newModuleHostName = pcommand; else newModuleHostName = moduleHostName; - + callFree(pcommand); } } @@ -1686,7 +1692,7 @@ int main(int argc, char *argv[]) break; } } - + //set New Module Host Name string moduleHostNameParm = "ModuleHostName" + oam.itoa(moduleID) + "-" + oam.itoa(nicID) + "-" + oam.itoa(i+1); try { @@ -1697,7 +1703,7 @@ int main(int argc, char *argv[]) cout << "ERROR: Problem setting Host Name in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } - + if ( newModuleHostName == oam::UnassignedName ) newModuleIPAddr = oam::UnassignedIpAddr; else @@ -1725,10 +1731,10 @@ int main(int argc, char *argv[]) pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) newModuleIPAddr = pcommand; + if (strlen(pcommand) > 0) newModuleIPAddr = pcommand; callFree(pcommand); } - + if (newModuleIPAddr == "127.0.0.1" || newModuleIPAddr == "0.0.0.0" || newModuleIPAddr == "128.0.0.1") { cout << endl << newModuleIPAddr + " is an Invalid IP Address for a multi-server system, please re-enter" << endl << endl; newModuleIPAddr = "unassigned"; @@ -1736,7 +1742,7 @@ int main(int argc, char *argv[]) exit(1); continue; } - + if (oam.isValidIP(newModuleIPAddr)) { //check and see if hostname already used bool matchFound = false; @@ -1753,7 +1759,7 @@ int main(int argc, char *argv[]) } if ( matchFound ) continue; - + // run ping test to validate string cmdLine = "ping "; string cmdOption = " -c 1 -w 5 >> /dev/null"; @@ -1771,10 +1777,10 @@ int main(int argc, char *argv[]) pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) temp = pcommand; + if (strlen(pcommand) > 0) temp = pcommand; callFree(pcommand); } - + if ( temp == "1" || temp == "2") break; else @@ -1801,7 +1807,7 @@ int main(int argc, char *argv[]) } } } - + //set Module IP address string moduleIPAddrNameParm = "ModuleIPAddr" + oam.itoa(moduleID) + "-" + oam.itoa(nicID) + "-" + oam.itoa(i+1); try { @@ -1812,13 +1818,13 @@ int main(int argc, char *argv[]) cout << "ERROR: Problem setting IP address in the MariaDB ColumnStore System Configuration file" << endl; exit(1); } - + if ( newModuleHostName == oam::UnassignedName && moduleHostNameFound ) // exit out to next module ID break; - + if (moduleType == "pm" && moduleDisableState == oam::ENABLEDSTATE) { - + switch(nicID) { case 1: performancemodule.moduleIP1 = newModuleIPAddr; @@ -1836,13 +1842,13 @@ int main(int argc, char *argv[]) if ( maxPMNicCount < nicID ) maxPMNicCount = nicID; } - + //save Nic host name and IP childmodule.moduleName = newModuleName; childmodule.moduleIP = newModuleIPAddr; childmodule.hostName = newModuleHostName; niclist.push_back(childmodule); - + if ( nicID > 1 ) continue; @@ -1853,7 +1859,7 @@ int main(int argc, char *argv[]) childmodule.hostName = newModuleHostName; childmodulelist.push_back(childmodule); } - + //set port addresses if ( newModuleName == parentOAMModuleName ) { parentOAMModuleHostName = newModuleHostName; @@ -1871,12 +1877,12 @@ int main(int argc, char *argv[]) string portName = parentOAMModuleName + "_WriteEngineServer"; sysConfig->setConfig(portName, "IPAddr", parentOAMModuleIPAddr); sysConfig->setConfig(portName, "Port", "8630"); - + if( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) { - + //set User Module's IP Addresses string Section = "ExeMgr" + oam.itoa(moduleID); - + sysConfig->setConfig(Section, "IPAddr", newModuleIPAddr); sysConfig->setConfig(Section, "Port", "8601"); sysConfig->setConfig(Section, "Module", parentOAMModuleName); @@ -1889,13 +1895,13 @@ int main(int argc, char *argv[]) //set User Module's IP Addresses if ( pmwithum ) { string Section = "ExeMgr" + oam.itoa(moduleID+umNumber); - + sysConfig->setConfig(Section, "IPAddr", newModuleIPAddr); sysConfig->setConfig(Section, "Port", "8601"); sysConfig->setConfig(Section, "Module", parentOAMModuleName); } - + //setup rc.local file in module tmp dir if( !makeRClocal(moduleType , newModuleName, IserverTypeInstall) ) cout << "makeRClocal error" << endl; @@ -1905,21 +1911,21 @@ int main(int argc, char *argv[]) //set child Process Monitor Port IP Address string portName = newModuleName + "_ProcessMonitor"; sysConfig->setConfig(portName, "IPAddr", newModuleIPAddr); - + sysConfig->setConfig(portName, "Port", "8800"); - + //set child Server Monitor Port IP Address portName = newModuleName + "_ServerMonitor"; sysConfig->setConfig(portName, "IPAddr", newModuleIPAddr); sysConfig->setConfig(portName, "Port", "8622"); - + //set Performance Module WriteEngineServer Port IP Address if ( moduleType == "pm" ) { portName = newModuleName + "_WriteEngineServer"; sysConfig->setConfig(portName, "IPAddr", newModuleIPAddr); sysConfig->setConfig(portName, "Port", "8630"); } - + //set User Module's IP Addresses if ( moduleType == "um" || ( moduleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) || @@ -1930,19 +1936,19 @@ int main(int argc, char *argv[]) string Section = "ExeMgr" + oam.itoa(moduleID); if ( moduleType == "pm" && pmwithum ) Section = "ExeMgr" + oam.itoa(moduleID+umNumber); - + sysConfig->setConfig(Section, "IPAddr", newModuleIPAddr); sysConfig->setConfig(Section, "Port", "8601"); sysConfig->setConfig(Section, "Module", newModuleName); } - + //set Performance Module's IP's to first NIC IP entered if ( newModuleName == "um1" ) { sysConfig->setConfig("DDLProc", "IPAddr", newModuleIPAddr); sysConfig->setConfig("DMLProc", "IPAddr", newModuleIPAddr); } } - + if ( !writeConfig(sysConfig) ) { cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); @@ -1951,17 +1957,17 @@ int main(int argc, char *argv[]) //create associated local/etc directory for module string cmd = "mkdir " + installDir + "/local/etc/" + newModuleName + " > /dev/null 2>&1"; system(cmd.c_str()); - - if ( newModuleName != parentOAMModuleName) { + + if ( newModuleName != parentOAMModuleName) { //make module file in local/etc/"modulename" if( !makeModuleFile(newModuleName, parentOAMModuleName) ) cout << "makeModuleFile error" << endl; } - + //setup rc.local file in module tmp dir if( !makeRClocal(moduleType , newModuleName, IserverTypeInstall) ) cout << "makeRClocal error" << endl; - + //if cloud, copy fstab in module tmp dir if ( amazonInstall && moduleType == "pm") if( !copyFstab(newModuleName) ) @@ -1970,13 +1976,13 @@ int main(int argc, char *argv[]) //setup DBRM Processes if ( newModuleName == parentOAMModuleName ) sysConfig->setConfig("DBRM_Controller", "IPAddr", newModuleIPAddr); - + if ( moduleDisableState == oam::ENABLEDSTATE ) { DBRMworkernodeID++; string DBRMSection = "DBRM_Worker" + oam.itoa(DBRMworkernodeID); sysConfig->setConfig(DBRMSection, "IPAddr", newModuleIPAddr); sysConfig->setConfig(DBRMSection, "Module", newModuleName); - } + } // only support 1 nic ID per Amazon instance if (amazonInstall) @@ -2026,16 +2032,16 @@ int main(int argc, char *argv[]) exit(1); } } - + if ( create == "n" ) { prompt = "Enter Volume ID assigned to module '" + newModuleName + "' (" + volumeName + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) volumeName = pcommand; + if (strlen(pcommand) > 0) volumeName = pcommand; callFree(pcommand); } - + //get device name based on DBRoot ID deviceName = "/dev/sdf"; } @@ -2079,7 +2085,7 @@ int main(int argc, char *argv[]) //if upgrade, get list of configure dbroots DBRootConfigList dbrootConfigList; - if ( reuseConfig == "y" ) + if ( reuseConfig == "y" ) { try { oam.getSystemDbrootConfig(dbrootConfigList); @@ -2200,7 +2206,7 @@ int main(int argc, char *argv[]) std::vector::iterator list = dbroots.begin(); for (; list != dbroots.end() ; list++) { - if ( *list == "1" ) + if ( *list == "1" ) { found = true; break; @@ -2236,7 +2242,7 @@ int main(int argc, char *argv[]) if ( inUse) break; - else + else { // if upgrade, dont allow a new DBRoot id to be entered if ( reuseConfig == "y" ) { @@ -2256,7 +2262,7 @@ int main(int argc, char *argv[]) oam.getUnassignedDbroot(undbrootlist); } catch(...) {} - + if ( !undbrootlist.empty() ) { DBRootConfigList::iterator pt1 = undbrootlist.begin(); @@ -2308,7 +2314,7 @@ int main(int argc, char *argv[]) string DBrootID = "DBRoot" + *it; string pathID = installDir + "/data" + *it; - + try { sysConfig->setConfig(SystemSection, DBrootID, pathID); } @@ -2346,7 +2352,7 @@ int main(int argc, char *argv[]) if ( reuseConfig == "n" && ( volumeName == oam::UnassignedName || volumeName.empty() || volumeName == "" ) ) { string create = "y"; - + cout << "*** NOTE: You have the option to provide an" << endl; cout << " existing EBS Volume ID or have a Volume created" << endl << endl; @@ -2366,13 +2372,13 @@ int main(int argc, char *argv[]) if ( noPrompting ) exit(1); } - + if ( create == "n" ) { prompt = "Enter Volume ID for '" + DBrootID + "' (" + volumeName + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) volumeName = pcommand; + if (strlen(pcommand) > 0) volumeName = pcommand; callFree(pcommand); } @@ -2382,7 +2388,7 @@ int main(int argc, char *argv[]) st = oam.getAWSdeviceName( atoi((*it).c_str()) ); } catch(...) {} - + deviceName = boost::get<0>(st); amazondeviceName = boost::get<1>(st); @@ -2396,9 +2402,9 @@ int main(int argc, char *argv[]) { DBRootConfigList dbrootlist; dbrootlist.push_back(atoi((*it).c_str())); - + oam.addDbroot(1, dbrootlist, PMVolumeSize); - + sleep(2); try { volumeName = sysConfig->getConfig(InstallSection, volumeNameID); @@ -2421,7 +2427,7 @@ int main(int argc, char *argv[]) pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) volumeName = pcommand; + if (strlen(pcommand) > 0) volumeName = pcommand; callFree(pcommand); } @@ -2535,7 +2541,7 @@ int main(int argc, char *argv[]) for (unsigned int j = 1 ; j < maxPMNicCount+1 ; j++) { PerformanceModuleList::iterator list1 = performancemodulelist.begin(); - + for (; list1 != performancemodulelist.end() ; list1++) { string pmName = PM + oam.itoa(pmsID); @@ -2589,7 +2595,7 @@ int main(int argc, char *argv[]) cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; exit(1); } - + //check if dbrm data resides in older directory path and inform user if it does dbrmDirCheck(); @@ -2607,18 +2613,18 @@ int main(int argc, char *argv[]) int thread_id = 0; pthread_t thr[childmodulelist.size()]; - + /* create a thread_data_t argument array */ thread_data_t thr_data[childmodulelist.size()]; string install = "y"; - if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM || + if ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM || pmNumber > 1 ) { // // perform remote install of other servers in the system // cout << endl << "===== System Installation =====" << endl << endl; - + cout << "System Configuration is complete, System Installation is the next step." << endl; while(true) @@ -2637,11 +2643,11 @@ int main(int argc, char *argv[]) if ( noPrompting ) exit(1); } - + if ( install == "y" ) { - + SystemSoftware systemsoftware; - + try { oam.getSystemSoftware(systemsoftware); @@ -2670,112 +2676,115 @@ int main(int argc, char *argv[]) else //nonroot, default to binary EEPackageType = "binary"; - while(true) { - prompt = "Enter the Package Type being installed to other servers [rpm,deb,binary] (" + EEPackageType + ") > "; - pcommand = callReadline(prompt); - if (pcommand) { - if (strlen(pcommand) > 0) EEPackageType = pcommand; - callFree(pcommand); + string version = systemsoftware.Version + "-" + systemsoftware.Release; + if ( managePackages == "1") + { + while(true) { + prompt = "Enter the Package Type being installed to other servers [rpm,deb,binary] (" + EEPackageType + ") > "; + pcommand = callReadline(prompt); + if (pcommand) { + if (strlen(pcommand) > 0) EEPackageType = pcommand; + callFree(pcommand); + } + + if ( EEPackageType == "rpm" || EEPackageType == "deb" || EEPackageType == "binary" ) { + break; + } + cout << "Invalid Package Type, please re-enter" << endl; + EEPackageType = "rpm"; + if ( noPrompting ) + exit(1); } - if ( EEPackageType == "rpm" || EEPackageType == "deb" || EEPackageType == "binary" ) { - break; - } - cout << "Invalid Package Type, please re-enter" << endl; - EEPackageType = "rpm"; - if ( noPrompting ) - exit(1); - } - - if ( EEPackageType == "rpm" ) - { - cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl; - cout << "located in the " + HOME + " directory." << endl << endl; - } - else - { - if ( EEPackageType == "binary" ) + if ( EEPackageType == "rpm" ) { - cout << "Performing an MariaDB ColumnStore System install using a Binary package" << endl; + cout << "Performing an MariaDB ColumnStore System install using RPM packages" << endl; cout << "located in the " + HOME + " directory." << endl << endl; } else { - cout << "Performing an MariaDB ColumnStore System install using using DEB packages" << endl; - cout << "located in the " + HOME + " directory." << endl; + if ( EEPackageType == "binary" ) + { + cout << "Performing an MariaDB ColumnStore System install using a Binary package" << endl; + cout << "located in the " + HOME + " directory." << endl << endl; + } + else + { + cout << "Performing an MariaDB ColumnStore System install using using DEB packages" << endl; + cout << "located in the " + HOME + " directory." << endl; + } } - } - - //Write out Updated System Configuration File - try { - sysConfig->setConfig(InstallSection, "EEPackageType", EEPackageType); - } - catch(...) - { - cout << "ERROR: Problem setting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } - - if ( !writeConfig(sysConfig) ) { - cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; - exit(1); - } - //check if pkgs are located in $HOME directory - string version = systemsoftware.Version + "-" + systemsoftware.Release; - if ( EEPackageType != "binary") { - string separator = "-"; - calpontPackage1 = "mariadb-columnstore-*" + separator + version; - //calpontPackage2 = "mariadb-columnstore-libs" + separator + version; - //calpontPackage3 = "mariadb-columnstore-enterprise" + separator + version; - //mysqlPackage = "mariadb-columnstore-storage-engine" + separator + version; - //mysqldPackage = "mariadb-columnstore-mysql" + separator + version; - - if( !pkgCheck() ) { + //Write out Updated System Configuration File + try { + sysConfig->setConfig(InstallSection, "EEPackageType", EEPackageType); + } + catch(...) + { + cout << "ERROR: Problem setting EEPackageType from the MariaDB ColumnStore System Configuration file" << endl; exit(1); } + + if ( !writeConfig(sysConfig) ) { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + //check if pkgs are located in $HOME directory + if ( EEPackageType != "binary") { + string separator = "-"; + calpontPackage1 = "mariadb-columnstore-*" + separator + version; + //calpontPackage2 = "mariadb-columnstore-libs" + separator + version; + //calpontPackage3 = "mariadb-columnstore-enterprise" + separator + version; + //mysqlPackage = "mariadb-columnstore-storage-engine" + separator + version; + //mysqldPackage = "mariadb-columnstore-mysql" + separator + version; + + if( !pkgCheck() ) { + exit(1); + } + else + { + //mariadb + calpontPackage1 = "mariadb-columnstore-*" + separator + version; + + calpontPackage1 = HOME + "/" + calpontPackage1 + "*." + EEPackageType; + //calpontPackage2 = HOME + "/" + calpontPackage2 + "*." + EEPackageType; + //calpontPackage3 = HOME + "/" + calpontPackage3 + "*." + EEPackageType; + //mysqlPackage = HOME + "/" + mysqlPackage + "*." + EEPackageType; + //mysqldPackage = HOME + "/" + mysqldPackage + "*." + EEPackageType; + } + } else { - //mariadb - calpontPackage1 = "mariadb-columnstore-*" + separator + version; + // binary + //string fileName = installDir + "/bin/healthcheck"; + //ifstream file (fileName.c_str()); + //if (!file) // CE + calpontPackage1 = "mariadb-columnstore-" + version; + //else // EE + //calpontPackage1 = "mariadb-columnstore-ent-" + version; + //calpontPackage2 = "dummy"; + //calpontPackage3 = "dummy"; + //mysqlPackage = calpontPackage1; + //mysqldPackage = calpontPackage1; - calpontPackage1 = HOME + "/" + calpontPackage1 + "*." + EEPackageType; - //calpontPackage2 = HOME + "/" + calpontPackage2 + "*." + EEPackageType; - //calpontPackage3 = HOME + "/" + calpontPackage3 + "*." + EEPackageType; - //mysqlPackage = HOME + "/" + mysqlPackage + "*." + EEPackageType; - //mysqldPackage = HOME + "/" + mysqldPackage + "*." + EEPackageType; + if( !pkgCheck() ) + exit(1); + calpontPackage1 = HOME + "/" + calpontPackage1 + "*.bin.tar.gz"; + //calpontPackage2 = "dummy"; + //calpontPackage3 = "dummy"; } - } - else - { - // binary - //string fileName = installDir + "/bin/healthcheck"; - //ifstream file (fileName.c_str()); - //if (!file) // CE - calpontPackage1 = "mariadb-columnstore-" + version; - //else // EE - //calpontPackage1 = "mariadb-columnstore-ent-" + version; - //calpontPackage2 = "dummy"; - //calpontPackage3 = "dummy"; - //mysqlPackage = calpontPackage1; - //mysqldPackage = calpontPackage1; - if( !pkgCheck() ) - exit(1); - calpontPackage1 = HOME + "/" + calpontPackage1 + "*.bin.tar.gz"; - //calpontPackage2 = "dummy"; - //calpontPackage3 = "dummy"; + //If ent pkg is not there, mark it as such + //{ + // glob_t gt; + // memset(>, 0, sizeof(gt)); + // if (glob(calpontPackage3.c_str(), 0, 0, >) != 0) + // calpontPackage3 = "dummy.rpm"; + // globfree(>); + //} } - //If ent pkg is not there, mark it as such - //{ - // glob_t gt; - // memset(>, 0, sizeof(gt)); - // if (glob(calpontPackage3.c_str(), 0, 0, >) != 0) - // calpontPackage3 = "dummy.rpm"; - // globfree(>); - //} - if ( password.empty() ) { cout << endl; @@ -2785,7 +2794,7 @@ int main(int argc, char *argv[]) } while(true) - { + { char *pass1, *pass2; if ( noPrompting ) { @@ -2850,7 +2859,7 @@ int main(int argc, char *argv[]) string remoteModuleIP = (*list1).moduleIP; string remoteHostName = (*list1).hostName; string remoteModuleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE); - + string debug_logfile; string logfile; if ( remote_installer_debug == "1" ) { @@ -2874,14 +2883,14 @@ int main(int argc, char *argv[]) temppwprompt = "none"; //run remote installer script - cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + remote_installer_debug + " " + debug_logfile; + cmd = installDir + "/bin/user_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + temppwprompt + " " + mysqlPort + " " + remote_installer_debug + " " + debug_logfile + " " + managePackages; //cout << cmd << endl; if ( thread_remote_installer ) { thr_data[thread_id].command = cmd; int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]); - + if ( status != 0 ) { cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; @@ -2914,7 +2923,7 @@ int main(int argc, char *argv[]) cout << endl << "Error returned from remote_command.sh" << endl; exit(1); } - + if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR .my.cnf") ) { // password needed check and get password from remote UM cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1"; @@ -2962,7 +2971,7 @@ int main(int argc, char *argv[]) break; } } - + //re-run post-mysql-install with password cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/post-mysql-install " + pwprompt + "' < /tmp/post-mysql-install.log"; rtnCode = system(cmd.c_str()); @@ -2987,19 +2996,19 @@ int main(int argc, char *argv[]) cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage1 + " " + remoteModuleType + " initial " + binservertype + " " + mysqlPort + " " + remote_installer_debug + - " " + installDir + " " + debug_logfile; - + " " + installDir + " " + debug_logfile + " " + managePackages; + if ( thread_remote_installer ) { thr_data[thread_id].command = cmd; int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]); - + if ( status != 0 ) { cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; exit (1); } - + thread_id++; } else @@ -3024,20 +3033,20 @@ int main(int argc, char *argv[]) if ( EEPackageType != "binary" ) { //run remote installer script - cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile; + cmd = installDir + "/bin/performance_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile + " " + managePackages; //cout << cmd << endl; if ( thread_remote_installer ) { thr_data[thread_id].command = cmd; int status = pthread_create (&thr[thread_id], NULL, (void*(*)(void*)) &remoteInstallThread, &thr_data[thread_id]); - + if ( status != 0 ) { cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; exit (1); } - + thread_id++; } else @@ -3049,7 +3058,7 @@ int main(int argc, char *argv[]) } } } - else + else { // do a binary package install string binservertype = serverTypeInstall; if ( pmwithum ) @@ -3057,7 +3066,7 @@ int main(int argc, char *argv[]) cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + calpontPackage1 + " " + remoteModuleType + " initial " + binservertype + " " + mysqlPort + " " + remote_installer_debug + " " + installDir + " " + - debug_logfile; + debug_logfile + " " + managePackages; if ( thread_remote_installer ) { thr_data[thread_id].command = cmd;