diff --git a/oam/cloud/IDBInstanceCmds.sh b/oam/cloud/IDBInstanceCmds.sh index 31de657c4..2567c4695 100644 --- a/oam/cloud/IDBInstanceCmds.sh +++ b/oam/cloud/IDBInstanceCmds.sh @@ -109,9 +109,11 @@ export PATH=$path export EC2_HOME=$ec2 export JAVA_HOME=$java -# get x509 Certification and Private Key and region -x509Cert=`$prefix/Calpont/bin/getConfig Installation AmazonX509Certificate` -x509PriKey=`$prefix/Calpont/bin/getConfig Installation AmazonX509PrivateKey` +# get Keys and region +AmazonAccessKey=`$prefix/Calpont/bin/getConfig Installation AmazonAccessKey` +AmazonSecretKey=`$prefix/Calpont/bin/getConfig Installation AmazonSecretKey` +AmazonAccessKey=`cat $AmazonAccessKeyFile` +AmazonSecretKey=`cat $AmazonSecretKeyFile` Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion` subnet=`$prefix/Calpont/bin/getConfig Installation AmazonSubNetID` @@ -132,7 +134,7 @@ describeInstanceFile="/tmp/describeInstance.txt" touch $describeInstanceFile describeInstance() { - ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region > $describeInstanceFile 2>&1 + ec2-describe-instances -O $AmazonAccessKey -W $xAmazonSecretKey --region $Region > $describeInstanceFile 2>&1 } getInstance() { @@ -145,8 +147,6 @@ getInstance() { localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'` #get local Instance ID -# instance=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` if [ "$instance" == "" ]; then describeInstance @@ -167,8 +167,6 @@ getInstancePrivate() { localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'` #get local Instance ID -# instance=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` if [ "$instance" == "" ]; then describeInstance @@ -188,8 +186,6 @@ getZone() { getInstancePrivate >/dev/null 2>&1 #get zone if [ "$subnet" == "unassigned" ]; then -# zone=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` if [ "$zone" == "" ]; then describeInstance @@ -197,8 +193,6 @@ getZone() { zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` else -# zone=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'` - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'` if [ "$zone" == "" ]; then describeInstance @@ -214,8 +208,6 @@ getZone() { getPrivateIP() { #get instance info -# ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region $instanceName > /tmp/instanceInfo_$instanceName 2>&1 - grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 if [ `cat /tmp/instanceInfo_$instanceName | wc -c` -eq 0 ]; then describeInstance @@ -265,8 +257,6 @@ getType() { getInstancePrivate >/dev/null 2>&1 #get Type if [ "$subnet" == "unassigned" ]; then -# instanceType=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` if [ "$instanceType" == "" ]; then describeInstance @@ -274,8 +264,6 @@ getType() { instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` else -# instanceType=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $8}'` - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $8}'` if [ "$instanceType" == "" ]; then describeInstance @@ -293,8 +281,6 @@ getKey() { getInstancePrivate >/dev/null 2>&1 #get Key if [ "$subnet" == "unassigned" ]; then -# key=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` if [ "$key" == "" ]; then describeInstance @@ -302,8 +288,6 @@ getKey() { key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` else -# key=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'` if [ "$key" == "" ]; then describeInstance @@ -320,8 +304,6 @@ getAMI() { #get local Instance ID getInstancePrivate >/dev/null 2>&1 #get AMI -# ami=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` if [ "$ami" == "" ]; then describeInstance @@ -337,8 +319,6 @@ getGroup() { getInstancePrivate >/dev/null 2>&1 #get group if [ "$subnet" == "unassigned" ]; then -# group=`ec2-describe-instances -C $x509Cert -K $x509PriKey $instance --region $Region | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` if [ "$group" == "" ]; then describeInstance @@ -348,8 +328,6 @@ getGroup() { group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` fi else -# group=`ec2-describe-instances -C $x509Cert -K $x509PriKey $instance --region $Region | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` if [ "$group" == "" ]; then describeInstance @@ -366,8 +344,6 @@ getProfile() { getInstancePrivate >/dev/null 2>&1 #get Type if [ "$subnet" == "unassigned" ]; then -# instanceProfile=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` if [ "$instanceProfile" == "" ]; then describeInstance @@ -375,8 +351,6 @@ getProfile() { instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` else -# instanceProfile=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` if [ "$instanceProfile" == "" ]; then describeInstance diff --git a/oam/cloud/IDBVolumeCmds.sh b/oam/cloud/IDBVolumeCmds.sh index 1ebd787e9..297c28e35 100644 --- a/oam/cloud/IDBVolumeCmds.sh +++ b/oam/cloud/IDBVolumeCmds.sh @@ -102,9 +102,12 @@ export PATH=$path export EC2_HOME=$ec2 export JAVA_HOME=$java -# get x509 Certification and Private Key -x509Cert=`$prefix/Calpont/bin/getConfig Installation AmazonX509Certificate` -x509PriKey=`$prefix/Calpont/bin/getConfig Installation AmazonX509PrivateKey` +# get Keys +AmazonAccessKeyFile=`$prefix/Calpont/bin/getConfig Installation AmazonAccessKey` +AmazonSecretKeyFile=`$prefix/Calpont/bin/getConfig Installation AmazonSecretKey` +AmazonAccessKey=`cat $AmazonAccessKeyFile` +AmazonSecretKey=`cat $AmazonSecretKeyFile` + Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion` if test ! -f $x509Cert ; then @@ -171,7 +174,7 @@ createvolume() { # get zone zone=`$prefix/Calpont/bin/IDBInstanceCmds.sh getZone` #create volume - volume=`ec2-create-volume -C $x509Cert -K $x509PriKey --region $Region -z $zone -s $volumeSize | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` + volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` # #get volume name # volume=`cat /tmp/volumeCreate_$resourceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` @@ -181,7 +184,7 @@ createvolume() { describevolume() { #describe volume - ec2-describe-volumes -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-describe-volumes -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus echo $STATUS @@ -190,7 +193,7 @@ describevolume() { detachvolume() { #detach volume - ec2-detach-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "detaching" ]; then @@ -227,7 +230,7 @@ detachvolume() { attachvolume() { #detach volume - ec2-attach-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 + ec2-attach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then @@ -261,13 +264,13 @@ attachvolume() { deletevolume() { #delete volume - ec2-delete-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 + ec2-delete-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 return } createTag() { #create tag - ec2-create-tags -C $x509Cert -K $x509PriKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 + ec2-create-tags -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 return } diff --git a/oam/etc/Calpont.xml b/oam/etc/Calpont.xml index 15e4935ab..a94df4262 100755 --- a/oam/etc/Calpont.xml +++ b/oam/etc/Calpont.xml @@ -443,8 +443,8 @@ unassigned unassigned unassigned - unassigned - unassigned + unassigned + unassigned us-east-1 unassigned unassigned diff --git a/oam/etc/Calpont.xml.singleserver b/oam/etc/Calpont.xml.singleserver index 89bab523f..d716e6143 100644 --- a/oam/etc/Calpont.xml.singleserver +++ b/oam/etc/Calpont.xml.singleserver @@ -439,8 +439,8 @@ unassigned rpm y - unassigned - unassigned + unassigned + unassigned us-east-1 unassigned unassigned diff --git a/oam/etc/ConsoleCmds.xml b/oam/etc/ConsoleCmds.xml index 3e6829f86..f1d1d5bc6 100644 --- a/oam/etc/ConsoleCmds.xml +++ b/oam/etc/ConsoleCmds.xml @@ -256,30 +256,16 @@ Optional: Module-name and Parameter-name will display the Module Name Configuration parameter - addExternalDevice - Add External Device to Configuration file - External Devices will be monitored and alarms reported on failures - Required: External Device name - Required: External Device IP Address + AVAILABLE - getExternalDeviceConfig - Get External Device Configuration Information - Can display all External Device parameters or a single External Device - No Argument or 'all' will display all External Devices Configuration parameters - Optional: External Device name will display the Switch Name Configuration parameters + AVAILABLE - setExternalDeviceConfig - Set a External Device Configuration parameter - Required: External-device-name is the parameter to be updated - Required: Parameter-name is the parameter to be updated - Required: Parameter-value is the parameter value + AVAILABLE - removeExternalDevice - Remove External Device to Configuration file - Required: External Device name + AVAILABLE assignElasticIPAddress diff --git a/oam/install_scripts/master-rep-infinidb.sh b/oam/install_scripts/master-rep-infinidb.sh index f13466613..5c32b4e3d 100644 --- a/oam/install_scripts/master-rep-infinidb.sh +++ b/oam/install_scripts/master-rep-infinidb.sh @@ -49,7 +49,6 @@ echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-s cat >/tmp/idb_master-rep.sql <>/tmp/master-rep-status-$hostipaddr.log @@ -66,7 +65,7 @@ checkForError echo "Grant table access for $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log cat >/tmp/idb_master-rep.sql <getConfig(InstallSection, "AmazonX509Certificate"); - x509PriKey = sysConfig->getConfig(InstallSection, "AmazonX509PrivateKey"); + AmazonAccessKey = sysConfig->getConfig(InstallSection, "AmazonAccessKey"); + AmazonSecretKey = sysConfig->getConfig(InstallSection, "AmazonSecretKey"); } catch(...) {} @@ -1016,13 +1016,13 @@ int main(int argc, char *argv[]) while(true) { - prompt = "Enter Name and directory of the X.509 Certificate (" + x509Cert + ") > "; + prompt = "Enter file name containing the Access Key (" + AmazonAccessKey + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) x509Cert = pcommand; + if (strlen(pcommand) > 0) AmazonAccessKey = pcommand; callFree(pcommand); } - ifstream File (x509Cert.c_str()); + ifstream File (AmazonAccessKey.c_str()); if (!File) { cout << "Error: file not found, please re-enter" << endl; if ( noPrompting ) @@ -1034,13 +1034,13 @@ int main(int argc, char *argv[]) while(true) { - prompt = "Enter Name and directory of the X.509 Private Key (" + x509PriKey + ") > "; + prompt = "Enter file name containing the Secret Key (" + AmazonSecretKey + ") > "; pcommand = callReadline(prompt.c_str()); if (pcommand) { - if (strlen(pcommand) > 0) x509PriKey = pcommand; + if (strlen(pcommand) > 0) AmazonSecretKey = pcommand; callFree(pcommand); } - ifstream File (x509PriKey.c_str()); + ifstream File (AmazonSecretKey.c_str()); if (!File) { cout << "Error: file not found, please re-enter" << endl; @@ -1052,15 +1052,40 @@ int main(int argc, char *argv[]) } try { - sysConfig->setConfig(InstallSection, "AmazonX509Certificate", x509Cert); - sysConfig->setConfig(InstallSection, "AmazonX509PrivateKey", x509PriKey); + sysConfig->setConfig(InstallSection, "AmazonAccessKey", AmazonAccessKey); + sysConfig->setConfig(InstallSection, "AmazonSecretKey", AmazonSecretKey); } catch(...) {} - if( !copyX509files() ) - cout << "copyX509files error" << endl; + if( !copyKeyfiles() ) + cout << "copyKeyfiles error" << endl; + + try { + AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion"); + } + catch(...) + {} + cout << endl; + + while(true) + { + prompt = "Enter Amazon Region you are running in (" + AmazonRegion + ") > "; + pcommand = callReadline(prompt.c_str()); + if (pcommand) { + if (strlen(pcommand) > 0) AmazonRegion = pcommand; + callFree(pcommand); + } + break; + } + + try { + sysConfig->setConfig(InstallSection, "AmazonRegion", AmazonRegion); + } + catch(...) + {} + break; } } @@ -2552,239 +2577,6 @@ int main(int argc, char *argv[]) //check snmp Apps disable option snmpAppCheck(); - // - // Configure External Devices - // - SystemExtDeviceConfig systemextdeviceconfig; - - try{ - oam.getSystemConfig(systemextdeviceconfig); - } - catch(...) - { - cout << "ERROR: Problem reading the InfiniDB System Configuration file" << endl; - exit(1); - } - - cout << endl << "===== Setup the External Device Configuration =====" << endl << endl; - - cout << "External Devices are devices like a storage array or a Ethernet Switch that can" << endl; - cout << "be setup to be monitored by InfiniDB with a ping test. If device fails, InfiniDB" << endl; - cout << "will report a failure alarm." << endl << endl; - - if ( systemextdeviceconfig.Count > 0 ) { - - cout << "Current List of External Devices being monitored" << endl << endl; - - cout << "Device Name IP Address" << endl; - cout << "-------------------------- ----------------" << endl; - - for ( unsigned int i = 0 ; i < systemextdeviceconfig.Count ; i++ ) - { - cout.setf(ios::left); - cout.width(30); - cout << systemextdeviceconfig.extdeviceconfig[i].Name; - cout << systemextdeviceconfig.extdeviceconfig[i].IPAddr << endl; -// cout << "Device Name: " << (*pt1).Name << " IP Address: " << (*pt1).IPAddr << endl; - } - - cout << endl; - - string modify = "n"; - while(true) { - prompt = "Would you like to modify current list? [y,n] (n) > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) modify = pcommand; - callFree(pcommand); - } - if ( modify == "y" || modify == "n" ) - break; - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } - - if ( modify == "y" ) { - - for ( unsigned int i = 0 ; i < systemextdeviceconfig.Count ; i++ ) - { - string name = systemextdeviceconfig.extdeviceconfig[i].Name; - modify = "n"; - while(true) { - prompt = "Would you like to modify or delete '" + name + "'? [m,d,n] (n) > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) modify = pcommand; - callFree(pcommand); - } - if ( modify == "m" || modify == "d" || modify == "n") - break; - cout << "Invalid Entry, please enter 'm' for modify, 'd' for delete or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } - - if ( modify == "d" ) { - // delete device - ExtDeviceConfig extdeviceconfig; - - extdeviceconfig.Name = oam::UnassignedName; - extdeviceconfig.IPAddr = oam::UnassignedIpAddr; - extdeviceconfig.DisableState = oam::ENABLEDSTATE; - - try{ - oam.setSystemConfig(name, extdeviceconfig); - } - catch(...) - { - cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl; - exit(1); - } - cout << "External Device '" + name + "' deleted" << endl << endl; - } - else - { - if ( modify == "m" ) { - string newName = name; - prompt = "Enter Name (" + newName + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) newName = pcommand; - callFree(pcommand); - } - - string newIPAddr = systemextdeviceconfig.extdeviceconfig[i].IPAddr; - while (true) - { - prompt = "Enter IP Address of (" + newIPAddr + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) newIPAddr = pcommand; - callFree(pcommand); - } - - if (oam.isValidIP(newIPAddr)) - break; - else - { - cout << "Invalid IP Address format, xxx.xxx.xxx.xxx, please re-enter" << endl; - if ( noPrompting ) - exit(1); - } - } - - ExtDeviceConfig extdeviceconfig; - - extdeviceconfig.Name = newName; - extdeviceconfig.IPAddr = newIPAddr; - extdeviceconfig.DisableState = oam::ENABLEDSTATE; - - try{ - oam.setSystemConfig(name, extdeviceconfig); - } - catch(...) - { - cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl; - exit(1); - } - cout << "External Device '" + name + "' modified" << endl << endl; - } - } - } - } - } - - while(true) { - string add = "n"; - while(true) { - prompt = "Would you like to add an External Device? [y,n] (n) > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) add = pcommand; - callFree(pcommand); - } - if ( add == "y" || add == "n" ) - break; - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); - } - - if ( add == "y" ) { - cout << endl; - string newName = oam::UnassignedName; - while(true) { - prompt = "Enter Name (" + newName + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) newName = pcommand; - callFree(pcommand); - } - - if ( newName == oam::UnassignedName ) { - cout << "Invalid Entry, please enter valid name or 'abort'" << endl; - if ( noPrompting ) - exit(1); - } - else - break; - } - - if ( newName == "abort" ) - continue; - - //get Network IP Address - string newIPAddr = oam::UnassignedIpAddr; - string IPAddress = oam.getIPAddress(newName); - if ( !IPAddress.empty() ) - newIPAddr = IPAddress; - - while (true) - { - prompt = "Enter IP Address of (" + newIPAddr + ") > "; - pcommand = callReadline(prompt.c_str()); - if (pcommand) - { - if (strlen(pcommand) > 0) newIPAddr = pcommand; - callFree(pcommand); - } - - if (oam.isValidIP(newIPAddr)) - break; - else - cout << "Invalid IP Address format, xxx.xxx.xxx.xxx, please re-enter" << endl; - if ( noPrompting ) - exit(1); - newIPAddr = oam::UnassignedIpAddr; - } - - ExtDeviceConfig extdeviceconfig; - - extdeviceconfig.Name = newName; - extdeviceconfig.IPAddr = newIPAddr; - extdeviceconfig.DisableState = oam::ENABLEDSTATE; - - try{ - oam.setSystemConfig(newName, extdeviceconfig); - } - catch(...) - { - cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl; - exit(1); - } - cout << endl; - } - else - break; - } - //setup local OS Files if( !setOSFiles(parentOAMModuleName, IserverTypeInstall) ) { cout << "setOSFiles error" << endl; @@ -5031,12 +4823,12 @@ bool copyFstab(string moduleName) /* * Copy x.509 file */ -bool copyX509files() +bool copyKeyfiles() { - string cmd = "/bin/cp -f " + x509Cert + " " + installDir + "/local/etc/. > /dev/null 2>&1"; + string cmd = "/bin/cp -f " + AmazonAccessKey + " " + installDir + "/local/etc/. > /dev/null 2>&1"; system(cmd.c_str()); - cmd = "/bin/cp -f " + x509PriKey + " " + installDir + "/local/etc/. > /dev/null 2>&1"; + cmd = "/bin/cp -f " + AmazonSecretKey + " " + installDir + "/local/etc/. > /dev/null 2>&1"; system(cmd.c_str()); return true; diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 01129206b..66bc8d247 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -10069,7 +10069,20 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist if ( moduleType == "pm" && PMwithUM == "n" ) continue; } - + + //check status, skip if module is offline + int opState = oam::ACTIVE; + bool degraded; + try { + oam.getModuleStatus(remoteModuleName, opState, degraded); + } + catch(...) + { + } + + if (opState != oam::ACTIVE) + continue; + ByteStream msg1; ByteStream::byte requestID = oam::SLAVEREP; if ( !enable ) { diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 2553030f4..7e86bf03e 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -843,6 +843,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO //stop the mysql daemon try { oam.actionMysqlCalpont(MYSQL_STOP); + log.writeLog(__LINE__, "Stop MySQL Process", LOG_TYPE_DEBUG); } catch(...) {}