1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

change to run in HVM instance

This commit is contained in:
david hill
2016-04-26 16:40:44 -05:00
parent 81a99756eb
commit fd7933c61a
5 changed files with 76 additions and 12 deletions

View File

@ -8,7 +8,7 @@ prefix=/usr/local
#check command #check command
if [ "$1" = "" ]; then if [ "$1" = "" ]; then
echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup} echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet}
}" }"
exit 1 exit 1
fi fi
@ -479,6 +479,21 @@ deassignElasticIP() {
exit 0 exit 0
} }
getSubnet() {
#get local Instance ID
getInstancePrivate >/dev/null 2>&1
#get Subnet
subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'`
if [ "$subnet" == "" ]; then
describeInstance
fi
subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'`
echo $subnet
return
}
case "$1" in case "$1" in
getInstance) getInstance)
getInstance getInstance
@ -525,8 +540,11 @@ case "$1" in
getGroup) getGroup)
getGroup getGroup
;; ;;
getSubnet)
getSubnet
;;
*) *)
echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup}" echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet}"
exit 1 exit 1
esac esac

View File

@ -7631,6 +7631,38 @@ namespace oam
} }
/***************************************************************************
*
* Function: getEC2LocalInstanceSubnet
*
* Purpose: Get Amazon EC2 local Instance Subnet
*
****************************************************************************/
std::string Oam::getEC2LocalInstanceSubnet(std::string name)
{
// run script to get Instance Subnet
string cmd = InstallDir + "/bin/IDBInstanceCmds.sh Subnet > /tmp/getInstanceSubnet_" + name;
int status = system(cmd.c_str());
if (WEXITSTATUS(status) != 0 )
return "failed";
// get Instance Name
string instanceSubnet;
string file = "/tmp/getInstanceSubnet_" + name;
ifstream oldFile (file.c_str());
char line[400];
while (oldFile.getline(line, 400))
{
instanceSubnet = line;
}
oldFile.close();
return instanceSubnet;
}
/*************************************************************************** /***************************************************************************
* *
* Function: launchEC2Instance * Function: launchEC2Instance

View File

@ -2325,6 +2325,10 @@ namespace oam
*/ */
EXPORT std::string getEC2LocalInstanceType(std::string name = "dummy"); EXPORT std::string getEC2LocalInstanceType(std::string name = "dummy");
/** @brief getEC2LocalInstanceSubnet
*/
EXPORT std::string getEC2LocalInstanceSubnet(std::string name = "dummy");
/** @brief launchEC2Instance /** @brief launchEC2Instance
*/ */
EXPORT std::string launchEC2Instance(const std::string name = "dummy", const std::string IPAddress = oam::UnassignedName, const std::string type = oam::UnassignedName, const std::string group = oam::UnassignedName); EXPORT std::string launchEC2Instance(const std::string name = "dummy", const std::string IPAddress = oam::UnassignedName, const std::string type = oam::UnassignedName, const std::string group = oam::UnassignedName);

View File

@ -4883,11 +4883,11 @@ int processCommand(string* arguments)
string GlusterStorageType; string GlusterStorageType;
string AmazonVPCNextPrivateIP; string AmazonVPCNextPrivateIP;
try { try {
oam.getSystemConfig("Cloud", cloud);
oam.getSystemConfig("AmazonVPCNextPrivateIP", AmazonVPCNextPrivateIP);
oam.getSystemConfig("GlusterConfig", GlusterConfig); oam.getSystemConfig("GlusterConfig", GlusterConfig);
oam.getSystemConfig("GlusterCopies", GlusterCopies); oam.getSystemConfig("GlusterCopies", GlusterCopies);
oam.getSystemConfig("Cloud", cloud);
oam.getSystemConfig("GlusterStorageType", GlusterStorageType); oam.getSystemConfig("GlusterStorageType", GlusterStorageType);
oam.getSystemConfig("AmazonVPCNextPrivateIP", AmazonVPCNextPrivateIP);
} }
catch(...) {} catch(...) {}

View File

@ -668,7 +668,14 @@ int main(int argc, char *argv[])
} }
catch(...) catch(...)
{} {}
}
if ( amazonSubNet == oam::UnassignedName || amazonSubNet == "" )
{
amazonSubNet = oam.getEC2LocalInstanceSubnet();
if ( amazonSubNet == "failed" || amazonSubNet == "" )
amazonSubNet == oam::UnassignedName;
}
}
} }
} }
@ -964,13 +971,16 @@ int main(int argc, char *argv[])
amazonVPC = true; amazonVPC = true;
cloud = "amazon-vpc"; cloud = "amazon-vpc";
prompt = "Enter VPC SubNet ID (" + amazonSubNet + ") > "; if ( amazonSubNet == oam::UnassignedName )
pcommand = callReadline(prompt.c_str()); {
if (pcommand) { prompt = "Enter VPC SubNet ID (" + amazonSubNet + ") > ";
if (strlen(pcommand) > 0) amazonSubNet = pcommand; pcommand = callReadline(prompt.c_str());
callFree(pcommand); if (pcommand) {
if (strlen(pcommand) > 0) amazonSubNet = pcommand;
callFree(pcommand);
}
} }
//set subnetID //set subnetID
try { try {
sysConfig->setConfig(InstallSection, "AmazonSubNetID", amazonSubNet); sysConfig->setConfig(InstallSection, "AmazonSubNetID", amazonSubNet);
@ -3521,7 +3531,7 @@ int main(int argc, char *argv[])
cout << ". " + installDir + "/bin/calpontAlias" << endl << endl; cout << ". " + installDir + "/bin/calpontAlias" << endl << endl;
cout << "Enter 'idbmysql' to access the InfiniDB MySQL console" << endl; cout << "Enter 'idbmysql' to access the InfiniDB MySQL console" << endl;
cout << "Enter 'cc' to access the InfiniDB OAM console" << endl << endl; cout << "Enter 'cc' to access the InfiniDB System Management console" << endl << endl;
} }
else else
{ {