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
eb5ef8ec
Commit
eb5ef8ec
authored
Sep 05, 2007
by
David Johnson
Browse files
Add support to "ping" the node manager. A couple other improvements.
parent
08f5b49c
Changes
3
Hide whitespace changes
Inline
Side-by-side
tbsetup/plab/libplab.py.in
View file @
eb5ef8ec
...
...
@@ -1724,7 +1724,32 @@ class Node:
self
.
phys_nodeid
))
pass
def
pingNM
(
self
):
isup
=
False
try
:
isup
=
self
.
slice
.
plab
.
agent
.
pingNM
(
self
)
except
:
if
debug
:
traceback
.
print_exc
()
pass
pass
if
not
isup
:
# Don't flood hist table with successful pings.
self
.
__logNodeHist
(
'node'
,
'nmping'
,
'failure'
,
''
)
pass
return
isup
def
pingNode
(
self
,
timeout
=
10
):
try
:
self
.
__execute
(
"/bin/ping -o -t %d %s"
%
(
timeout
,
self
.
IP
))
# Don't flood hist table with successful pings.
return
True
except
:
pass
self
.
__logNodeHist
(
'node'
,
'ping'
,
'failure'
,
''
)
return
False
# XXX: may want to rethink signal handling here.
def
_create
(
self
,
force
=
False
):
"""
...
...
tbsetup/plab/mod_PLC4.py.in
View file @
eb5ef8ec
...
...
@@ -110,6 +110,19 @@ class NM3agent:
pass
pass
return
self
.
__vers
def
ping
(
self
):
try
:
res
=
self
.
__server
.
version
()
if
type
(
res
)
==
list
and
len
(
res
)
==
2
and
res
[
0
]
==
0
:
return
True
pass
except
:
if
debug
:
traceback
.
print_exc
()
pass
pass
return
False
def
getAgentClass
(
self
):
return
self
.
__class__
...
...
@@ -121,8 +134,9 @@ DEF_NM_DELEGATE_KEY = "/root/.ssh/id_rsa"
TRY_SECONDARY_DEL_ACCT
=
True
SECONDARY_NM_DELEGATE_ACCT
=
"utah_elab_delegate"
SECONDARY_NM_DELEGATE_KEY
=
"/root/.ssh/id_rsa.plabdel"
DEF_NM_SSHCMD
=
"/usr/bin/ssh -q -oStrictHostKeyChecking=no"
\
" -oPasswordAuthentication=no -l %s -i %s %s"
DEF_NM_SSHCMD
=
"/usr/bin/ssh -q -o StrictHostKeyChecking=no"
\
" -o PasswordAuthentication=no -o NumberOfPasswordPrompts=0"
\
" -l %s -i %s %s"
class
NM4agent
:
def
__init__
(
self
,
IP
,
nodeid
,
nmport
=
DEF_NM_PORT
,
...
...
@@ -254,9 +268,12 @@ class NM4agent:
# XXX: we whack the retval to be compat with NMv3
rret
=
retval
[
0
][
0
]
if
rret
==
1
:
if
not
rret
==
0
:
rret
=
0
pass
else
:
rret
=
1
pass
retval
=
[
rret
,
[
''
]
]
return
retval
...
...
@@ -310,6 +327,20 @@ class NM4agent:
# NM v4 does not have a version method...
def
version
(
self
):
return
self
.
__vers
def
ping
(
self
):
try
:
# No better way to ping v4 than to call Help.
res
=
self
.
_xcall
(
'Help'
)
if
res
[
0
]
==
0
:
return
True
pass
except
:
if
debug
:
traceback
.
print_exc
()
pass
pass
return
False
def
getAgentClass
(
self
):
return
self
.
__class__
...
...
@@ -440,7 +471,10 @@ class NMagent_wrapper:
if
self
.
__agent
.
__class__
.
__dict__
.
has_key
(
'restart_sliver'
):
return
tryXmlrpcCmd
(
self
.
__agent
.
restart_sliver
,
slicename
)
return
0
def
ping
(
self
):
return
tryXmlrpcCmd
(
self
.
__agent
.
ping
)
pass
#
...
...
@@ -888,6 +922,20 @@ class mod_PLC4:
raise
return
cPickle
.
dumps
(
retval
)
def
pingNM
(
self
,
node
):
plcagent
=
self
.
__getAgent
(
node
.
slice
.
slicename
)
node
.
nmagent
=
NMagent_wrapper
(
node
.
IP
,
node
.
nodeid
)
try
:
res
=
node
.
nmagent
.
ping
()
return
res
except
:
if
debug
:
traceback
.
print_exc
()
pass
pass
return
False
def
createNode
(
self
,
node
):
plcagent
=
self
.
__getAgent
(
node
.
slice
.
slicename
)
...
...
tbsetup/plab/plabnode.in
View file @
eb5ef8ec
...
...
@@ -20,10 +20,12 @@ import libplab
def
usage
(
me
):
print
"Usage: %s [-vdfE] {alloc|renew|free|stop|start|restart} pid eid nodeid
\n
"
\
" Without Emulab DB:
\n
"
\
" %s [-vdfE] {alloc|renew|free|stop|start|restart} slicename nodeid"
\
%
(
me
,
me
)
print
"Usage: %s
\\\n
"
\
" [-vdfE] {alloc|renew|free|stop|start|restart|nmping}
\\\n
"
\
" pid eid nodeid
\n
"
\
" (or without Emulab DB):
\n
"
\
" slicename nodeid"
\
%
(
me
)
sys
.
exit
(
1
)
def
processException
(
command
,
nodeid
,
e
):
...
...
@@ -162,6 +164,22 @@ def main(args):
pass
pass
elif
command
==
"nmping"
:
exitval
=
1
try
:
node
=
slice
.
loadNode
(
nodeid
)
res
=
node
.
pingNM
()
if
res
:
exitval
=
0
pass
pass
except
:
if
parser
.
values
.
debug
:
traceback
.
print_exc
()
pass
pass
sys
.
exit
(
exitval
)
else
:
usage
(
me
)
pass
...
...
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