Skip to content
GitLab
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
62542621
Commit
62542621
authored
Mar 23, 2001
by
Christopher Alfeld
Browse files
Added check for sufficient resources. Exits with 777 if insufficient
resources.
parent
f9f2a273
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/ir/assign_wrapper.in
View file @
62542621
...
...
@@ -420,6 +420,31 @@ foreach $link (keys(%links)) {
}
close
(
TOPFILE
);
# Check for available resources
# This is very heuristic and won't work at all if our topology changes much.
open
(
PTOP
,"
$ptopfile
");
$avail_sshelves
=
0
;
$avail_pcs
=
0
;
while
(
<
PTOP
>
)
{
if
(
!
/^node/
)
{
next
;}
if
(
/shark-shelf/
)
{
$avail_sshelves
++
;}
if
(
/pc/
)
{
$avail_pcs
++
;}
}
@t
=
keys
(
%sharkshelves
);
$num_sshelves
=
$#t
+
1
;
@t
=
keys
(
%nodes
);
# Counting delay nodes as 1 when rwe really only need them as 1/2. So..
$num_pcs
=
$#t
+
1
-
int
(
$delayindex
/
2
);
if
(
$num_pcs
>
$avail_pcs
)
{
print
STDERR
"
Insufficient PCs to do mapping. Have
$avail_pcs
; need
$num_pcs
.
\n
";
exit
(
777
);
}
if
(
$num_sshelves
>
$avail_sshelves
)
{
print
STDERR
"
Insufficient Shark Shelves to do mapping. Have
$avail_sshelves
; need
$num_sshelves
.
\n
";
exit
(
777
);
}
# Run assign
# After assign finishes correctly several data structures will be
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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