Skip to content
Snippets Groups Projects
Commit 819005cc authored by Moe Jette's avatar Moe Jette
Browse files

Add support for scontrol show part <name> for a switch or node name.

parent 40ff5f01
No related branches found
No related tags found
No related merge requests found
...@@ -225,6 +225,10 @@ entity: the configuration parameter name, job ID, node name, partition name, ...@@ -225,6 +225,10 @@ entity: the configuration parameter name, job ID, node name, partition name,
reservation name, or job step ID for \fIconfig\fP, \fIjob\fP, \fInode\fP, reservation name, or job step ID for \fIconfig\fP, \fIjob\fP, \fInode\fP,
\fIpartition\fP, or \fIstep\fP respectively. \fIpartition\fP, or \fIstep\fP respectively.
For an \fIENTITY\fP of \fItopology\fP, the \fIID\fP may be a node or switch name. For an \fIENTITY\fP of \fItopology\fP, the \fIID\fP may be a node or switch name.
If one node name is specified, all switches connected to that node (and
their parent switches) will be shown.
If more than one node name is specified, only switches that connect to all
named nodes will be shown.
\fIhostnames\fP takes an optional hostlist expression as input and \fIhostnames\fP takes an optional hostlist expression as input and
writes a list of individual host names to standard output (one per writes a list of individual host names to standard output (one per
line). If no hostlist expression is supplied, the contents of the line). If no hostlist expression is supplied, the contents of the
......
...@@ -1999,6 +1999,17 @@ extern void slurm_free_topo_info_msg PARAMS(( topo_info_response_msg_t *msg )); ...@@ -1999,6 +1999,17 @@ extern void slurm_free_topo_info_msg PARAMS(( topo_info_response_msg_t *msg ));
extern void slurm_print_topo_info_msg PARAMS(( extern void slurm_print_topo_info_msg PARAMS((
FILE * out, topo_info_response_msg_t *topo_info_msg_ptr, int one_liner )) ; FILE * out, topo_info_response_msg_t *topo_info_msg_ptr, int one_liner )) ;
/*
* slurm_print_topo_record - output information about a specific Slurm topology
* record based upon message as loaded using slurm_load_topo
* IN out - file to write to
* IN topo_ptr - an individual switch information record pointer
* IN one_liner - print as a single line if not zero
* RET out - char * containing formatted output (must be freed after call)
* NULL is returned on failure.
*/
extern void slurm_print_topo_record PARAMS((FILE * out, topo_info_t *topo_ptr,
int one_liner ));
/*****************************************************************************\ /*****************************************************************************\
* SLURM PARTITION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS * SLURM PARTITION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
\*****************************************************************************/ \*****************************************************************************/
......
...@@ -192,6 +192,8 @@ scontrol_print_node_list (char *node_list) ...@@ -192,6 +192,8 @@ scontrol_print_node_list (char *node_list)
extern void scontrol_print_topo (char *node_list) extern void scontrol_print_topo (char *node_list)
{ {
static topo_info_response_msg_t *topo_info_msg = NULL; static topo_info_response_msg_t *topo_info_msg = NULL;
int i, match, match_cnt = 0;
hostset_t hs;
if ((topo_info_msg == NULL) && if ((topo_info_msg == NULL) &&
slurm_load_topo(&topo_info_msg)) { slurm_load_topo(&topo_info_msg)) {
...@@ -199,5 +201,39 @@ extern void scontrol_print_topo (char *node_list) ...@@ -199,5 +201,39 @@ extern void scontrol_print_topo (char *node_list)
return; return;
} }
slurm_print_topo_info_msg(stdout, topo_info_msg, one_liner); if ((node_list == NULL) || (node_list[0] == '\0')) {
slurm_print_topo_info_msg(stdout, topo_info_msg, one_liner);
return;
}
/* Search for matching switch name */
for (i=0; i<topo_info_msg->record_count; i++) {
if (strcmp(topo_info_msg->topo_array[i].name, node_list))
continue;
slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i],
one_liner);
return;
}
/* Search for matching node name */
for (i=0; i<topo_info_msg->record_count; i++) {
if ((topo_info_msg->topo_array[i].nodes == NULL) ||
(topo_info_msg->topo_array[i].nodes[0] == '\0'))
continue;
hs = hostset_create(topo_info_msg->topo_array[i].nodes);
if (hs == NULL)
fatal("hostset_create: memory allocation failure");
match = hostset_within(hs, node_list);
hostset_destroy(hs);
if (!match)
continue;
match_cnt++;
slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i],
one_liner);
}
if (match_cnt == 0) {
error("Topology information contains no switch or "
"node named %s", node_list);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment