From ba78610a8edb30f2f0121c4efdd23b81f9067f7e Mon Sep 17 00:00:00 2001 From: david hill Date: Fri, 22 Apr 2016 13:50:26 -0500 Subject: [PATCH] change how the fstab to setup on other modules --- oam/install_scripts/module_installer.sh | 4 +- oam/oamcpp/liboamcpp.cpp | 4 +- oamapps/postConfigure/postConfigure.cpp | 60 ++++++++++++------------- procmgr/processmanager.cpp | 5 ++- procmon/processmonitor.cpp | 24 +++++----- 5 files changed, 50 insertions(+), 47 deletions(-) diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index 764a8beb1..24f11a920 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -57,12 +57,12 @@ cloud=`$INFINIDB_INSTALL_DIR/bin/getConfig Installation Cloud` if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then cp $INFINIDB_INSTALL_DIR/local/etc/*.pem /root/. > /dev/null 2>&1 - if test -f $INFINIDB_INSTALL_DIR/local/fstab ; then + if test -f $INFINIDB_INSTALL_DIR/local/pm1/fstab ; then echo "Setup fstab on Module" touch /etc/fstab rm -f /etc/fstab.calpontSave mv /etc/fstab /etc/fstab.calpontSave - cp $INFINIDB_INSTALL_DIR/local/fstab /etc/fstab + cat $INFINIDB_INSTALL_DIR/local/pm1/fstab >> /etc/fstab fi fi diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 1805d5db9..fa9e7cdd4 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -8477,7 +8477,7 @@ namespace oam ******************************************************************************************/ std::string Oam::updateFstab(std::string device, std::string dbrootID) { - writeLog("updateFstab called: " + device + ":" + dbrootID, LOG_TYPE_INFO ); + writeLog("updateFstab called: " + device + ":" + dbrootID, LOG_TYPE_DEBUG ); //check if entry already exist string cmd = "grep /data" + dbrootID + " /etc/fstab /dev/null 2>&1"; @@ -8493,7 +8493,7 @@ namespace oam system(cmd.c_str()); //use from addmodule later - cmd = "echo " + entry + " >> " + InstallDir + "/local/etc/pm1/fstab"; + cmd = "touch " + InstallDir + "/local/etc/pm1/fstab;echo " + entry + " >> " + InstallDir + "/local/etc/pm1/fstab"; system(cmd.c_str()); return entry; diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 4455938cc..69a4b855c 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -559,11 +559,11 @@ int main(int argc, char *argv[]) // setup storage if (!singleServerDBrootSetup()) { - cout << "ERROR: Problem setting up dbroot IDs" << endl; + cout << "ERROR: Problem setting up DBRoot IDs" << endl; exit(1); } - //set system dbroot count and check 'files per parition' with number of dbroots + //set system DBRoot count and check 'files per parition' with number of dbroots try { sysConfig->setConfig(SystemSection, "DBRootCount", oam.itoa(DBRootCount)); } @@ -2076,9 +2076,9 @@ int main(int argc, char *argv[]) cout << "makeRClocal error" << endl; //if cloud, copy fstab in module tmp dir - if ( cloud == "amazon" && moduleType == "pm") - if( !copyFstab(newModuleName) ) - cout << "copyFstab error" << endl; +// if ( cloud == "amazon" && moduleType == "pm") +// if( !copyFstab(newModuleName) ) +// cout << "copyFstab error" << endl; //setup DBRM Processes if ( newModuleName == parentOAMModuleName ) @@ -2143,7 +2143,7 @@ int main(int argc, char *argv[]) callFree(pcommand); } - //get device name based on dbroot ID + //get device name based on DBRoot ID deviceName = "/dev/sdf" + oam.itoa(moduleID); } else @@ -2205,7 +2205,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting dbroot count in the InfiniDB System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the InfiniDB System Configuration file" << endl; exit(1); } @@ -2245,7 +2245,7 @@ int main(int argc, char *argv[]) dbroots.clear(); bool matchFound = false; - prompt = "Enter the list (Nx,Ny,Nz) or range (Nx-Nz) of dbroot IDs assigned to module '" + newModuleName + "' (" + dbrootList + ") > "; + prompt = "Enter the list (Nx,Ny,Nz) or range (Nx-Nz) of DBRoot IDs assigned to module '" + newModuleName + "' (" + dbrootList + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { @@ -2301,7 +2301,7 @@ int main(int argc, char *argv[]) } } - //if pm1, make sure dbroot #1 is in the list + //if pm1, make sure DBRoot #1 is in the list if ( newModuleName == "pm1" ) { bool found = false; @@ -2317,14 +2317,14 @@ int main(int argc, char *argv[]) if ( !found ) { - cout << endl << "Invalid Entry, Module pm1 has to have dbroot #1 assigned to it, please re-enter" << endl; + cout << endl << "Invalid Entry, Module pm1 has to have DBRoot #1 assigned to it, please re-enter" << endl; if ( noPrompting ) exit(1); continue; } } - //check and see if dbroot ID already used + //check and see if DBRoot ID already used std::vector::iterator list = dbroots.begin(); for (; list != dbroots.end() ; list++) { @@ -2345,7 +2345,7 @@ int main(int argc, char *argv[]) if ( inUse) break; else - { // if upgrade, dont allow a new dbroot id to be entered + { // if upgrade, dont allow a new DBRoot id to be entered if ( reuseConfig == "y" ) { DBRootConfigList::iterator pt = dbrootConfigList.begin(); @@ -2403,7 +2403,7 @@ int main(int argc, char *argv[]) dbrootmodule.dbrootID = *it; dbrootlist.push_back(dbrootmodule); - //store dbroot ID + //store DBRoot ID string moduledbrootid = "ModuleDBRootID" + oam.itoa(moduleID) + "-" + oam.itoa(id) + "-" + oam.itoa(i+1); try { sysConfig->setConfig(ModuleSection, moduledbrootid, *it); @@ -2434,7 +2434,7 @@ int main(int argc, char *argv[]) //get EC2 volume name and info if ( DBRootStorageType == "external" && cloud == "amazon") { - cout << endl << "*** Setup External EBS Volume for dbroot #" << *it << " ***" << endl; + cout << endl << "*** Setup External EBS Volume for DBRoot #" << *it << " ***" << endl; cout << "*** NOTE: You can either have postConfigure create a new EBS volume or you can provide an existing Volume ID to use" << endl << endl; string volumeNameID = "PMVolumeName" + *it; @@ -2457,7 +2457,7 @@ int main(int argc, char *argv[]) while(true) { - pcommand = callReadline("Create a new EBS volume for dbroot #" + *it + " ? [y,n] (y) > "); + pcommand = callReadline("Create a new EBS volume for DBRoot #" + *it + " ? [y,n] (y) > "); if (pcommand) { if (strlen(pcommand) > 0) create = pcommand; @@ -2481,7 +2481,7 @@ int main(int argc, char *argv[]) callFree(pcommand); } - //get device name based on dbroot ID + //get device name based on DBRoot ID oam::storageID_t st; try { st = oam.getAWSdeviceName( atoi((*it).c_str()) ); @@ -2491,12 +2491,12 @@ int main(int argc, char *argv[]) deviceName = boost::get<0>(st); amazondeviceName = boost::get<1>(st); - // fstabs + // update fstabs string entry = oam.updateFstab( amazondeviceName, *it); } else { - // create amazon ebs dbroot + // create amazon ebs DBRoot try { DBRootConfigList dbrootlist; @@ -2530,7 +2530,7 @@ int main(int argc, char *argv[]) callFree(pcommand); } - // fstabs + // update fstabs string entry = oam.updateFstab( amazondeviceName, *it); } @@ -2567,7 +2567,7 @@ int main(int argc, char *argv[]) } catch(...) { - cout << "ERROR: Problem setting dbroot count in the InfiniDB System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the InfiniDB System Configuration file" << endl; exit(1); } //total dbroots on the system @@ -4461,21 +4461,21 @@ bool storageSetup(string cloud) prompt = "Select the type of Data Storage [1=internal, 2=external, 3=GlusterFS, 4=hdfs] (" + storageType + ") > "; } - cout << " 'internal' - This is specified when a local disk is used for the dbroot storage." << endl; + cout << " 'internal' - This is specified when a local disk is used for the DBRoot storage." << endl; cout << " High Availability Server Failover is not Supported in this mode" << endl << endl; - cout << " 'external' - This is specified when the dbroot directories are mounted." << endl; + cout << " 'external' - This is specified when the DBRoot directories are mounted." << endl; cout << " High Availability Server Failover is Supported in this mode." << endl << endl; if ( glusterInstalled == "y" ) { cout << " 'GlusterFS' - This is specified when GlusterFS Data Redundancy is installed" << endl; - cout << " and you want the dbroot directories to be controlled by glusterfs." << endl; + cout << " and you want the DBRoot directories to be controlled by glusterfs." << endl; cout << " High Availability Server Failover is Supported in this mode." << endl << endl; } if ( hadoopInstalled == "y" ) { - cout << " 'hdfs' - This is specified when hadoop is installed and you want the dbroot" << endl; + cout << " 'hdfs' - This is specified when hadoop is installed and you want the DBRoot" << endl; cout << " directories to be controlled by the Hadoop Distributed File System (HDFS)." << endl; cout << " High Availability Server Failover is Supported in this mode." << endl << endl; } @@ -5067,7 +5067,7 @@ bool attachVolume(string instanceName, string volumeName, string deviceName, str string status = oam.getEC2VolumeStatus(volumeName); if ( status == "attached" ) { cout << "Volume " << volumeName << " is attached " << endl; - cout << "Make sure it's device " << deviceName << " is mounted to dbroot directory " << dbrootPath << endl; + cout << "Make sure it's device " << deviceName << " is mounted to DBRoot directory " << dbrootPath << endl; return true; } @@ -5102,7 +5102,7 @@ bool attachVolume(string instanceName, string volumeName, string deviceName, str cout << "Attaching, please wait..." << endl; if(oam.attachEC2Volume(volumeName, deviceName, instanceName)) { cout << "Volume " << volumeName << " is now attached " << endl; - cout << "Make sure it's device " << deviceName << " is mounted to dbroot directory " << dbrootPath << endl; + cout << "Make sure it's device " << deviceName << " is mounted to DBRoot directory " << dbrootPath << endl; return true; } else @@ -5135,7 +5135,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting dbroot count in the InfiniDB System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the InfiniDB System Configuration file" << endl; exit(1); } @@ -5170,7 +5170,7 @@ bool singleServerDBrootSetup() { dbroots.clear(); - prompt = "Enter the list (Nx,Ny,Nz) or range (Nx-Nz) of dbroot IDs assigned to module 'pm1' (" + dbrootList + ") > "; + prompt = "Enter the list (Nx,Ny,Nz) or range (Nx-Nz) of DBRoot IDs assigned to module 'pm1' (" + dbrootList + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { @@ -5225,7 +5225,7 @@ bool singleServerDBrootSetup() std::vector::iterator it = dbroots.begin(); for (; it != dbroots.end() ; it++, ++id) { - //store dbroot ID + //store DBRoot ID string moduledbrootid = "ModuleDBRootID1-" + oam.itoa(id) + "-3"; try { sysConfig->setConfig(ModuleSection, moduledbrootid, *it); @@ -5256,7 +5256,7 @@ bool singleServerDBrootSetup() } catch(...) { - cout << "ERROR: Problem setting dbroot count in the InfiniDB System Configuration file" << endl; + cout << "ERROR: Problem setting DBRoot count in the InfiniDB System Configuration file" << endl; exit(1); } diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 5b0a7c726..dd329d96e 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -2495,7 +2495,7 @@ void processMSG(messageqcpp::IOSocket* cfIos) if ( target == "system" ) { - //send out to all pms + //send out to all pms except local module for( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++) { if ( systemmoduletypeconfig.moduletypeconfig[i].ModuleType != "pm" ) @@ -2508,6 +2508,9 @@ void processMSG(messageqcpp::IOSocket* cfIos) DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin(); for (;pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end(); pt++) { + if ( (*pt).DeviceName == config.moduleName() ) + continue; + int retStatus = processManager.updateFstab((*pt).DeviceName, entry); if (retStatus != API_SUCCESS) status = retStatus; diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 69d3d6a1c..ccf8042d5 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -981,7 +981,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO if( config.moduleType() == "pm" ) { - //setup dbroot mounts + //setup DBRoot mounts createDataDirs(cloud); int ret = checkDataMount(); if (ret != oam::API_SUCCESS) @@ -1592,7 +1592,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO string dbrootID; msg >> dbrootID; - log.writeLog(__LINE__, "MSG RECEIVED: Unmount dbroot: " + dbrootID); + log.writeLog(__LINE__, "MSG RECEIVED: Unmount DBRoot: " + dbrootID); //Flush the cache cacheutils::flushPrimProcCache(); @@ -1636,7 +1636,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO if ( retry >= 5 ) { - log.writeLog(__LINE__, "unmount failed, device busy, dbroot: " + dbrootID, LOG_TYPE_ERROR); + log.writeLog(__LINE__, "unmount failed, device busy, DBRoot: " + dbrootID, LOG_TYPE_ERROR); return_status = API_FAILURE; system("mv -f /tmp/umount.txt /tmp/umount_failed.txt"); } @@ -1671,7 +1671,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO string dbrootID; msg >> dbrootID; - log.writeLog(__LINE__, "MSG RECEIVED: Mount dbroot: " + dbrootID);; + log.writeLog(__LINE__, "MSG RECEIVED: Mount DBRoot: " + dbrootID);; int return_status = API_SUCCESS; if (GlusterConfig == "n") @@ -1692,7 +1692,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO if ( size != 0 ) { if (!oam.checkLogStatus("/tmp/mount.txt", "already")) { - log.writeLog(__LINE__, "mount failed, dbroot: " + dbrootID, LOG_TYPE_ERROR); + log.writeLog(__LINE__, "mount failed, DBRoot: " + dbrootID, LOG_TYPE_ERROR); return_status = API_FAILURE; system("mv -f /tmp/mount.txt /tmp/mount_failed.txt"); } @@ -3596,7 +3596,7 @@ int ProcessMonitor::reconfigureModule(std::string reconfigureModuleName) system(cmd.c_str()); } - //copy and apply new rc.local.calpont from dm1 + //copy and apply new rc.local.calpont from pm1 cmd = "rm -f " + installDir + "/local/rc.local.calpont"; system(cmd.c_str()); cmd = "cp " + installDir + "/local/etc/" + reconfigureModuleName + "/rc.local.calpont " + installDir + "/local/."; @@ -5612,7 +5612,7 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID) } else { - log.writeLog(__LINE__, "amazonVolumeCheck function called for dbroot" + oam.itoa(dbrootID), LOG_TYPE_DEBUG); + log.writeLog(__LINE__, "amazonVolumeCheck function called for DBRoot" + oam.itoa(dbrootID), LOG_TYPE_DEBUG); string volumeNameID = "PMVolumeName" + oam.itoa(dbrootID); string volumeName = oam::UnassignedName; @@ -5626,7 +5626,7 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID) {} if ( volumeName.empty() || volumeName == oam::UnassignedName ) { - log.writeLog(__LINE__, "amazonVolumeCheck function exiting, no volume assigned to dbroot " + oam.itoa(dbrootID), LOG_TYPE_WARNING); + log.writeLog(__LINE__, "amazonVolumeCheck function exiting, no volume assigned to DBRoot " + oam.itoa(dbrootID), LOG_TYPE_WARNING); return false; } @@ -5837,7 +5837,7 @@ int ProcessMonitor::checkDataMount() } catch(...) {} - //asign dbroot is gluster + //asign DBRoot is gluster if (GlusterConfig == "y") { vector::iterator p = dbrootList.begin(); @@ -5872,7 +5872,7 @@ int ProcessMonitor::checkDataMount() string fileName = dbroot + "/OAMdbrootCheck"; ofstream fout(fileName.c_str()); if (!fout) { - log.writeLog(__LINE__, "ERROR: Failed test write to dbroot: " + dbroot, LOG_TYPE_ERROR); + log.writeLog(__LINE__, "ERROR: Failed test write to DBRoot: " + dbroot, LOG_TYPE_ERROR); return API_FAILURE; } @@ -5919,7 +5919,7 @@ int ProcessMonitor::checkDataMount() if ( size != 0 ) { if (!oam.checkLogStatus("/tmp/mount.txt", "already")) { - log.writeLog(__LINE__, "checkDataMount: mount failed, dbroot: " + dbroot, LOG_TYPE_ERROR); + log.writeLog(__LINE__, "checkDataMount: mount failed, DBRoot: " + dbroot, LOG_TYPE_ERROR); try{ oam.setDbrootStatus(*p, oam::AUTO_OFFLINE); @@ -5943,7 +5943,7 @@ int ProcessMonitor::checkDataMount() //create OAM-Test-Flag check rw mount ofstream fout(fileName.c_str()); if (!fout) { - log.writeLog(__LINE__, "ERROR: Failed test write to dbroot: " + dbroot, LOG_TYPE_ERROR); + log.writeLog(__LINE__, "ERROR: Failed test write to DBRoot: " + dbroot, LOG_TYPE_ERROR); try{ oam.setDbrootStatus(*p, oam::AUTO_OFFLINE);