Commit e980e2ea authored by Leigh Stoller's avatar Leigh Stoller

More tweaks for global images.

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