MXS-2644 Complain if license file is not found
A file containing a statement for setting the Clustrix license must exist in order to run Clustrix tests.
This commit is contained in:
@ -152,7 +152,7 @@ int Clustrix_nodes::prepare_server(int m)
|
|||||||
|
|
||||||
if (ec == 0)
|
if (ec == 0)
|
||||||
{
|
{
|
||||||
printf("Can access Clustrix using user '%s.\n", this->user_name);
|
printf("Can access Clustrix using user '%s'.\n", this->user_name);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -169,30 +169,46 @@ int Clustrix_nodes::prepare_server(int m)
|
|||||||
|
|
||||||
int Clustrix_nodes::start_replication()
|
int Clustrix_nodes::start_replication()
|
||||||
{
|
{
|
||||||
|
int rv = 1;
|
||||||
|
|
||||||
std::string lic_filename = std::string(getenv("HOME"))
|
std::string lic_filename = std::string(getenv("HOME"))
|
||||||
+ std::string("/.config/mdbci/clustrix_license");
|
+ std::string("/.config/mdbci/clustrix_license");
|
||||||
std::ifstream lic_file;
|
std::ifstream lic_file;
|
||||||
lic_file.open(lic_filename.c_str());
|
lic_file.open(lic_filename.c_str());
|
||||||
std::stringstream strStream;
|
|
||||||
strStream << lic_file.rdbuf();
|
|
||||||
std::string clustrix_license = strStream.str();
|
|
||||||
lic_file.close();
|
|
||||||
|
|
||||||
execute_query_all_nodes(clustrix_license.c_str());
|
if (lic_file.is_open())
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << lic_file.rdbuf();
|
||||||
|
std::string clustrix_license = ss.str();
|
||||||
|
lic_file.close();
|
||||||
|
|
||||||
std::string cluster_setup_sql = std::string("ALTER CLUSTER ADD '")
|
execute_query_all_nodes(clustrix_license.c_str());
|
||||||
|
|
||||||
|
std::string cluster_setup_sql = std::string("ALTER CLUSTER ADD '")
|
||||||
+ std::string(IP_private[1])
|
+ std::string(IP_private[1])
|
||||||
+ std::string("'");
|
+ std::string("'");
|
||||||
for (int i = 2; i < N; i++)
|
for (int i = 2; i < N; i++)
|
||||||
{
|
{
|
||||||
cluster_setup_sql += std::string(",'")
|
cluster_setup_sql += std::string(",'")
|
||||||
+ std::string(IP_private[i])
|
+ std::string(IP_private[i])
|
||||||
+ std::string("'");
|
+ std::string("'");
|
||||||
|
}
|
||||||
|
connect();
|
||||||
|
execute_query(nodes[0], "%s", cluster_setup_sql.c_str());
|
||||||
|
close_connections();
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
}
|
}
|
||||||
connect();
|
else
|
||||||
execute_query(nodes[0], "%s", cluster_setup_sql.c_str());
|
{
|
||||||
close_connections();
|
printf("ERROR: The Clustrix license file '%s' does not exist. "
|
||||||
return 0;
|
"It must contain a string \"set global license='{...}';\" using which the "
|
||||||
|
"Clustrix license can be set.",
|
||||||
|
lic_filename.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Clustrix_nodes::cnf_servers()
|
std::string Clustrix_nodes::cnf_servers()
|
||||||
|
Reference in New Issue
Block a user