1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

change adddbroot for amazon

This commit is contained in:
david hill
2016-04-13 15:27:10 -05:00
parent aa86382a3c
commit fdcd05f8e4
4 changed files with 86 additions and 53 deletions

View File

@@ -14,7 +14,7 @@ fi
if [ "$1" = "create" ]; then if [ "$1" = "create" ]; then
if [ "$2" = "" ]; 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 exit 1
fi fi
volumeSize="$2" volumeSize="$2"

View File

@@ -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; int SystemDBRootCount = 0;
string cloud; string cloud;
string DBRootStorageType; string DBRootStorageType;
string volumeSize; string volumeSize;
Config* sysConfig = Config::makeConfig(CalpontConfigFile.c_str()); Config* sysConfig = Config::makeConfig(CalpontConfigFile.c_str());
string Section = "SystemConfig"; string Section = "SystemConfig";
try { try {
getSystemConfig("DBRootCount", SystemDBRootCount); getSystemConfig("DBRootCount", SystemDBRootCount);
@@ -5957,6 +5957,20 @@ namespace oam
if ( (cloud == "amazon-ec2" || cloud == "amazon-vpc") && if ( (cloud == "amazon-ec2" || cloud == "amazon-vpc") &&
DBRootStorageType == "external" ) 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 ) if ( newSystemDBRootCount > MAX_DBROOT_AMAZON )
{ {
cout << "ERROR: Failed add, total Number of DBRoots would be over maximum of " << MAX_DBROOT_AMAZON << endl; cout << "ERROR: Failed add, total Number of DBRoots would be over maximum of " << MAX_DBROOT_AMAZON << endl;

View File

@@ -2244,7 +2244,7 @@ namespace oam
/** /**
*@brief add DBRoot *@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 *@brief distribute Fstab Updates

View File

@@ -1666,65 +1666,84 @@ int processCommand(string* arguments)
case 14: // addDbroot parameters: dbroot-number case 14: // addDbroot parameters: dbroot-number
{ {
string GlusterConfig = "n"; string GlusterConfig = "n";
try { try {
oam.getSystemConfig( "GlusterConfig", GlusterConfig); oam.getSystemConfig( "GlusterConfig", GlusterConfig);
} }
catch(...) catch(...)
{} {}
if (GlusterConfig == "y") { if (GlusterConfig == "y") {
cout << endl << "**** addDbroot Not Supported on Data Redundancy Configured System, use addModule command to expand your capacity" << endl; cout << endl << "**** addDbroot Not Supported on Data Redundancy Configured System, use addModule command to expand your capacity" << endl;
break; break;
} }
if ( localModule != parentOAMModule ) { if ( localModule != parentOAMModule ) {
// exit out since not on active module // exit out since not on active module
cout << endl << "**** addDbroot Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl; cout << endl << "**** addDbroot Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl;
break; break;
} }
if (arguments[1] == "") string cloud;
{ bool amazon = false;
// need atleast 1 arguments try {
cout << endl << "**** addDbroot Failed : Missing a required Parameter, enter 'help' for additional information" << endl; oam.getSystemConfig("Cloud", cloud);
break; }
} catch(...) {}
if (arguments[2] != "") string::size_type pos = cloud.find("amazon",0);
{ if (pos != string::npos)
// error out if extra arguments exist to catch if they meant to use assigndbrootpmconfig amazon = true;
cout << endl << "**** addDbroot Failed : Extra Parameter passed, enter 'help' for additional information" << endl;
break;
}
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 int dbrootNumber = atoi(arguments[1].c_str());
try
{
DBRootConfigList dbrootlist;
oam.addDbroot(dbrootNumber, dbrootlist);
cout << endl << " New DBRoot IDs added = "; string EBSsize = oam::UnassignedName;
if (amazon)
DBRootConfigList::iterator pt = dbrootlist.begin(); {
for( ; pt != dbrootlist.end() ;) if ( arguments[2] != "")
{ EBSsize = arguments[2];
cout << oam.itoa(*pt); else
pt++; {
if (pt != dbrootlist.end())
cout << ", ";
}
cout << endl; cout << endl;
} oam.getSystemConfig("PMVolumeSize", EBSsize);
catch (exception& e)
{
cout << endl << "**** addDbroot Failed: " << e.what() << endl;
break;
}
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; cout << endl;
}
catch (exception& e)
{
cout << endl << "**** addDbroot Failed: " << e.what() << endl;
break;
}
cout << endl;
} }
break; break;