~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/scontrol/info_node.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
7
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
8
9
 *  
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.
11
13
 *  
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
183
185
        return;
184
186
}
185
187
 
 
188
/*
 
189
 * scontrol_print_topo - print the switch topology above the specified node
 
190
 * IN node_name - NULL to print all topology information
 
191
 */
 
192
extern void     scontrol_print_topo (char *node_list)
 
193
{
 
194
        static topo_info_response_msg_t *topo_info_msg = NULL;
 
195
        int i, match, match_cnt = 0;
 
196
        hostset_t hs;
 
197
 
 
198
        if ((topo_info_msg == NULL) &&
 
199
            slurm_load_topo(&topo_info_msg)) {
 
200
                slurm_perror ("slurm_load_topo error");
 
201
                return;
 
202
        }
 
203
 
 
204
        if ((node_list == NULL) || (node_list[0] == '\0')) {
 
205
                slurm_print_topo_info_msg(stdout, topo_info_msg, one_liner);
 
206
                return;
 
207
        }
 
208
 
 
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))
 
212
                        continue;
 
213
                slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i], 
 
214
                                        one_liner);
 
215
                return;
 
216
        }
 
217
 
 
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')) 
 
222
                        continue;
 
223
                hs = hostset_create(topo_info_msg->topo_array[i].nodes);
 
224
                if (hs == NULL)
 
225
                        fatal("hostset_create: memory allocation failure");
 
226
                match = hostset_within(hs, node_list);
 
227
                hostset_destroy(hs);
 
228
                if (!match)
 
229
                        continue;
 
230
                match_cnt++;
 
231
                slurm_print_topo_record(stdout, &topo_info_msg->topo_array[i], 
 
232
                                        one_liner);
 
233
        }
 
234
 
 
235
        if (match_cnt == 0) {
 
236
                error("Topology information contains no switch or "
 
237
                      "node named %s", node_list);
 
238
        }
 
239
}