Commit ac65d3bc authored by Leigh Stoller's avatar Leigh Stoller

When posting an image alias to the image server, we have to watch for

the case that a target is an imported image. We do not post imported
images to the image server since that would just be duplicates. This
decision might need revisting, but in the meantime we tell the image
server the origin urn instead of our local urn.
parent 9a372203
......@@ -469,7 +469,22 @@ sub PostImageAlias($)
my $credential = GetServerCredential();
foreach my $tmp ($image->imagelist()) {
push(@target_urns, $tmp->urn());
my $target_urn;
if ($tmp->IsLocal()) {
$target_urn = $tmp->urn();
}
else {
#
# Need to provide the URN it is known by. Need a better way
# to get this.
#
my $authurn = GeniHRN->new($tmp->origin_urn());
my ($ospid,$os,undef,$vers) =
($tmp->origin_name() =~ m{([^/]+)/([^:]+)(:(\d+))?});
$target_urn = GeniHRN::Generate($authurn->authority(), "image",
"${ospid}//${os}");
}
push(@target_urns, $target_urn);
}
my $blob = {"client_version" => $CLIENTVERS,
"isimagealias" => 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