Commit e980e2ea authored by Leigh Stoller's avatar Leigh Stoller

More tweaks for global images.

parent 8144c58c
......@@ -301,6 +301,7 @@ sub DoSnapshot()
"slice_urn" => $slice->urn(),
"imagename" => $imagename,
"sliver_urn" => $sliver_urn,
"global" => 1,
"credentials" => [$slice_credential->asString(),
$speaksfor_credential->asString()],
};
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -517,7 +517,7 @@ if (!exists($newimageid_args{"path"}) ||
elsif (! $isadmin) {
my $pdef = "";
if (!$shared &&
if (!($shared || $global) &&
exists($newimageid_args{"gid"}) &&
$newimageid_args{"gid"} ne "" &&
$newimageid_args{"gid"} ne $newimageid_args{"pid"}) {
......@@ -711,8 +711,8 @@ $newimageid_args{"ezid"} = 1;
# OSInfo->Create args not quite the same as Image->Create ones so copy
# newimageid_args into a new hash and fix up values.
my %newosid_args = %newimageid_args;
$newosid_args{"shared"} = $newimageid_args{"global"}
if exists $newimageid_args{"global"};
$newosid_args{"shared"} = $newimageid_args{"global"} = 1
if ($global);
my $usrerr;
my $new_osinfo = OSinfo->Create($project, $this_user, $imagename,
\%newosid_args, \$usrerr);
......
......@@ -65,8 +65,8 @@ my $nosnapshot = 0;
my $isvirtnode = 0;
my $waitmode = 0;
my $nodelta = 0; # To pass to create_image.
my $global;
my $shared;
my $global = 0;
my $shared = 0;
#
# Configure variables
......@@ -376,8 +376,9 @@ if (Image->LookupByName($imagename) && !$this_user->IsAdmin()) {
fatal("Not allowed to shadow snapshot a system image");
}
# Subgroups change the path
my $path = ($experiment->pid() eq $experiment->gid() ?
# Subgroups change the path, but a global image should still
# go into the project image directory.
my $path = ($experiment->pid() eq $experiment->gid() || $global ?
"$PROJROOT/$pid/images/${imagename}.ndz" :
"$GROUPROOT/$pid/$gid/images/${imagename}.ndz");
......@@ -405,10 +406,10 @@ $xmlfields{"reboot_waittime"} = $base_osinfo->reboot_waittime()
$xmlfields{"osfeatures"} = $base_osinfo->osfeatures()
if (defined($base_osinfo->osfeatures()) &&
$base_osinfo->osfeatures() ne "");
if (defined($global) && $global) {
if ($global) {
$xmlfields{"global"} = 1;
}
elsif (defined($shared) && $shared) {
elsif ($shared) {
$xmlfields{"shared"} = 1;
}
......
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