diff --git a/oam/cloud/IDBVolumeCmds.sh b/oam/cloud/IDBVolumeCmds.sh index ecb5721db..b5a11ab10 100644 --- a/oam/cloud/IDBVolumeCmds.sh +++ b/oam/cloud/IDBVolumeCmds.sh @@ -14,7 +14,7 @@ fi if [ "$1" = "create" ]; then if [ "$2" = "" ]; then - echo "Enter of the volume, in GiB (1-1024)" + echo "Enter size of the volume, in GiB (1-1024)" exit 1 fi volumeSize="$2" diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index fc3ec57f8..c38300f45 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -5930,14 +5930,14 @@ namespace oam * ****************************************************************************/ - void Oam::addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist) + void Oam::addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist, string EBSsize) { int SystemDBRootCount = 0; string cloud; string DBRootStorageType; string volumeSize; Config* sysConfig = Config::makeConfig(CalpontConfigFile.c_str()); - string Section = "SystemConfig"; + string Section = "SystemConfig"; try { getSystemConfig("DBRootCount", SystemDBRootCount); @@ -5957,6 +5957,20 @@ namespace oam if ( (cloud == "amazon-ec2" || cloud == "amazon-vpc") && DBRootStorageType == "external" ) { + if ( volumeSize == oam::UnassignedName ) + { + if ( EBSsize != oam::UnassignedName ) { + volumeSize = EBSsize; + setSystemConfig("PMVolumeSize", volumeSize); + } + } + else + { + if ( EBSsize != oam::UnassignedName ) { + volumeSize = EBSsize; + } + } + if ( newSystemDBRootCount > MAX_DBROOT_AMAZON ) { cout << "ERROR: Failed add, total Number of DBRoots would be over maximum of " << MAX_DBROOT_AMAZON << endl; diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h index b7bad035b..a118762d9 100644 --- a/oam/oamcpp/liboamcpp.h +++ b/oam/oamcpp/liboamcpp.h @@ -2244,7 +2244,7 @@ namespace oam /** *@brief add DBRoot */ - EXPORT void addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist); + EXPORT void addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist, std::string EBSsize = oam::UnassignedName); /** *@brief distribute Fstab Updates diff --git a/oamapps/calpontConsole/calpontConsole.cpp b/oamapps/calpontConsole/calpontConsole.cpp index f678c3146..19649f6b9 100644 --- a/oamapps/calpontConsole/calpontConsole.cpp +++ b/oamapps/calpontConsole/calpontConsole.cpp @@ -1666,65 +1666,84 @@ int processCommand(string* arguments) case 14: // addDbroot parameters: dbroot-number { - string GlusterConfig = "n"; - try { - oam.getSystemConfig( "GlusterConfig", GlusterConfig); - } - catch(...) - {} + string GlusterConfig = "n"; + try { + oam.getSystemConfig( "GlusterConfig", GlusterConfig); + } + catch(...) + {} - if (GlusterConfig == "y") { - cout << endl << "**** addDbroot Not Supported on Data Redundancy Configured System, use addModule command to expand your capacity" << endl; - break; - } + if (GlusterConfig == "y") { + cout << endl << "**** addDbroot Not Supported on Data Redundancy Configured System, use addModule command to expand your capacity" << endl; + break; + } - if ( localModule != parentOAMModule ) { - // exit out since not on active module - cout << endl << "**** addDbroot Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl; - break; - } + if ( localModule != parentOAMModule ) { + // exit out since not on active module + cout << endl << "**** addDbroot Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl; + break; + } - if (arguments[1] == "") - { - // need atleast 1 arguments - cout << endl << "**** addDbroot Failed : Missing a required Parameter, enter 'help' for additional information" << endl; - break; - } + string cloud; + bool amazon = false; + try { + oam.getSystemConfig("Cloud", cloud); + } + catch(...) {} - if (arguments[2] != "") - { - // error out if extra arguments exist to catch if they meant to use assigndbrootpmconfig - cout << endl << "**** addDbroot Failed : Extra Parameter passed, enter 'help' for additional information" << endl; - break; - } + string::size_type pos = cloud.find("amazon",0); + if (pos != string::npos) + amazon = true; - int dbrootNumber = atoi(arguments[1].c_str()); + if (arguments[1] == "") + { + // need atleast 1 arguments + cout << endl << "**** addDbroot Failed : Missing a required Parameter, enter 'help' for additional information" << endl; + break; + } - //get dbroots ids for reside PM - try - { - DBRootConfigList dbrootlist; - oam.addDbroot(dbrootNumber, dbrootlist); + int dbrootNumber = atoi(arguments[1].c_str()); - cout << endl << " New DBRoot IDs added = "; - - DBRootConfigList::iterator pt = dbrootlist.begin(); - for( ; pt != dbrootlist.end() ;) - { - cout << oam.itoa(*pt); - pt++; - if (pt != dbrootlist.end()) - cout << ", "; - } + string EBSsize = oam::UnassignedName; + if (amazon) + { + if ( arguments[2] != "") + EBSsize = arguments[2]; + else + { cout << endl; - } - catch (exception& e) - { - cout << endl << "**** addDbroot Failed: " << e.what() << endl; - break; - } + oam.getSystemConfig("PMVolumeSize", EBSsize); + string prompt = "Enter EBS storage size in GB: (" + EBSsize + "): "; + EBSsize = dataPrompt(prompt); + } + } + + //get dbroots ids for reside PM + try + { + DBRootConfigList dbrootlist; + oam.addDbroot(dbrootNumber, dbrootlist, EBSsize); + + cout << endl << " New DBRoot IDs added = "; + + DBRootConfigList::iterator pt = dbrootlist.begin(); + for( ; pt != dbrootlist.end() ;) + { + cout << oam.itoa(*pt); + pt++; + if (pt != dbrootlist.end()) + cout << ", "; + } cout << endl; + } + catch (exception& e) + { + cout << endl << "**** addDbroot Failed: " << e.what() << endl; + break; + } + + cout << endl; } break;