diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 2660a1cd7..1049ef650 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -6149,7 +6149,14 @@ namespace oam } //get device name based on dbroot ID - string deviceName = getAWSdeviceName( *pt1 ); + storageID_t st; + try { + st = getAWSdeviceName( *pt1 ); + } + catch(...) {} + + string deviceName = boost::get<0>(st); + string labelName = boost::get<1>(st); //attach volumes to local instance retry = 0; @@ -6170,7 +6177,10 @@ namespace oam //format attached volume cout << " Formatting DBRoot #" << itoa(*pt1) << ", please wait..." << endl; - string cmd = "mkfs.ext2 -F " + deviceName + " > /dev/null 2>&1"; + string cmd = "mkfs.ext2 -F " + deviceName + " " + "-L " + labelName + " > /tmp/format.log 2>&1"; + + writeLog("addDbroot format cmd: " + cmd, LOG_TYPE_DEBUG ); + system(cmd.c_str()); //detach @@ -6182,13 +6192,13 @@ namespace oam //write volume and device name try { sysConfig->setConfig(Section, volumeNameID, volumeName); - sysConfig->setConfig(Section, deviceNameID, deviceName); + sysConfig->setConfig(Section, deviceNameID, labelName); } catch(...) {} //update /etc/fstab with mount - string entry = deviceName + " " + InstallDir + "/data" + itoa(*pt1) + " ext2 noatime,nodiratime,noauto 0 0"; + string entry = labelName + " " + InstallDir + "/data" + itoa(*pt1) + " ext2 noatime,nodiratime,noauto 0 0"; //use from addmodule later cmd = "echo " + entry + " >> " + InstallDir + "/local/etc/pm1/fstab"; @@ -6895,13 +6905,13 @@ namespace oam * ****************************************************************************/ - std::string Oam::getAWSdeviceName( const int dbrootid) + storageID_t Oam::getAWSdeviceName( const int dbrootid) { //calulate id numbers from DBRoot ID int lid = (dbrootid-1) / 10; int did = dbrootid - (dbrootid * lid); - return PMdeviceName + deviceLetter[lid] + itoa(did); + return boost::make_tuple(PMdeviceName + deviceLetter[lid] + itoa(did), "LABEL=DBROOT" + itoa(dbrootid)); } /*************************************************************************** diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h index 68105b71e..42f1effd3 100644 --- a/oam/oamcpp/liboamcpp.h +++ b/oam/oamcpp/liboamcpp.h @@ -1077,6 +1077,15 @@ namespace oam typedef boost::tuple myProcessStatus_t; + /** @brief Store Device ID Structure + * + * Structure that is returned by the getMyProcessStatus API for the + * Local Process OAM Status data stored in the Process Status file + * Returns: Process ID, Process Name, and Process State + */ + + typedef boost::tuple storageID_t; + /** @brief User Configuration Structure * * Structure that is returned by the getHardwareUserConfig API for the @@ -2279,7 +2288,7 @@ namespace oam /** *@brief get AWS Device Name for DBRoot ID */ - EXPORT std::string getAWSdeviceName( const int dbrootid); + EXPORT storageID_t getAWSdeviceName( const int dbrootid); /** *@brief set System DBRoot Count