You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
Set storage uid gid in nonroot installs
This commit is contained in:
@ -8194,8 +8194,10 @@ namespace oam
|
|||||||
int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string& argument2, std::string& errmsg)
|
int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string& argument2, std::string& errmsg)
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
int user;
|
int user,group;
|
||||||
user = getuid();
|
user = getuid();
|
||||||
|
group = getgid();
|
||||||
|
|
||||||
string glustercmd = "gluster ";
|
string glustercmd = "gluster ";
|
||||||
|
|
||||||
if (user!=0)
|
if (user!=0)
|
||||||
@ -8424,6 +8426,23 @@ namespace oam
|
|||||||
writeLog("ERROR: command failed: " + command,LOG_TYPE_DEBUG);
|
writeLog("ERROR: command failed: " + command,LOG_TYPE_DEBUG);
|
||||||
exceptionControl("GLUSTER_ADD", API_FAILURE);
|
exceptionControl("GLUSTER_ADD", API_FAILURE);
|
||||||
}
|
}
|
||||||
|
if (user != 0)
|
||||||
|
{
|
||||||
|
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-uid " + itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||||
|
status = system(command.c_str());
|
||||||
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
{
|
||||||
|
writeLog("ERROR: command failed: ",LOG_TYPE_DEBUG);
|
||||||
|
exceptionControl("GLUSTER_ADD", API_FAILURE);
|
||||||
|
}
|
||||||
|
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-gid " + itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||||
|
status = system(command.c_str());
|
||||||
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
{
|
||||||
|
writeLog("ERROR: command failed: ",LOG_TYPE_DEBUG);
|
||||||
|
exceptionControl("GLUSTER_ADD", API_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
command = glustercmd + "volume start dbroot" + itoa(newDbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
command = glustercmd + "volume start dbroot" + itoa(newDbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
||||||
status = system(command.c_str());
|
status = system(command.c_str());
|
||||||
if (WEXITSTATUS(status) != 0 )
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
@ -254,7 +254,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//check if root-user
|
//check if root-user
|
||||||
int user;
|
int user;
|
||||||
|
int usergroup;
|
||||||
user = getuid();
|
user = getuid();
|
||||||
|
usergroup = getgid();
|
||||||
if (user != 0)
|
if (user != 0)
|
||||||
rootUser = false;
|
rootUser = false;
|
||||||
|
|
||||||
@ -5971,16 +5973,38 @@ bool glusterSetup(string password) {
|
|||||||
if (rootUser)
|
if (rootUser)
|
||||||
{
|
{
|
||||||
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
||||||
|
status = system(command.c_str());
|
||||||
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
{
|
||||||
|
cout << "ERROR: Failed to start dbroot" << oam.itoa(dbrootID) << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int user = getuid();
|
||||||
|
int group = getgid();
|
||||||
|
command = "sudo gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||||
|
status = system(command.c_str());
|
||||||
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
{
|
||||||
|
cout << "ERROR: Failed to start dbroot" << oam.itoa(dbrootID) << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
command = "sudo gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||||
|
status = system(command.c_str());
|
||||||
|
if (WEXITSTATUS(status) != 0 )
|
||||||
|
{
|
||||||
|
cout << "ERROR: Failed to start dbroot" << oam.itoa(dbrootID) << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
command = "sudo gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
command = "sudo gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
||||||
}
|
status = system(command.c_str());
|
||||||
status = system(command.c_str());
|
if (WEXITSTATUS(status) != 0 )
|
||||||
if (WEXITSTATUS(status) != 0 )
|
{
|
||||||
{
|
cout << "ERROR: Failed to start dbroot" << oam.itoa(dbrootID) << endl;
|
||||||
cout << "ERROR: Failed to start dbroot" << oam.itoa(dbrootID) << endl;
|
exit(1);
|
||||||
exit(1);
|
}
|
||||||
}
|
}
|
||||||
cout << "DONE" << endl;
|
cout << "DONE" << endl;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user