Commit 9c3191b7 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Subgroup experiments now go into /groups/$pid/exp/$eid, instead of

in /proj/$pid/exp/$eid, since this would seem to violate group
privacy (/proj exported to all experiments). Minor changes to owner
and mode to allow for non group members to swap/terminate and not get
copy error (of logs).
parent 139da222
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group. # Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -29,6 +29,7 @@ my $TBOPS = "@TBOPSEMAIL@"; ...@@ -29,6 +29,7 @@ my $TBOPS = "@TBOPSEMAIL@";
# Should be configured. # Should be configured.
# #
my $projroot = "/proj"; my $projroot = "/proj";
my $grouproot= "/groups";
# #
# Testbed Support libraries # Testbed Support libraries
...@@ -83,10 +84,11 @@ else { ...@@ -83,10 +84,11 @@ else {
die("Tainted group name: $gid!\n"); die("Tainted group name: $gid!\n");
} }
my $piddir = "$projroot/$pid"; my $piddir = (($pid eq $gid) ? "$projroot/$pid" : "$grouproot/$pid/$gid");
my $expdir = "$piddir/exp"; my $expdir = "$piddir/exp";
my $eiddir = "$expdir/$eid"; my $eiddir = "$expdir/$eid";
my $workdir = TBExptWorkDir($pid, $eid); my $eidlink = "$projroot/$pid/exp/$eid";
my $workdir = TBExptWorkDir($pid, $eid);
# #
# Unix info for the group # Unix info for the group
...@@ -102,29 +104,29 @@ if (! TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_name)) { ...@@ -102,29 +104,29 @@ if (! TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_name)) {
# We create a directory structure for the experiment in the project directory. # We create a directory structure for the experiment in the project directory.
# #
if (! chdir($expdir)) { if (! chdir($expdir)) {
print STDOUT "Could not chdir to $expdir: $!\n"; print "Could not chdir to $expdir: $!\n";
exit(-1); exit(-1);
} }
if (! mkdir($eid, 0770)) { if (! mkdir($eid, 0770)) {
print STDOUT "Could not mkdir $eid in $expdir: $!\n"; print "Could not mkdir $eid in $expdir: $!\n";
exit(-1); exit(-1);
} }
if (! chmod(0770, "$eid")) { if (! chmod(0770, "$eid")) {
print STDOUT "Could not chmod $eid to 0770 in $expdir: $!\n"; print "Could not chmod $eid to 0770 in $expdir: $!\n";
rmdir($eid); rmdir($eid);
exit(-1); exit(-1);
} }
if (! chown($UID, $unix_gid, "$eid")) { if (! chown($UID, $unix_gid, "$eid")) {
print STDOUT "Could not chown $eid to $UID/$unix_gid in $expdir: $!\n"; print "Could not chown $eid to $UID/$unix_gid in $expdir: $!\n";
rmdir($eid); rmdir($eid);
exit(-1); exit(-1);
} }
if (! chdir($eid)) { if (! chdir($eid)) {
print STDOUT "Could not chdir to $eid in $expdir: $!\n"; print "Could not chdir to $eid in $expdir: $!\n";
rmdir($eid); rmdir($eid);
exit(-1); exit(-1);
} }
...@@ -134,13 +136,11 @@ if (! chdir($eid)) { ...@@ -134,13 +136,11 @@ if (! chdir($eid)) {
# #
foreach $dir (@dirlist) { foreach $dir (@dirlist) {
if (! mkdir($dir, 0770)) { if (! mkdir($dir, 0770)) {
print STDOUT "Could not mkdir $dir in $eiddir: $!\n"; fatal("Could not mkdir $dir in $eiddir: $!");
fatal();
} }
if (! chmod(0770, "$dir")) { if (! chmod(0770, "$dir")) {
print STDOUT "Could not chmod $dir to 0770 in $eiddir: $!\n"; fatal("Could not chmod $dir to 0770 in $eiddir: $!");
fatal();
} }
} }
...@@ -155,20 +155,36 @@ DBQueryFatal("update experiments set path='$eiddir' ". ...@@ -155,20 +155,36 @@ DBQueryFatal("update experiments set path='$eiddir' ".
# Create the working directory. # Create the working directory.
# #
if (-e $workdir) { if (-e $workdir) {
fatal("*** $0:\n". fatal("$workdir already exists!");
" $workdir already exists!\n");
} }
if (! mkdir($workdir, 0775)) { if (! mkdir($workdir, 0775)) {
fatal("*** $0:\n". fatal("Could not create $workdir: $!");
" Could not create $workdir: $!\n");
} }
if (! chown($UID, $unix_gid, "$workdir")) {
fatal("Could not chown $workdir to $UID/$unix_gid: $!");
}
#
# If a group experiment, leave behind a symlink from the project experiment
# directory to the group experiment directory.
#
#if ($pid ne $gid) {
# symlink($eiddir, $eidlink) or
# fatal("Could not symlink($eiddir, $eidlink): $!");
#}
exit(0); exit(0);
sub fatal() sub fatal($)
{ {
system("rm -r $eiddir"); my ($msg) = @_;
system("rm -r $workdir");
exit(-1); system("/bin/rm -rf $eiddir");
system("/bin/rm -rf $workdir");
# unlink($eidlink)
# if ($pid ne $gid && -l $eidlink);
die("*** $0:\n".
" $msg\n");
} }
Markdown is supported
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