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

Set storage uid gid in nonroot installs

This commit is contained in:
Ben Thompson
2017-09-13 17:12:36 -05:00
parent 7035273ed7
commit 234810905d
2 changed files with 50 additions and 7 deletions

View File

@ -8194,8 +8194,10 @@ namespace oam
int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string& argument2, std::string& errmsg)
{
#ifndef _MSC_VER
int user;
int user,group;
user = getuid();
group = getgid();
string glustercmd = "gluster ";
if (user!=0)
@ -8424,6 +8426,23 @@ namespace oam
writeLog("ERROR: command failed: " + command,LOG_TYPE_DEBUG);
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";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )