1
1
/*****************************************************************************\
2
2
* info_node.c - node information functions for scontrol.
3
3
*****************************************************************************
4
* Copyright (C) 2002-2006 The Regents of the University of California.
4
* Copyright (C) 2002-2007 The Regents of the University of California.
5
* Copyright (C) 2008-2009 Lawrence Livermore National Security.
5
6
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
6
7
* Written by Morris Jette <jette1@llnl.gov>
8
* CODE-OCEC-09-009. All rights reserved.
9
10
* This file is part of SLURM, a resource management program.
10
* For details, see <http://www.llnl.gov/linux/slurm/>.
11
* For details, see <https://computing.llnl.gov/linux/slurm/>.
12
* Please also read the included file: DISCLAIMER.
12
14
* SLURM is free software; you can redistribute it and/or modify it under
13
15
* the terms of the GNU General Public License as published by the Free
189
* scontrol_print_topo - print the switch topology above the specified node
190
* IN node_name - NULL to print all topology information
192
extern void scontrol_print_topo (char *node_list)
194
static topo_info_response_msg_t *topo_info_msg = NULL;
195
int i, match, match_cnt = 0;
198
if ((topo_info_msg == NULL) &&
199
slurm_load_topo(&topo_info_msg)) {
200
slurm_perror ("slurm_load_topo error");
204
if ((node_list == NULL) || (node_list[0] == '\0')) {
205
slurm_print_topo_info_msg(stdout, topo_info_msg, one_liner);
209
/* Search for matching switch name */
210
for (i=0; i<topo_info_msg->record_count; i++) {
211
if (strcmp(topo_info_msg->topo_array[i].name, node_list))
213
slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i],
218
/* Search for matching node name */
219
for (i=0; i<topo_info_msg->record_count; i++) {
220
if ((topo_info_msg->topo_array[i].nodes == NULL) ||
221
(topo_info_msg->topo_array[i].nodes[0] == '\0'))
223
hs = hostset_create(topo_info_msg->topo_array[i].nodes);
225
fatal("hostset_create: memory allocation failure");
226
match = hostset_within(hs, node_list);
231
slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i],
235
if (match_cnt == 0) {
236
error("Topology information contains no switch or "
237
"node named %s", node_list);