Commit 026d4c32 authored by Leigh Stoller's avatar Leigh Stoller

A couple minor tweaks to allow taking snapshots of global images,

which are stored in /proj/$pid/images since they cannot go directly
to boss. They need to be copied back of course, but only admins
can create global images anyway.
parent 99a5bd48
......@@ -237,12 +237,11 @@ my $filename = $imageid_row{'path'};
my $isglobal = $imageid_row{'global'};
#
# Throw an error if the image is global; we cannot write images into
# /usr/testbed/images. In fact, lets check the filename just in case.
# Redirect pathname for global images.
#
if ($isglobal) {
die("*** $0:\n".
" Not able to autocreate images that are marked global!\n");
if ($isglobal && ($filename =~ /^\/usr\/testbed/)) {
$filename = "/proj/$pid/images/" . basename($filename);
print "*** WARNING: Writing global descriptor to $filename instead!\n";
}
# Untaint. Very silly.
......@@ -292,6 +291,12 @@ if ($?) {
" Could not kill running frisbee for $imageid!\n");
}
if (-e $filename) {
unlink($filename) or
die("*** $0:\n".
" Could not delete $filename: $!\n");
}
open(FILE, "> $filename") or
die("*** $0:\n".
" Could not create $filename: $!\n");
......
......@@ -121,7 +121,8 @@ echo "<br>
<br><br>\n";
flush();
SUEXEC($uid, "$image_pid,$unix_gid",
SUEXEC($uid,
"$image_pid,$unix_gid" . ($image_pid != $node_pid ? ",$node_pid" : ""),
"webcreateimage -p $image_pid $image_name $node",
SUEXEC_ACTION_DUPDIE);
......
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