From 319cea322b972f168883fa6e15476460b5dc90c7 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 4 May 2016 17:55:24 -0500 Subject: [PATCH] add in storage type --- oam/etc/Calpont.xml | 4 + oamapps/postConfigure/postConfigure.cpp | 250 ++++++++++++++++++++++-- tools/configMgt/autoConfigure.cpp | 15 ++ 3 files changed, 256 insertions(+), 13 deletions(-) diff --git a/oam/etc/Calpont.xml b/oam/etc/Calpont.xml index b9b1ce0e2..04796929e 100755 --- a/oam/etc/Calpont.xml +++ b/oam/etc/Calpont.xml @@ -453,8 +453,12 @@ unassigned unassigned unassigned + standard + unassigned unassigned unassigned + standard + unassigned y y 0 diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 6a1ff71de..8d728406f 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -139,6 +139,11 @@ string UMStorageType; string PMVolumeSize = oam::UnassignedName; string UMVolumeSize = oam::UnassignedName; +string UMVolumeType = "standard"; +string PMVolumeType = "standard"; +string PMVolumeIOPS = oam::UnassignedName; +string UMVolumeIOPS = oam::UnassignedName; + int DBRootCount; string deviceName; @@ -4325,6 +4330,46 @@ bool storageSetup(bool amazonInstall) { UMStorageType = "external"; + cout << endl; + try { + oam.getSystemConfig("UMVolumeType", UMVolumeType); + } + catch(...) + {} + + if ( UMVolumeType.empty() || UMVolumeType == "") + UMVolumeType = "standard"; + + while(true) + { + string prompt = "Enter EBS Volume Type (standard, gp2, io1) : (" + UMVolumeType + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) UMVolumeType = pcommand; + callFree(pcommand); + } + + if ( UMVolumeType == "standard" || UMVolumeType == "gp2" || UMVolumeType == "io1" ) + break; + else + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + } + + //set UMVolumeType + try { + sysConfig->setConfig(InstallSection, "UMVolumeType", UMVolumeType); + } + catch(...) + { + cout << "ERROR: Problem setting UMVolumeType in the InfiniDB System Configuration file" << endl; + return false; + } + cout << endl; try { oam.getSystemConfig("UMVolumeSize", UMVolumeSize); @@ -4335,15 +4380,33 @@ bool storageSetup(bool amazonInstall) if ( UMVolumeSize.empty() || UMVolumeSize == "") UMVolumeSize = oam::UnassignedName; - string prompt = "Enter EBS Volume storage size in GB: (" + UMVolumeSize + ") > "; - pcommand = callReadline(prompt); - if (pcommand) + string minSize = "1"; + string maxSize = "16384"; + + if (UMVolumeType == "io1") + minSize = "4"; + + while(true) { - if (strlen(pcommand) > 0) UMVolumeSize = pcommand; - callFree(pcommand); + string prompt = "Enter EBS Volume storage size in GB: [" + minSize + "," + maxSize + "] (" + UMVolumeSize + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) UMVolumeSize = pcommand; + callFree(pcommand); + } + + if ( atoi(UMVolumeSize.c_str()) < atoi(minSize.c_str()) || atoi(UMVolumeSize.c_str()) > atoi(maxSize.c_str()) ) + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + else + break; } - //set DBRootStorageType + //set UMVolumeSize try { sysConfig->setConfig(InstallSection, "UMVolumeSize", UMVolumeSize); } @@ -4352,9 +4415,55 @@ bool storageSetup(bool amazonInstall) cout << "ERROR: Problem setting UMVolumeSize in the InfiniDB System Configuration file" << endl; return false; } - } + if ( UMVolumeType == "io1" ) + { + string minIOPS = UMVolumeSize; + string maxIOPS = oam.itoa(atoi(UMVolumeSize.c_str()) * 30); + + cout << endl; + try { + oam.getSystemConfig("UMVolumeIOPS", UMVolumeIOPS); + } + catch(...) + {} + + if ( UMVolumeIOPS.empty() || UMVolumeIOPS == "") + UMVolumeIOPS = maxIOPS; + + while(true) + { + string prompt = "Enter EBS Volume IOPS: [" + minIOPS + "," + maxIOPS + "] (" + UMVolumeIOPS + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) UMVolumeSize = pcommand; + callFree(pcommand); + } + + if ( atoi(UMVolumeSize.c_str()) < atoi(minIOPS.c_str()) || atoi(UMVolumeSize.c_str()) > atoi(maxIOPS.c_str()) ) + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + else + break; + } + + //set UMVolumeIOPS + try { + sysConfig->setConfig(InstallSection, "UMVolumeIOPS", UMVolumeIOPS); + } + catch(...) + { + cout << "ERROR: Problem setting UMVolumeIOPS in the InfiniDB System Configuration file" << endl; + return false; + } + } + } + try { sysConfig->setConfig(InstallSection, "UMStorageType", UMStorageType); } @@ -4554,6 +4663,46 @@ bool storageSetup(bool amazonInstall) // if external and amazon, prompt for storage size if ( storageType == "2" && amazonInstall) { + cout << endl; + try { + oam.getSystemConfig("PMVolumeType", PMVolumeType); + } + catch(...) + {} + + if ( PMVolumeType.empty() || PMVolumeType == "") + PMVolumeType = "standard"; + + while(true) + { + string prompt = "Enter EBS Volume Type (standard, gp2, io1) : (" + PMVolumeType + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) PMVolumeType = pcommand; + callFree(pcommand); + } + + if ( PMVolumeType == "standard" || PMVolumeType == "gp2" || PMVolumeType == "io1" ) + break; + else + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + } + + //set PMVolumeType + try { + sysConfig->setConfig(InstallSection, "PMVolumeType", PMVolumeType); + } + catch(...) + { + cout << "ERROR: Problem setting PMVolumeType in the InfiniDB System Configuration file" << endl; + return false; + } + cout << endl; try { oam.getSystemConfig("PMVolumeSize", PMVolumeSize); @@ -4561,15 +4710,90 @@ bool storageSetup(bool amazonInstall) catch(...) {} - if ( PMVolumeSize.empty() || PMVolumeSize == "" ) + if ( PMVolumeSize.empty() || PMVolumeSize == "") PMVolumeSize = oam::UnassignedName; - string prompt = "Enter EBS Volume storage size in GB: (" + PMVolumeSize + ") > "; - pcommand = callReadline(prompt); - if (pcommand) + string minSize = "1"; + string maxSize = "16384"; + + if (PMVolumeType == "io1") + minSize = "4"; + + while(true) { - if (strlen(pcommand) > 0) PMVolumeSize = pcommand; - callFree(pcommand); + string prompt = "Enter EBS Volume storage size in GB: [" + minSize + "," + maxSize + "] (" + PMVolumeSize + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) PMVolumeSize = pcommand; + callFree(pcommand); + } + + if ( atoi(PMVolumeSize.c_str()) < atoi(minSize.c_str()) || atoi(PMVolumeSize.c_str()) > atoi(maxSize.c_str()) ) + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + else + break; + } + + //set PMVolumeSize + try { + sysConfig->setConfig(InstallSection, "PMVolumeSize", PMVolumeSize); + } + catch(...) + { + cout << "ERROR: Problem setting PMVolumeSize in the InfiniDB System Configuration file" << endl; + return false; + } + + + if ( PMVolumeType == "io1" ) + { + string minIOPS = PMVolumeSize; + string maxIOPS = oam.itoa(atoi(PMVolumeSize.c_str()) * 30); + + cout << endl; + try { + oam.getSystemConfig("PMVolumeIOPS", PMVolumeIOPS); + } + catch(...) + {} + + if ( PMVolumeIOPS.empty() || PMVolumeIOPS == "") + PMVolumeIOPS = maxIOPS; + + while(true) + { + string prompt = "Enter EBS Volume IOPS: [" + minIOPS + "," + maxIOPS + "] (" + PMVolumeIOPS + ") > "; + pcommand = callReadline(prompt); + if (pcommand) + { + if (strlen(pcommand) > 0) PMVolumeSize = pcommand; + callFree(pcommand); + } + + if ( atoi(PMVolumeSize.c_str()) < atoi(minIOPS.c_str()) || atoi(PMVolumeSize.c_str()) > atoi(maxIOPS.c_str()) ) + { + cout << endl << "Invalid Entry, please re-enter" << endl << endl; + if ( noPrompting ) + exit(1); + } + else + break; + } + + //set PMVolumeIOPS + try { + sysConfig->setConfig(InstallSection, "PMVolumeIOPS", PMVolumeIOPS); + } + catch(...) + { + cout << "ERROR: Problem setting PMVolumeIOPS in the InfiniDB System Configuration file" << endl; + return false; + } } //set DBRootStorageType diff --git a/tools/configMgt/autoConfigure.cpp b/tools/configMgt/autoConfigure.cpp index fed75c37b..164587dc3 100644 --- a/tools/configMgt/autoConfigure.cpp +++ b/tools/configMgt/autoConfigure.cpp @@ -1303,6 +1303,12 @@ int main(int argc, char *argv[]) string AmazonZone; string AmazonVPCNextPrivateIP; string AmazonDeviceName; + string UMVolumeType; + string UMVolumeIOPS; + string PMVolumeType; + string PMVolumeIOPS; + + try { cloud = sysConfigOld->getConfig(InstallSection, "Cloud"); x509Cert = sysConfigOld->getConfig(InstallSection, "AmazonX509Certificate"); @@ -1320,6 +1326,10 @@ int main(int argc, char *argv[]) AmazonVPCNextPrivateIP = sysConfigOld->getConfig(InstallSection, "AmazonVPCNextPrivateIP"); AmazonSubNetID = sysConfigOld->getConfig(InstallSection, "AmazonSubNetID"); AmazonDeviceName = sysConfigOld->getConfig(InstallSection, "AmazonDeviceName"); + UMVolumeType = sysConfigOld->getConfig(InstallSection, "UMVolumeType"); + UMVolumeIOPS = sysConfigOld->getConfig(InstallSection, "UMVolumeIOPS"); + PMVolumeType = sysConfigOld->getConfig(InstallSection, "PMVolumeType"); + PMVolumeIOPS = sysConfigOld->getConfig(InstallSection, "PMVolumeIOPS"); } catch(...) { } @@ -1382,6 +1392,11 @@ int main(int argc, char *argv[]) sysConfigNew->setConfig(InstallSection, "AmazonRegion", AmazonRegion); sysConfigNew->setConfig(InstallSection, "AmazonZone", AmazonZone); sysConfigNew->setConfig(InstallSection, "AmazonDeviceName", AmazonDeviceName); + + sysConfigNew->setConfig(InstallSection, "UMVolumeType", UMVolumeType); + sysConfigNew->setConfig(InstallSection, "UMVolumeIOPS", UMVolumeIOPS); + sysConfigNew->setConfig(InstallSection, "PMVolumeType", PMVolumeType); + sysConfigNew->setConfig(InstallSection, "PMVolumeIOPS", PMVolumeIOPS); } catch(...) {