From e75afd3b8f0285d309e764fe70ccf54daa6dc050 Mon Sep 17 00:00:00 2001 From: Ben Thompson Date: Mon, 11 Sep 2017 17:08:12 -0500 Subject: [PATCH] Fix non-root gluster commands and undo change in processmonitor that was not meant to be checked in. --- procmon/main.cpp | 16 ++++------------ procmon/processmonitor.cpp | 36 +++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/procmon/main.cpp b/procmon/main.cpp index 435d6fc8f..a5958ad3e 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -162,8 +162,8 @@ int main(int argc, char **argv) } //re-read local system info with updated Columnstore.xml - sleep(1); - MonitorConfig config; +// sleep(1); +// MonitorConfig config; //PMwithUM config try { @@ -357,9 +357,6 @@ int main(int argc, char **argv) sleep(1); } } - //re-read local system info with new Columnstore.xml - sleep(1); - MonitorConfig config; } // not OAM parent module, delay starting until a successful get status is performed @@ -412,9 +409,6 @@ int main(int argc, char **argv) sleep(1); } } - //re-read local system info with new Columnstore.xml - sleep(1); - MonitorConfig config; } // not OAM parent module, delay starting until a successful get status is performed @@ -481,11 +475,11 @@ int main(int argc, char **argv) if ( retry == 20 ) { - log.writeLog(__LINE__, "Check DB mounts failed, infinidb shutting down", LOG_TYPE_CRITICAL); + log.writeLog(__LINE__, "Check DB mounts failed, shutting down", LOG_TYPE_CRITICAL); //Set the alarm aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET); sleep (1); - string cmd = startup::StartUp::installDir() + "/bin/infinidb stop > /dev/null 2>&1"; + string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1"; system(cmd.c_str()); } @@ -635,8 +629,6 @@ int main(int argc, char **argv) } } - MonitorConfig config; - while(true) { try { diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 36231c431..7bd656e8f 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -5871,11 +5871,6 @@ int ProcessMonitor::checkDataMount() } } - if ( dbrootList.size() == 0 && DataRedundancyConfig != "y") { - log.writeLog(__LINE__, "No dbroots are configured in Columnstore.xml file", LOG_TYPE_WARNING); - return API_INVALID_PARAMETER; - } - try{ oam.getSystemConfig("DBRootStorageType", DBRootStorageType); } @@ -5904,6 +5899,11 @@ int ProcessMonitor::checkDataMount() } } + if ( dbrootList.size() == 0 ) { + log.writeLog(__LINE__, "No dbroots are configured in Columnstore.xml file", LOG_TYPE_WARNING); + return API_INVALID_PARAMETER; + } + if ( DBRootStorageType == "hdfs" || (DBRootStorageType == "internal" && DataRedundancyConfig == "n") ) { //create OAM-Test-Flag @@ -6122,7 +6122,7 @@ int ProcessMonitor::glusterAssign(std::string dbrootID) { Oam oam; Config* sysConfig = Config::makeConfig(); - + string command; std::string errmsg = ""; log.writeLog(__LINE__, "glusterAssign called : " + dbrootID, LOG_TYPE_DEBUG); @@ -6135,9 +6135,17 @@ int ProcessMonitor::glusterAssign(std::string dbrootID) { moduleIPAddr = sysConfig->getConfig("SystemModuleConfig",dataDupIPaddr); } - string command = "mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" + - dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1"; + if ( rootUser) + { + command = "mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" + + dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1"; + } + else + { + command = "sudo mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" + + dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1"; + } int ret = system(command.c_str()); if ( WEXITSTATUS(ret) != 0 ) @@ -6169,13 +6177,19 @@ int ProcessMonitor::glusterAssign(std::string dbrootID) int ProcessMonitor::glusterUnassign(std::string dbrootID) { Oam oam; - + string command; std::string errmsg = ""; log.writeLog(__LINE__, "glusterUnassign called: " + dbrootID, LOG_TYPE_DEBUG); - string command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1"; - + if ( rootUser) + { + command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1"; + } + else + { + command = "sudo umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1"; + } int ret = system(command.c_str()); if ( WEXITSTATUS(ret) != 0 ) {