Commit b62b142f authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Improvements to previous revision. Also log slice_uuid in addition to

the slice_idx.
parent e122310c
...@@ -897,8 +897,7 @@ sub Update ...@@ -897,8 +897,7 @@ sub Update
my ($slice, $aggregate) = GeniCMV2::Credential2SliceAggregate($cred); my ($slice, $aggregate) = GeniCMV2::Credential2SliceAggregate($cred);
if (defined($slice)) { if (defined($slice)) {
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
} }
# The URN list must be either empty or contain the slice URN. # The URN list must be either empty or contain the slice URN.
......
...@@ -513,7 +513,7 @@ sub GetTicketAux($$$$$$$) ...@@ -513,7 +513,7 @@ sub GetTicketAux($$$$$$$)
return $slice return $slice
if (GeniResponse::IsResponse($slice)); if (GeniResponse::IsResponse($slice));
} }
main::AddLogfileMetaData("slice_idx", $slice->idx()); main::AddLogfileMetaDataFromSlice($slice);
return GetTicketAuxAux($slice, $user, $rspecstr, return GetTicketAuxAux($slice, $user, $rspecstr,
$isupdate, $impotent, $v2, $level, $ticket, $isupdate, $impotent, $v2, $level, $ticket,
......
...@@ -420,7 +420,7 @@ sub CreateSliver($) ...@@ -420,7 +420,7 @@ sub CreateSliver($)
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
"Credential does not match the URN"); "Credential does not match the URN");
} }
main::AddLogfileMetaData("slice_idx", $slice->idx()); main::AddLogfileMetaDataFromSlice($slice);
# #
# Watch for a placeholder slice and update it. # Watch for a placeholder slice and update it.
...@@ -465,8 +465,8 @@ sub CreateSliver($) ...@@ -465,8 +465,8 @@ sub CreateSliver($)
print STDERR "CreateSliver: Could not find slice for $credential\n"; print STDERR "CreateSliver: Could not find slice for $credential\n";
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,"Internal Error"); return GeniResponse->Create(GENIRESPONSE_ERROR, undef,"Internal Error");
} }
main::AddLogfileMetaData("slice_idx", $slice->idx()); main::AddLogfileMetaDataFromSlice($slice);
# Make sure that the next phase sees all changes. # Make sure that the next phase sees all changes.
Experiment->FlushAll(); Experiment->FlushAll();
Node->FlushAll(); Node->FlushAll();
...@@ -565,8 +565,7 @@ sub DeleteSliver($) ...@@ -565,8 +565,7 @@ sub DeleteSliver($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
"Sliver does not exist"); "Sliver does not exist");
} }
main::AddLogfileMetaData("slice_urn", $slice->urn()); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($sliver_urn ne $aggregate->urn()) { if ($sliver_urn ne $aggregate->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -672,8 +671,7 @@ sub DeleteSlice($) ...@@ -672,8 +671,7 @@ sub DeleteSlice($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
"No such slice here"); "No such slice here");
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -800,8 +798,7 @@ sub SliverAction($$$$$) ...@@ -800,8 +798,7 @@ sub SliverAction($$$$$)
if (defined($slice) && GeniResponse::IsResponse($slice)); if (defined($slice) && GeniResponse::IsResponse($slice));
if (defined($slice)) { if (defined($slice)) {
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
} }
if ( (!defined($slice)) && if ( (!defined($slice)) &&
...@@ -1018,8 +1015,7 @@ sub SliverStatus($) ...@@ -1018,8 +1015,7 @@ sub SliverStatus($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
"No slice or aggregate here"); "No slice or aggregate here");
} }
main::AddLogfileMetaData("slice_urn", $slice->urn()); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -1133,8 +1129,7 @@ sub Shutdown($) ...@@ -1133,8 +1129,7 @@ sub Shutdown($)
if (!defined($slice)) { if (!defined($slice)) {
return GeniResponse->Create(GENIRESPONSE_SUCCESS); return GeniResponse->Create(GENIRESPONSE_SUCCESS);
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
# #
# Do not worry about locking when setting the shutdown time. # Do not worry about locking when setting the shutdown time.
...@@ -1199,8 +1194,7 @@ sub RenewSlice($) ...@@ -1199,8 +1194,7 @@ sub RenewSlice($)
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef, return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"No slice or aggregate here"); "No slice or aggregate here");
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -1248,7 +1242,7 @@ sub GetTicket($) ...@@ -1248,7 +1242,7 @@ sub GetTicket($)
return $slice return $slice
if (GeniResponse::IsResponse($slice)); if (GeniResponse::IsResponse($slice));
main::AddLogfileMetaData("slice_idx", $slice->idx()); main::AddLogfileMetaDataFromSlice($slice);
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -1364,7 +1358,7 @@ sub UpdateTicket($) ...@@ -1364,7 +1358,7 @@ sub UpdateTicket($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED(), undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED(), undef,
"Slice does not exist here"); "Slice does not exist here");
} }
main::AddLogfileMetaData("slice_idx", $slice->idx()); main::AddLogfileMetaDataFromSlice($slice);
if ($slice->IsExpired()) { if ($slice->IsExpired()) {
return GeniResponse->Create(GENIRESPONSE_REFUSED, undef, return GeniResponse->Create(GENIRESPONSE_REFUSED, undef,
...@@ -1457,9 +1451,8 @@ sub UpdateSliver($) ...@@ -1457,9 +1451,8 @@ sub UpdateSliver($)
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef, return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"No slice or aggregate here"); "No slice or aggregate here");
} }
main::AddLogfileMetaData("slice_urn", $slice->urn()); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
# Must be an aggregate (top level sliver). # Must be an aggregate (top level sliver).
if (ref($aggregate) ne "GeniAggregate") { if (ref($aggregate) ne "GeniAggregate") {
return GeniResponse->MalformedArgsResponse("Must supply aggregate"); return GeniResponse->MalformedArgsResponse("Must supply aggregate");
...@@ -1540,8 +1533,7 @@ sub RedeemTicket($) ...@@ -1540,8 +1533,7 @@ sub RedeemTicket($)
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef, return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"No slice here"); "No slice here");
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
my $open_ticket = GeniTicket->SliceTicket($slice); my $open_ticket = GeniTicket->SliceTicket($slice);
if (! defined($open_ticket) || $open_ticket->idx() ne $ticket->idx()) { if (! defined($open_ticket) || $open_ticket->idx() ne $ticket->idx()) {
...@@ -1647,8 +1639,7 @@ sub ReleaseTicket($) ...@@ -1647,8 +1639,7 @@ sub ReleaseTicket($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
"No slice here"); "No slice here");
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -1817,8 +1808,7 @@ sub ReserveVlanTags($) ...@@ -1817,8 +1808,7 @@ sub ReserveVlanTags($)
return GeniResponse->BusyResponse(); return GeniResponse->BusyResponse();
} }
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
# #
# Confirm that the certificate is the same. # Confirm that the certificate is the same.
...@@ -2303,8 +2293,7 @@ sub InjectEvent($) ...@@ -2303,8 +2293,7 @@ sub InjectEvent($)
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
"Sliver does not exist"); "Sliver does not exist");
} }
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if ($slice_urn ne $slice->urn()) { if ($slice_urn ne $slice->urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef, return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
...@@ -2363,8 +2352,7 @@ sub CreateImage($) ...@@ -2363,8 +2352,7 @@ sub CreateImage($)
return $slice return $slice
if (defined($slice) && GeniResponse::IsResponse($slice)); if (defined($slice) && GeniResponse::IsResponse($slice));
main::AddLogfileMetaData("slice_urn", $slice_urn); main::AddLogfileMetaDataFromSlice($slice);
main::AddLogfileMetaData("slice_idx", $slice->idx());
if (! (defined($slice) && defined($aggregate))) { if (! (defined($slice) && defined($aggregate))) {
return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef, return GeniResponse->Create(GENIRESPONSE_SEARCHFAILED, undef,
......
...@@ -411,7 +411,7 @@ sub WrapperFork() ...@@ -411,7 +411,7 @@ sub WrapperFork()
} }
# #
# Upcall to set the slice urn in the logfile metadata. Difficult to # Upcall to add metadata to the logfile. Difficult to
# know so let the callee tell us. # know so let the callee tell us.
# #
sub AddLogfileMetaData($$) sub AddLogfileMetaData($$)
...@@ -426,6 +426,14 @@ sub AddLogfileMetaData($$) ...@@ -426,6 +426,14 @@ sub AddLogfileMetaData($$)
} }
push(@metadata, [$key, $val]); push(@metadata, [$key, $val]);
} }
sub AddLogfileMetaDataFromSlice($)
{
my ($slice) = @_;
AddLogfileMetaData("slice_idx", $slice->idx());
AddLogfileMetaData("slice_urn", $slice->urn());
AddLogfileMetaData("slice_uuid", $slice->uuid());
}
# #
# Use libaudit to capture any output from libraries and programs. We # Use libaudit to capture any output from libraries and programs. We
......
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