Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
2421a178
Commit
2421a178
authored
Aug 25, 2015
by
Wim Van de Meerssche
Committed by
Leigh B Stoller
Oct 19, 2015
Browse files
improved error when slice name is already in use
parent
6af78455
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniStdSA.pm.in
View file @
2421a178
...
...
@@ -60,6 +60,7 @@ my $coder = Frontier::RPC2->new('use_objects' => 1);
my
$
GENI_VERSION
;
my
$
PGENIDOMAIN
=
"@PROTOGENI_DOMAIN@"
;
sub
SetGeniVersion
($)
{
...
...
@@ -334,6 +335,31 @@ sub CreateSlice($$)
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
);
}
#
Duplicate
check
for
duplicate
slice
(
GeniSA
Register
already
does
this
).
#
But
by
doing
it
ourself
,
we
can
give
a
nicer
error
.
my
$
tempslice
=
GeniSlice
->
Lookup
(
"${PGENIDOMAIN}.${hrn}"
);
if
($
tempslice
)
{
my
$
existing_urn
=
$
tempslice
->
urn
();
my
($
existing_slice_authority
,
$
existing_slice_type
,
$
existing_slice_name
)
=
GeniHRN
::
Parse
(
$
existing_urn
);
my
@
existing_slice_auth_parts
=
split
(
':'
,
$
existing_slice_authority
);
my
$
existing_slice_auth_parts_size
=
scalar
@
existing_slice_auth_parts
;
if
($
existing_slice_auth_parts_size
==
2
)
{
my
$
existing_slice_project_name
=
$
existing_slice_auth_parts
[
1
];
if
(
!defined($project_name) || $project_name ne $existing_slice_project_name) {
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"An existing slice in project $existing_slice_project_name already has "
.
"the same name as the slice you are trying to create: $hrn
\n
"
.
"Slices are not allowed to have the same name, even if projects differ."
);
}
}
else
{
if
(
defined
($
project_name
))
{
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"An existing slice (without project) already has "
.
"the same name as the slice you are trying to create: $hrn
\n
"
.
"Slices are not allowed to have the same name, even if projects differ."
);
}
}
}
$
response
=
GeniSA
::
RegisterInternal
($
args
,
$
project_name
);
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment