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-stable
Commits
d50c5e8b
Commit
d50c5e8b
authored
Dec 13, 2004
by
Robert Ricci
Browse files
Add support for referring to nodes by their virtual names, by giving a
pid/eid argument.
parent
13b39997
Changes
1
Show whitespace changes
Inline
Side-by-side
mote/tbuisp.in
View file @
d50c5e8b
...
@@ -14,7 +14,7 @@ my $TB = '@prefix@';
...
@@ -14,7 +14,7 @@ my $TB = '@prefix@';
use
libdb
;
use
libdb
;
use
English
;
use
English
;
use
Getopt::
Std
;
use
Getopt::
Long
;
#
#
# We have to be setuid root so that we can ssh into stargates as root
# We have to be setuid root so that we can ssh into stargates as root
...
@@ -41,7 +41,6 @@ my $DEBUG = 1;
...
@@ -41,7 +41,6 @@ my $DEBUG = 1;
#
#
# Handle command-line arguments
# Handle command-line arguments
# TODO: Allow a user to specify some of their own arguments to uisp
# TODO: Allow a user to specify some of their own arguments to uisp
# TODO: Allow a user to reprogram all motes in an experiment
#
#
sub
usage
()
{
sub
usage
()
{
warn
"
Usage: $0 <operation> [filename] <motes...>
\n
";
warn
"
Usage: $0 <operation> [filename] <motes...>
\n
";
...
@@ -50,6 +49,20 @@ sub usage() {
...
@@ -50,6 +49,20 @@ sub usage() {
return
1
;
return
1
;
}
}
my
%opt
=
();
GetOptions
(
\
%opt
,
'
p=s
','
e=s
');
if
((
$opt
{
e
}
&&
!
$opt
{
p
})
||
(
!
$opt
{
e
}
&&
$opt
{
p
}))
{
warn
"
-e and -p must be used togehter
\n
";
die
usage
;
}
my
(
$eid
,
$pid
);
if
(
$opt
{
e
})
{
$eid
=
$opt
{
e
};
$pid
=
$opt
{
p
};
}
my
$operation
=
shift
@ARGV
;
my
$operation
=
shift
@ARGV
;
my
$filename
;
my
$filename
;
if
(
!
$operation
)
{
if
(
!
$operation
)
{
...
@@ -71,12 +84,42 @@ SWITCH: for ($operation) {
...
@@ -71,12 +84,42 @@ SWITCH: for ($operation) {
exit
usage
();
exit
usage
();
}
}
# They have to give us at least one mote
# They have to give us at least one mote, unless they gave a pid or eid, in
# which case we take that to mean all nodes in the experiment
my
@motes
=
@ARGV
;
my
@motes
=
@ARGV
;
if
(
!
@motes
)
{
if
(
!
@motes
&&
!
$eid
)
{
exit
usage
();
exit
usage
();
}
}
# Perm check on the eid and pid
if
(
$eid
)
{
if
(
!
TBExptAccessCheck
(
$UID
,
$pid
,
$eid
,
TB_EXPT_READINFO
))
{
die
"
*** You do not have permission to access nodes in
\n
"
.
"
$pid
/
$eid
\n
";
}
}
# If given an eid and a mote list, translate the mote names to physical ones
if
(
$eid
&&
@motes
)
{
my
@tmp
;
foreach
my
$mote
(
@motes
)
{
my
$physmote
;
if
(
!
VnameToNodeid
(
$pid
,
$eid
,
$mote
,
\
$physmote
))
{
die
"
*** No such node
$mote
in
$pid
/
$eid
\n
";
}
push
@tmp
,
$physmote
;
}
@motes
=
@tmp
;
}
# If given an eid and no mote list, grab all nodes in the experiment
if
(
!
@motes
&&
$eid
)
{
@motes
=
ExpNodes
(
$pid
,
$eid
);
if
(
!
@motes
)
{
die
"
*** Unable to get nodes in experiment
$pid
/
$eid
\n
";
}
}
#
#
# Taint check the filename
# Taint check the filename
#
#
...
...
Write
Preview
Markdown
is supported
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