Commit 27f520a0 authored by Mike Hibler's avatar Mike Hibler
Browse files

eventsys_control: make sure an experiment has nodes

eventsys_start: set both project and group GID, don't consider emulab-ops
parent 9ebf916a
...@@ -216,6 +216,15 @@ if ($procid != 0) { ...@@ -216,6 +216,15 @@ if ($procid != 0) {
"There is already an event scheduler running for $pid/$eid!\n"); "There is already an event scheduler running for $pid/$eid!\n");
} }
#
# Do not start an event system for experiments with no nodes
#
if (! ExpNodes($pid, $eid)) {
print("*** There are no nodes in $pid/$eid. ".
"Not starting a scheduler.\n");
exit(0);
}
# #
# For now, lets not start an event system if there are no events. # For now, lets not start an event system if there are no events.
# #
......
...@@ -77,7 +77,15 @@ $query_result = DBQueryFatal("select pid,eid,expt_head_uid,gid ". ...@@ -77,7 +77,15 @@ $query_result = DBQueryFatal("select pid,eid,expt_head_uid,gid ".
while (($pid, $eid, $uid, $gid) = $query_result->fetchrow_array()) { while (($pid, $eid, $uid, $gid) = $query_result->fetchrow_array()) {
my $unix_uid; my $unix_uid;
my $group; my $group;
my $unix_gid; my $unix_egid;
my $unix_pgid;
#
# Ignore "special" experiments
#
if ($pid eq TB_OPSPID) {
next;
}
# #
# Figure out the unix uid/gid # Figure out the unix uid/gid
...@@ -87,16 +95,25 @@ while (($pid, $eid, $uid, $gid) = $query_result->fetchrow_array()) { ...@@ -87,16 +95,25 @@ while (($pid, $eid, $uid, $gid) = $query_result->fetchrow_array()) {
failed("no unix uid for DB uid $uid", $pid, $eid); failed("no unix uid for DB uid $uid", $pid, $eid);
next; next;
} }
if (!TBGroupUnixInfo($pid, $gid, \$unix_gid, \$group)) { $unix_pgid = getgrnam($pid);
if (!defined($unix_pgid)) {
failed("no unix gid for project", $pid, $eid);
next;
}
if (!TBGroupUnixInfo($pid, $gid, \$unix_egid, \$group)) {
failed("no unix gid for DB gid $gid", $pid, $eid); failed("no unix gid for DB gid $gid", $pid, $eid);
next; next;
} }
# #
# Set real uid/gid to that of the user. # Set uid/gid to that of the user. We need to be in both the
# project's unix group and the experiments's unix group in order
# for the scheduler to write its logfile (in eventsys_control).
#
# Set some environment too. # Set some environment too.
# #
$EGID = $GID = $unix_gid; $GID = $unix_pgid;
$EGID = "$unix_pgid $unix_pgid $unix_egid";
$EUID = $UID = $unix_uid; $EUID = $UID = $unix_uid;
$ENV{'USER'} = $uid; $ENV{'USER'} = $uid;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment