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 [ "$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"

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;
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;

View File

@@ -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

View File

@@ -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;