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
e5ba6afc
Commit
e5ba6afc
authored
May 30, 2002
by
Leigh B. Stoller
Browse files
Add vnodelist command so that remote nodes can get the list of
currently assigned virtual nodes, say when a node reboots.
parent
ca454c3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/tmcd.c
View file @
e5ba6afc
...
...
@@ -105,6 +105,7 @@ COMMAND_PROTOTYPE(donseconfigs);
COMMAND_PROTOTYPE
(
dostate
);
COMMAND_PROTOTYPE
(
docreator
);
COMMAND_PROTOTYPE
(
dotunnels
);
COMMAND_PROTOTYPE
(
dovnodelist
);
struct
command
{
char
*
cmdname
;
...
...
@@ -135,6 +136,7 @@ struct command {
{
"creator"
,
docreator
},
{
"state"
,
dostate
},
{
"tunnels"
,
dotunnels
},
{
"vnodelist"
,
dovnodelist
},
};
static
int
numcommands
=
sizeof
(
command_array
)
/
sizeof
(
struct
command
);
...
...
@@ -2528,6 +2530,45 @@ COMMAND_PROTOTYPE(dotunnels)
return
0
;
}
/*
* Return vnode list for a widearea node.
*/
COMMAND_PROTOTYPE
(
dovnodelist
)
{
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
char
buf
[
MYBUFSIZE
];
int
nrows
;
res
=
mydb_query
(
"select r.node_id from reserved as r "
"left join nodes as n on r.node_id=n.node_id "
"left join node_types as nt on nt.type=n.type "
"where nt.isvirtnode=1 and n.phys_nodeid='%s'"
,
1
,
nodeid
);
if
(
!
res
)
{
error
(
"VNODELIST: %s: DB Error getting vnode list
\n
"
,
nodeid
);
return
1
;
}
if
((
nrows
=
(
int
)
mysql_num_rows
(
res
))
==
0
)
{
mysql_free_result
(
res
);
return
0
;
}
while
(
nrows
)
{
row
=
mysql_fetch_row
(
res
);
sprintf
(
buf
,
"%s
\n
"
,
row
[
0
]);
client_writeback
(
sock
,
buf
,
strlen
(
buf
),
tcp
);
nrows
--
;
info
(
"VNODELIST: %s
\n
"
,
row
[
0
]);
}
mysql_free_result
(
res
);
return
0
;
}
/*
* DB stuff
*/
...
...
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