PageRenderTime 121ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 1ms

/src/slurmdbd/proc_req.c

https://github.com/cfenoy/slurm
C | 3599 lines | 3113 code | 392 blank | 94 comment | 659 complexity | b9798d7e544059e4133a50c710d197b1 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0

Large files files are truncated, but you can click here to view the full file

  1. /*****************************************************************************\
  2. * proc_req.c - functions for processing incoming RPCs.
  3. *****************************************************************************
  4. * Copyright (C) 2008-2010 Lawrence Livermore National Security.
  5. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  6. * Written by Morris Jette <jette1@llnl.gov>, Danny Auble <da@llnl.gov>
  7. * CODE-OCEC-09-009. All rights reserved.
  8. *
  9. * This file is part of SLURM, a resource management program.
  10. * For details, see <http://www.schedmd.com/slurmdocs/>.
  11. * Please also read the included file: DISCLAIMER.
  12. *
  13. * SLURM is free software; you can redistribute it and/or modify it under
  14. * the terms of the GNU General Public License as published by the Free
  15. * Software Foundation; either version 2 of the License, or (at your option)
  16. * any later version.
  17. *
  18. * In addition, as a special exception, the copyright holders give permission
  19. * to link the code of portions of this program with the OpenSSL library under
  20. * certain conditions as described in each individual source file, and
  21. * distribute linked combinations including the two. You must obey the GNU
  22. * General Public License in all respects for all of the code used other than
  23. * OpenSSL. If you modify file(s) with this exception, you may extend this
  24. * exception to your version of the file(s), but you are not obligated to do
  25. * so. If you do not wish to do so, delete this exception statement from your
  26. * version. If you delete this exception statement from all source files in
  27. * the program, then also delete it here.
  28. *
  29. * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
  30. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  31. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  32. * details.
  33. *
  34. * You should have received a copy of the GNU General Public License along
  35. * with SLURM; if not, write to the Free Software Foundation, Inc.,
  36. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  37. \*****************************************************************************/
  38. #include "src/common/gres.h"
  39. #include "src/common/macros.h"
  40. #include "src/common/pack.h"
  41. #include "src/common/slurmdbd_defs.h"
  42. #include "src/common/slurm_accounting_storage.h"
  43. #include "src/common/slurm_jobacct_gather.h"
  44. #include "src/common/slurm_protocol_api.h"
  45. #include "src/common/slurm_protocol_defs.h"
  46. #include "src/common/uid.h"
  47. #include "src/common/xstring.h"
  48. #include "src/slurmdbd/read_config.h"
  49. #include "src/slurmdbd/rpc_mgr.h"
  50. #include "src/slurmdbd/proc_req.h"
  51. #include "src/slurmctld/slurmctld.h"
  52. /* Local functions */
  53. static int _add_accounts(slurmdbd_conn_t *slurmdbd_conn,
  54. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  55. static int _add_account_coords(slurmdbd_conn_t *slurmdbd_conn,
  56. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  57. static int _add_assocs(slurmdbd_conn_t *slurmdbd_conn,
  58. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  59. static int _add_clusters(slurmdbd_conn_t *slurmdbd_conn,
  60. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  61. static int _add_qos(slurmdbd_conn_t *slurmdbd_conn,
  62. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  63. static int _add_users(slurmdbd_conn_t *slurmdbd_conn,
  64. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  65. static int _add_wckeys(slurmdbd_conn_t *slurmdbd_conn,
  66. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  67. static int _add_reservation(slurmdbd_conn_t *slurmdbd_conn,
  68. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  69. static int _archive_dump(slurmdbd_conn_t *slurmdbd_conn,
  70. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  71. static int _archive_load(slurmdbd_conn_t *slurmdbd_conn,
  72. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  73. static int _cluster_cpus(slurmdbd_conn_t *slurmdbd_conn,
  74. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  75. static int _get_accounts(slurmdbd_conn_t *slurmdbd_conn,
  76. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  77. static int _get_assocs(slurmdbd_conn_t *slurmdbd_conn,
  78. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  79. static int _get_clusters(slurmdbd_conn_t *slurmdbd_conn,
  80. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  81. static int _get_config(slurmdbd_conn_t *slurmdbd_conn,
  82. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  83. static int _get_events(slurmdbd_conn_t *slurmdbd_conn,
  84. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  85. static int _get_jobs_cond(slurmdbd_conn_t *slurmdbd_conn,
  86. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  87. static int _get_probs(slurmdbd_conn_t *slurmdbd_conn,
  88. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  89. static int _get_qos(slurmdbd_conn_t *slurmdbd_conn,
  90. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  91. static int _get_txn(slurmdbd_conn_t *slurmdbd_conn,
  92. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  93. static int _get_usage(uint16_t type, slurmdbd_conn_t *slurmdbd_conn,
  94. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  95. static int _get_users(slurmdbd_conn_t *slurmdbd_conn,
  96. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  97. static int _get_wckeys(slurmdbd_conn_t *slurmdbd_conn,
  98. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  99. static int _get_reservations(slurmdbd_conn_t *slurmdbd_conn,
  100. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  101. static int _flush_jobs(slurmdbd_conn_t *slurmdbd_conn,
  102. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  103. static int _init_conn(slurmdbd_conn_t *slurmdbd_conn,
  104. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  105. static int _fini_conn(slurmdbd_conn_t *slurmdbd_conn, Buf in_buffer,
  106. Buf *out_buffer);
  107. static int _job_complete(slurmdbd_conn_t *slurmdbd_conn,
  108. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  109. static int _job_start(slurmdbd_conn_t *slurmdbd_conn,
  110. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  111. static int _job_suspend(slurmdbd_conn_t *slurmdbd_conn,
  112. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  113. static int _modify_accounts(slurmdbd_conn_t *slurmdbd_conn,
  114. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  115. static int _modify_assocs(slurmdbd_conn_t *slurmdbd_conn,
  116. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  117. static int _modify_clusters(slurmdbd_conn_t *slurmdbd_conn,
  118. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  119. static int _modify_job(slurmdbd_conn_t *slurmdbd_conn,
  120. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  121. static int _modify_qos(slurmdbd_conn_t *slurmdbd_conn,
  122. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  123. static int _modify_users(slurmdbd_conn_t *slurmdbd_conn,
  124. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  125. static int _modify_wckeys(slurmdbd_conn_t *slurmdbd_conn,
  126. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  127. static int _modify_reservation(slurmdbd_conn_t *slurmdbd_conn,
  128. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  129. static int _node_state(slurmdbd_conn_t *slurmdbd_conn,
  130. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  131. static char *_node_state_string(uint16_t node_state);
  132. static void _process_job_start(slurmdbd_conn_t *slurmdbd_conn,
  133. dbd_job_start_msg_t *job_start_msg,
  134. dbd_id_rc_msg_t *id_rc_msg);
  135. static int _register_ctld(slurmdbd_conn_t *slurmdbd_conn,
  136. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  137. static int _remove_accounts(slurmdbd_conn_t *slurmdbd_conn,
  138. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  139. static int _remove_account_coords(slurmdbd_conn_t *slurmdbd_conn,
  140. Buf in_buffer, Buf *out_buffer,
  141. uint32_t *uid);
  142. static int _remove_assocs(slurmdbd_conn_t *slurmdbd_conn,
  143. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  144. static int _remove_clusters(slurmdbd_conn_t *slurmdbd_conn,
  145. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  146. static int _remove_qos(slurmdbd_conn_t *slurmdbd_conn,
  147. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  148. static int _remove_users(slurmdbd_conn_t *slurmdbd_conn,
  149. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  150. static int _remove_wckeys(slurmdbd_conn_t *slurmdbd_conn,
  151. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  152. static int _remove_reservation(slurmdbd_conn_t *slurmdbd_conn,
  153. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  154. static int _roll_usage(slurmdbd_conn_t *slurmdbd_conn,
  155. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  156. static int _send_mult_job_start(slurmdbd_conn_t *slurmdbd_conn,
  157. Buf in_buffer, Buf *out_buffer,
  158. uint32_t *uid);
  159. static int _send_mult_msg(slurmdbd_conn_t *slurmdbd_conn,
  160. Buf in_buffer, Buf *out_buffer,
  161. uint32_t *uid);
  162. static int _step_complete(slurmdbd_conn_t *slurmdbd_conn,
  163. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  164. static int _step_start(slurmdbd_conn_t *slurmdbd_conn,
  165. Buf in_buffer, Buf *out_buffer, uint32_t *uid);
  166. /* Process an incoming RPC
  167. * slurmdbd_conn IN/OUT - in will that the newsockfd set before
  168. * calling and db_conn and rpc_version will be filled in with the init.
  169. * msg IN - incoming message
  170. * msg_size IN - size of msg in bytes
  171. * first IN - set if first message received on the socket
  172. * buffer OUT - outgoing response, must be freed by caller
  173. * uid IN/OUT - user ID who initiated the RPC
  174. * RET SLURM_SUCCESS or error code */
  175. extern int
  176. proc_req(slurmdbd_conn_t *slurmdbd_conn,
  177. char *msg, uint32_t msg_size,
  178. bool first, Buf *out_buffer, uint32_t *uid)
  179. {
  180. int rc = SLURM_SUCCESS;
  181. uint16_t msg_type;
  182. Buf in_buffer;
  183. char *comment = NULL;
  184. in_buffer = create_buf(msg, msg_size); /* puts msg into buffer struct */
  185. safe_unpack16(&msg_type, in_buffer);
  186. errno = 0; /* clear errno */
  187. if (first && (msg_type != DBD_INIT)) {
  188. comment = "Initial RPC not DBD_INIT";
  189. error("CONN:%u %s type (%d)",
  190. slurmdbd_conn->newsockfd, comment, msg_type);
  191. rc = EINVAL;
  192. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  193. rc, comment, DBD_INIT);
  194. } else {
  195. switch (msg_type) {
  196. case DBD_ADD_ACCOUNTS:
  197. rc = _add_accounts(slurmdbd_conn,
  198. in_buffer, out_buffer, uid);
  199. break;
  200. case DBD_ADD_ACCOUNT_COORDS:
  201. rc = _add_account_coords(slurmdbd_conn,
  202. in_buffer, out_buffer, uid);
  203. break;
  204. case DBD_ADD_ASSOCS:
  205. rc = _add_assocs(slurmdbd_conn,
  206. in_buffer, out_buffer, uid);
  207. break;
  208. case DBD_ADD_CLUSTERS:
  209. rc = _add_clusters(slurmdbd_conn,
  210. in_buffer, out_buffer, uid);
  211. break;
  212. case DBD_ADD_QOS:
  213. rc = _add_qos(slurmdbd_conn,
  214. in_buffer, out_buffer, uid);
  215. break;
  216. case DBD_ADD_USERS:
  217. rc = _add_users(slurmdbd_conn,
  218. in_buffer, out_buffer, uid);
  219. break;
  220. case DBD_ADD_WCKEYS:
  221. rc = _add_wckeys(slurmdbd_conn,
  222. in_buffer, out_buffer, uid);
  223. break;
  224. case DBD_ADD_RESV:
  225. rc = _add_reservation(slurmdbd_conn,
  226. in_buffer, out_buffer, uid);
  227. break;
  228. case DBD_ARCHIVE_DUMP:
  229. rc = _archive_dump(slurmdbd_conn,
  230. in_buffer, out_buffer, uid);
  231. break;
  232. case DBD_ARCHIVE_LOAD:
  233. rc = _archive_load(slurmdbd_conn,
  234. in_buffer, out_buffer, uid);
  235. break;
  236. case DBD_CLUSTER_CPUS:
  237. rc = _cluster_cpus(slurmdbd_conn,
  238. in_buffer, out_buffer, uid);
  239. break;
  240. case DBD_GET_ACCOUNTS:
  241. rc = _get_accounts(slurmdbd_conn,
  242. in_buffer, out_buffer, uid);
  243. break;
  244. case DBD_GET_ASSOCS:
  245. rc = _get_assocs(slurmdbd_conn,
  246. in_buffer, out_buffer, uid);
  247. break;
  248. case DBD_GET_ASSOC_USAGE:
  249. case DBD_GET_CLUSTER_USAGE:
  250. rc = _get_usage(msg_type, slurmdbd_conn,
  251. in_buffer, out_buffer, uid);
  252. break;
  253. case DBD_GET_CLUSTERS:
  254. rc = _get_clusters(slurmdbd_conn,
  255. in_buffer, out_buffer, uid);
  256. break;
  257. case DBD_GET_CONFIG:
  258. rc = _get_config(slurmdbd_conn,
  259. in_buffer, out_buffer, uid);
  260. break;
  261. case DBD_GET_EVENTS:
  262. rc = _get_events(slurmdbd_conn,
  263. in_buffer, out_buffer, uid);
  264. break;
  265. case DBD_GET_JOBS_COND:
  266. rc = _get_jobs_cond(slurmdbd_conn,
  267. in_buffer, out_buffer, uid);
  268. break;
  269. case DBD_GET_PROBS:
  270. rc = _get_probs(slurmdbd_conn,
  271. in_buffer, out_buffer, uid);
  272. break;
  273. case DBD_GET_QOS:
  274. rc = _get_qos(slurmdbd_conn,
  275. in_buffer, out_buffer, uid);
  276. break;
  277. case DBD_GET_TXN:
  278. rc = _get_txn(slurmdbd_conn,
  279. in_buffer, out_buffer, uid);
  280. break;
  281. case DBD_GET_WCKEYS:
  282. rc = _get_wckeys(slurmdbd_conn,
  283. in_buffer, out_buffer, uid);
  284. break;
  285. case DBD_GET_RESVS:
  286. rc = _get_reservations(slurmdbd_conn,
  287. in_buffer, out_buffer, uid);
  288. break;
  289. case DBD_GET_USERS:
  290. rc = _get_users(slurmdbd_conn,
  291. in_buffer, out_buffer, uid);
  292. break;
  293. case DBD_FLUSH_JOBS:
  294. rc = _flush_jobs(slurmdbd_conn,
  295. in_buffer, out_buffer, uid);
  296. break;
  297. case DBD_INIT:
  298. if (first)
  299. rc = _init_conn(slurmdbd_conn,
  300. in_buffer, out_buffer, uid);
  301. else {
  302. comment = "DBD_INIT sent after connection established";
  303. error("CONN:%u %s",
  304. slurmdbd_conn->newsockfd, comment);
  305. rc = EINVAL;
  306. *out_buffer = make_dbd_rc_msg(
  307. slurmdbd_conn->rpc_version, rc, comment,
  308. DBD_INIT);
  309. }
  310. break;
  311. case DBD_FINI:
  312. rc = _fini_conn(slurmdbd_conn, in_buffer, out_buffer);
  313. break;
  314. case DBD_JOB_COMPLETE:
  315. rc = _job_complete(slurmdbd_conn,
  316. in_buffer, out_buffer, uid);
  317. break;
  318. case DBD_JOB_START:
  319. rc = _job_start(slurmdbd_conn,
  320. in_buffer, out_buffer, uid);
  321. break;
  322. case DBD_JOB_SUSPEND:
  323. rc = _job_suspend(slurmdbd_conn,
  324. in_buffer, out_buffer, uid);
  325. break;
  326. case DBD_MODIFY_ACCOUNTS:
  327. rc = _modify_accounts(slurmdbd_conn,
  328. in_buffer, out_buffer, uid);
  329. break;
  330. case DBD_MODIFY_ASSOCS:
  331. rc = _modify_assocs(slurmdbd_conn,
  332. in_buffer, out_buffer, uid);
  333. break;
  334. case DBD_MODIFY_CLUSTERS:
  335. rc = _modify_clusters(slurmdbd_conn,
  336. in_buffer, out_buffer, uid);
  337. break;
  338. case DBD_MODIFY_JOB:
  339. rc = _modify_job(slurmdbd_conn,
  340. in_buffer, out_buffer, uid);
  341. break;
  342. case DBD_MODIFY_QOS:
  343. rc = _modify_qos(slurmdbd_conn,
  344. in_buffer, out_buffer, uid);
  345. break;
  346. case DBD_MODIFY_USERS:
  347. rc = _modify_users(slurmdbd_conn,
  348. in_buffer, out_buffer, uid);
  349. break;
  350. case DBD_MODIFY_WCKEYS:
  351. rc = _modify_wckeys(slurmdbd_conn,
  352. in_buffer, out_buffer, uid);
  353. break;
  354. case DBD_MODIFY_RESV:
  355. rc = _modify_reservation(slurmdbd_conn,
  356. in_buffer, out_buffer, uid);
  357. break;
  358. case DBD_NODE_STATE:
  359. rc = _node_state(slurmdbd_conn,
  360. in_buffer, out_buffer, uid);
  361. break;
  362. case DBD_REGISTER_CTLD:
  363. rc = _register_ctld(slurmdbd_conn, in_buffer,
  364. out_buffer, uid);
  365. break;
  366. case DBD_REMOVE_ACCOUNTS:
  367. rc = _remove_accounts(slurmdbd_conn,
  368. in_buffer, out_buffer, uid);
  369. break;
  370. case DBD_REMOVE_ACCOUNT_COORDS:
  371. rc = _remove_account_coords(slurmdbd_conn,
  372. in_buffer, out_buffer, uid);
  373. break;
  374. case DBD_REMOVE_ASSOCS:
  375. rc = _remove_assocs(slurmdbd_conn,
  376. in_buffer, out_buffer, uid);
  377. break;
  378. case DBD_REMOVE_CLUSTERS:
  379. rc = _remove_clusters(slurmdbd_conn,
  380. in_buffer, out_buffer, uid);
  381. break;
  382. case DBD_REMOVE_QOS:
  383. rc = _remove_qos(slurmdbd_conn,
  384. in_buffer, out_buffer, uid);
  385. break;
  386. case DBD_REMOVE_USERS:
  387. rc = _remove_users(slurmdbd_conn,
  388. in_buffer, out_buffer, uid);
  389. break;
  390. case DBD_REMOVE_WCKEYS:
  391. rc = _remove_wckeys(slurmdbd_conn,
  392. in_buffer, out_buffer, uid);
  393. break;
  394. case DBD_REMOVE_RESV:
  395. rc = _remove_reservation(slurmdbd_conn,
  396. in_buffer, out_buffer, uid);
  397. break;
  398. case DBD_ROLL_USAGE:
  399. rc = _roll_usage(slurmdbd_conn,
  400. in_buffer, out_buffer, uid);
  401. break;
  402. case DBD_SEND_MULT_JOB_START:
  403. rc = _send_mult_job_start(slurmdbd_conn,
  404. in_buffer, out_buffer, uid);
  405. break;
  406. case DBD_SEND_MULT_MSG:
  407. rc = _send_mult_msg(slurmdbd_conn,
  408. in_buffer, out_buffer, uid);
  409. break;
  410. case DBD_STEP_COMPLETE:
  411. rc = _step_complete(slurmdbd_conn,
  412. in_buffer, out_buffer, uid);
  413. break;
  414. case DBD_STEP_START:
  415. rc = _step_start(slurmdbd_conn,
  416. in_buffer, out_buffer, uid);
  417. break;
  418. case DBD_GET_JOBS:
  419. /* Defunct RPC */
  420. default:
  421. comment = "Invalid RPC";
  422. error("CONN:%u %s msg_type=%d",
  423. slurmdbd_conn->newsockfd, comment, msg_type);
  424. rc = EINVAL;
  425. *out_buffer = make_dbd_rc_msg(
  426. slurmdbd_conn->rpc_version, rc, comment, 0);
  427. break;
  428. }
  429. if (rc == ESLURM_ACCESS_DENIED)
  430. error("CONN:%u Security violation, %s",
  431. slurmdbd_conn->newsockfd,
  432. slurmdbd_msg_type_2_str(msg_type, 1));
  433. }
  434. xfer_buf_data(in_buffer); /* delete in_buffer struct without
  435. * xfree of msg */
  436. return rc;
  437. unpack_error:
  438. free_buf(in_buffer);
  439. return SLURM_ERROR;
  440. }
  441. /* replace \" with \` return is the same as what is given */
  442. static char * _replace_double_quotes(char *option)
  443. {
  444. int i=0;
  445. if (!option)
  446. return NULL;
  447. while (option[i]) {
  448. if (option[i] == '\"')
  449. option[i] = '`';
  450. i++;
  451. }
  452. return option;
  453. }
  454. static int _add_accounts(slurmdbd_conn_t *slurmdbd_conn,
  455. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  456. {
  457. int rc = SLURM_SUCCESS;
  458. dbd_list_msg_t *get_msg = NULL;
  459. char *comment = NULL;
  460. debug2("DBD_ADD_ACCOUNTS: called");
  461. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  462. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  463. < SLURMDB_ADMIN_OPERATOR) {
  464. slurmdb_user_rec_t user;
  465. memset(&user, 0, sizeof(slurmdb_user_rec_t));
  466. user.uid = *uid;
  467. if (assoc_mgr_fill_in_user(
  468. slurmdbd_conn->db_conn, &user, 1, NULL)
  469. != SLURM_SUCCESS) {
  470. comment = "Your user has not been added to the accounting system yet.";
  471. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  472. rc = SLURM_ERROR;
  473. goto end_it;
  474. }
  475. if (!user.coord_accts || !list_count(user.coord_accts)) {
  476. comment = "Your user doesn't have privilege to preform this action";
  477. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  478. rc = ESLURM_ACCESS_DENIED;
  479. goto end_it;
  480. }
  481. /* If the user is a coord of any acct they can add
  482. * accounts they are only able to make associations to
  483. * these accounts if they are coordinators of the
  484. * parent they are trying to add to
  485. */
  486. }
  487. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  488. DBD_ADD_ACCOUNTS, in_buffer) !=
  489. SLURM_SUCCESS) {
  490. comment = "Failed to unpack DBD_ADD_ACCOUNTS message";
  491. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  492. rc = SLURM_ERROR;
  493. goto end_it;
  494. }
  495. rc = acct_storage_g_add_accounts(slurmdbd_conn->db_conn, *uid,
  496. get_msg->my_list);
  497. end_it:
  498. slurmdbd_free_list_msg(get_msg);
  499. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  500. rc, comment, DBD_ADD_ACCOUNTS);
  501. return rc;
  502. }
  503. static int _add_account_coords(slurmdbd_conn_t *slurmdbd_conn,
  504. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  505. {
  506. int rc = SLURM_SUCCESS;
  507. dbd_acct_coord_msg_t *get_msg = NULL;
  508. char *comment = NULL;
  509. if (slurmdbd_unpack_acct_coord_msg(
  510. &get_msg, slurmdbd_conn->rpc_version, in_buffer)
  511. != SLURM_SUCCESS) {
  512. comment = "Failed to unpack DBD_ADD_ACCOUNT_COORDS message";
  513. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  514. rc = SLURM_ERROR;
  515. goto end_it;
  516. }
  517. debug2("DBD_ADD_ACCOUNT_COORDS: called");
  518. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  519. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  520. < SLURMDB_ADMIN_OPERATOR) {
  521. ListIterator itr = NULL;
  522. ListIterator itr2 = NULL;
  523. slurmdb_user_rec_t user;
  524. slurmdb_coord_rec_t *coord = NULL;
  525. char *acct = NULL;
  526. int bad = 0;
  527. memset(&user, 0, sizeof(slurmdb_user_rec_t));
  528. user.uid = *uid;
  529. if (assoc_mgr_fill_in_user(
  530. slurmdbd_conn->db_conn, &user, 1, NULL)
  531. != SLURM_SUCCESS) {
  532. comment = "Your user has not been added to the accounting system yet.";
  533. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  534. rc = SLURM_ERROR;
  535. goto end_it;
  536. }
  537. if (!user.coord_accts || !list_count(user.coord_accts)) {
  538. comment = "Your user doesn't have privilege to preform this action";
  539. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  540. rc = ESLURM_ACCESS_DENIED;
  541. goto end_it;
  542. }
  543. itr = list_iterator_create(get_msg->acct_list);
  544. itr2 = list_iterator_create(user.coord_accts);
  545. while ((acct = list_next(itr))) {
  546. while ((coord = list_next(itr2))) {
  547. if (!strcasecmp(coord->name, acct))
  548. break;
  549. }
  550. if (!coord) {
  551. bad = 1;
  552. break;
  553. }
  554. list_iterator_reset(itr2);
  555. }
  556. list_iterator_destroy(itr2);
  557. list_iterator_destroy(itr);
  558. if (bad) {
  559. comment = "Your user doesn't have privilege to preform this action";
  560. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  561. rc = ESLURM_ACCESS_DENIED;
  562. goto end_it;
  563. }
  564. }
  565. rc = acct_storage_g_add_coord(slurmdbd_conn->db_conn, *uid,
  566. get_msg->acct_list, get_msg->cond);
  567. end_it:
  568. slurmdbd_free_acct_coord_msg(get_msg);
  569. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  570. rc, comment, DBD_ADD_ACCOUNT_COORDS);
  571. return rc;
  572. }
  573. static int _add_assocs(slurmdbd_conn_t *slurmdbd_conn,
  574. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  575. {
  576. int rc = SLURM_SUCCESS;
  577. dbd_list_msg_t *get_msg = NULL;
  578. char *comment = NULL;
  579. debug2("DBD_ADD_ASSOCS: called");
  580. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  581. DBD_ADD_ASSOCS, in_buffer) !=
  582. SLURM_SUCCESS) {
  583. comment = "Failed to unpack DBD_ADD_ASSOCS message";
  584. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  585. rc = SLURM_ERROR;
  586. goto end_it;
  587. }
  588. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  589. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  590. < SLURMDB_ADMIN_OPERATOR) {
  591. ListIterator itr = NULL;
  592. ListIterator itr2 = NULL;
  593. slurmdb_user_rec_t user;
  594. slurmdb_coord_rec_t *coord = NULL;
  595. slurmdb_association_rec_t *object = NULL;
  596. memset(&user, 0, sizeof(slurmdb_user_rec_t));
  597. user.uid = *uid;
  598. if (assoc_mgr_fill_in_user(
  599. slurmdbd_conn->db_conn, &user, 1, NULL)
  600. != SLURM_SUCCESS) {
  601. comment = "Your user has not been added to the accounting system yet.";
  602. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  603. rc = SLURM_ERROR;
  604. goto end_it;
  605. }
  606. if (!user.coord_accts || !list_count(user.coord_accts)) {
  607. comment = "Your user doesn't have privilege to preform this action";
  608. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  609. rc = ESLURM_ACCESS_DENIED;
  610. goto end_it;
  611. }
  612. itr = list_iterator_create(get_msg->my_list);
  613. itr2 = list_iterator_create(user.coord_accts);
  614. while ((object = list_next(itr))) {
  615. char *account = "root";
  616. if (object->user)
  617. account = object->acct;
  618. else if (object->parent_acct)
  619. account = object->parent_acct;
  620. list_iterator_reset(itr2);
  621. while ((coord = list_next(itr2))) {
  622. if (!strcasecmp(coord->name, account))
  623. break;
  624. }
  625. if (!coord)
  626. break;
  627. }
  628. list_iterator_destroy(itr2);
  629. list_iterator_destroy(itr);
  630. if (!coord) {
  631. comment = "Your user doesn't have privilege to preform this action";
  632. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  633. rc = ESLURM_ACCESS_DENIED;
  634. goto end_it;
  635. }
  636. }
  637. rc = acct_storage_g_add_associations(slurmdbd_conn->db_conn, *uid,
  638. get_msg->my_list);
  639. end_it:
  640. slurmdbd_free_list_msg(get_msg);
  641. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  642. rc, comment, DBD_ADD_ASSOCS);
  643. return rc;
  644. }
  645. static int _add_clusters(slurmdbd_conn_t *slurmdbd_conn,
  646. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  647. {
  648. int rc = SLURM_SUCCESS;
  649. dbd_list_msg_t *get_msg = NULL;
  650. char *comment = NULL;
  651. debug2("DBD_ADD_CLUSTERS: called");
  652. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  653. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  654. < SLURMDB_ADMIN_SUPER_USER) {
  655. comment = "Your user doesn't have privilege to preform this action";
  656. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  657. rc = ESLURM_ACCESS_DENIED;
  658. goto end_it;
  659. }
  660. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  661. DBD_ADD_CLUSTERS, in_buffer) !=
  662. SLURM_SUCCESS) {
  663. comment = "Failed to unpack DBD_ADD_CLUSTERS message";
  664. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  665. rc = SLURM_ERROR;
  666. goto end_it;
  667. }
  668. rc = acct_storage_g_add_clusters(slurmdbd_conn->db_conn, *uid,
  669. get_msg->my_list);
  670. if (rc != SLURM_SUCCESS)
  671. comment = "Failed to add cluster.";
  672. end_it:
  673. slurmdbd_free_list_msg(get_msg);
  674. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  675. rc, comment, DBD_ADD_CLUSTERS);
  676. return rc;
  677. }
  678. static int _add_qos(slurmdbd_conn_t *slurmdbd_conn,
  679. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  680. {
  681. int rc = SLURM_SUCCESS;
  682. dbd_list_msg_t *get_msg = NULL;
  683. char *comment = NULL;
  684. debug2("DBD_ADD_QOS: called");
  685. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  686. && (assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  687. < SLURMDB_ADMIN_SUPER_USER)) {
  688. comment = "Your user doesn't have privilege to preform this action";
  689. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  690. rc = ESLURM_ACCESS_DENIED;
  691. goto end_it;
  692. }
  693. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  694. DBD_ADD_QOS, in_buffer) !=
  695. SLURM_SUCCESS) {
  696. comment = "Failed to unpack DBD_ADD_QOS message";
  697. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  698. rc = SLURM_ERROR;
  699. goto end_it;
  700. }
  701. rc = acct_storage_g_add_qos(slurmdbd_conn->db_conn, *uid,
  702. get_msg->my_list);
  703. if (rc != SLURM_SUCCESS)
  704. comment = "Failed to add qos.";
  705. end_it:
  706. slurmdbd_free_list_msg(get_msg);
  707. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  708. rc, comment, DBD_ADD_QOS);
  709. return rc;
  710. }
  711. static int _add_users(slurmdbd_conn_t *slurmdbd_conn,
  712. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  713. {
  714. int rc = SLURM_SUCCESS;
  715. dbd_list_msg_t *get_msg = NULL;
  716. char *comment = NULL;
  717. debug2("DBD_ADD_USERS: called");
  718. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  719. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  720. < SLURMDB_ADMIN_OPERATOR) {
  721. slurmdb_user_rec_t user;
  722. memset(&user, 0, sizeof(slurmdb_user_rec_t));
  723. user.uid = *uid;
  724. if (assoc_mgr_fill_in_user(
  725. slurmdbd_conn->db_conn, &user, 1, NULL)
  726. != SLURM_SUCCESS) {
  727. comment = "Your user has not been added to the accounting system yet.";
  728. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  729. rc = SLURM_ERROR;
  730. goto end_it;
  731. }
  732. if (!user.coord_accts || !list_count(user.coord_accts)) {
  733. comment = "Your user doesn't have privilege to preform this action";
  734. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  735. rc = ESLURM_ACCESS_DENIED;
  736. goto end_it;
  737. }
  738. /* If the user is a coord of any acct they can add
  739. * users they are only able to make associations to
  740. * these users if they are coordinators of the
  741. * account they are trying to add to
  742. */
  743. }
  744. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  745. DBD_ADD_USERS, in_buffer) !=
  746. SLURM_SUCCESS) {
  747. comment = "Failed to unpack DBD_ADD_USERS message";
  748. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  749. rc = SLURM_ERROR;
  750. goto end_it;
  751. }
  752. rc = acct_storage_g_add_users(slurmdbd_conn->db_conn, *uid,
  753. get_msg->my_list);
  754. end_it:
  755. slurmdbd_free_list_msg(get_msg);
  756. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  757. rc, comment, DBD_ADD_USERS);
  758. return rc;
  759. }
  760. static int _add_wckeys(slurmdbd_conn_t *slurmdbd_conn,
  761. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  762. {
  763. int rc = SLURM_SUCCESS;
  764. dbd_list_msg_t *get_msg = NULL;
  765. char *comment = NULL;
  766. debug2("DBD_ADD_WCKEYS: called");
  767. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  768. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  769. < SLURMDB_ADMIN_SUPER_USER) {
  770. comment = "Your user doesn't have privilege to preform this action";
  771. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  772. rc = ESLURM_ACCESS_DENIED;
  773. goto end_it;
  774. }
  775. if (slurmdbd_unpack_list_msg(&get_msg, slurmdbd_conn->rpc_version,
  776. DBD_ADD_WCKEYS, in_buffer) !=
  777. SLURM_SUCCESS) {
  778. comment = "Failed to unpack DBD_ADD_WCKEYS message";
  779. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  780. rc = SLURM_ERROR;
  781. goto end_it;
  782. }
  783. rc = acct_storage_g_add_wckeys(slurmdbd_conn->db_conn, *uid,
  784. get_msg->my_list);
  785. end_it:
  786. slurmdbd_free_list_msg(get_msg);
  787. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  788. rc, comment, DBD_ADD_WCKEYS);
  789. return rc;
  790. }
  791. static int _add_reservation(slurmdbd_conn_t *slurmdbd_conn,
  792. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  793. {
  794. int rc = SLURM_SUCCESS;
  795. dbd_rec_msg_t *rec_msg = NULL;
  796. char *comment = NULL;
  797. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)) {
  798. comment = "DBD_ADD_RESV message from invalid uid";
  799. error("DBD_ADD_RESV message from invalid uid %u", *uid);
  800. rc = ESLURM_ACCESS_DENIED;
  801. goto end_it;
  802. }
  803. if (slurmdbd_unpack_rec_msg(&rec_msg, slurmdbd_conn->rpc_version,
  804. DBD_ADD_RESV, in_buffer) != SLURM_SUCCESS) {
  805. comment = "Failed to unpack DBD_ADD_RESV message";
  806. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  807. rc = SLURM_ERROR;
  808. goto end_it;
  809. }
  810. debug2("DBD_ADD_RESV: called");
  811. rc = acct_storage_g_add_reservation(slurmdbd_conn->db_conn,
  812. rec_msg->rec);
  813. end_it:
  814. slurmdbd_free_rec_msg(rec_msg, DBD_ADD_RESV);
  815. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  816. rc, comment, DBD_ADD_RESV);
  817. return rc;
  818. }
  819. static int _archive_dump(slurmdbd_conn_t *slurmdbd_conn,
  820. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  821. {
  822. int rc = SLURM_SUCCESS;
  823. dbd_cond_msg_t *get_msg = NULL;
  824. char *comment = "SUCCESS";
  825. slurmdb_archive_cond_t *arch_cond = NULL;
  826. debug2("DBD_ARCHIVE_DUMP: called");
  827. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  828. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  829. < SLURMDB_ADMIN_SUPER_USER) {
  830. comment = "Your user doesn't have privilege to preform this action";
  831. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  832. rc = ESLURM_ACCESS_DENIED;
  833. goto end_it;
  834. }
  835. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  836. DBD_ARCHIVE_DUMP, in_buffer) !=
  837. SLURM_SUCCESS) {
  838. comment = "Failed to unpack DBD_ARCHIVE_DUMP message";
  839. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  840. rc = SLURM_ERROR;
  841. goto end_it;
  842. }
  843. arch_cond = (slurmdb_archive_cond_t *)get_msg->cond;
  844. /* set up some defaults */
  845. if (!arch_cond->archive_dir)
  846. arch_cond->archive_dir = xstrdup(slurmdbd_conf->archive_dir);
  847. if (!arch_cond->archive_script)
  848. arch_cond->archive_script =
  849. xstrdup(slurmdbd_conf->archive_script);
  850. if (arch_cond->purge_event == NO_VAL)
  851. arch_cond->purge_event = slurmdbd_conf->purge_event;
  852. if (arch_cond->purge_job == NO_VAL)
  853. arch_cond->purge_job = slurmdbd_conf->purge_job;
  854. if (arch_cond->purge_step == NO_VAL)
  855. arch_cond->purge_step = slurmdbd_conf->purge_step;
  856. if (arch_cond->purge_suspend == NO_VAL)
  857. arch_cond->purge_suspend = slurmdbd_conf->purge_suspend;
  858. rc = jobacct_storage_g_archive(slurmdbd_conn->db_conn, arch_cond);
  859. if (rc != SLURM_SUCCESS) {
  860. if (errno == EACCES)
  861. comment = "Problem accessing file.";
  862. else
  863. comment = "Error with request.";
  864. }
  865. end_it:
  866. slurmdbd_free_cond_msg(get_msg, DBD_ARCHIVE_DUMP);
  867. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  868. rc, comment, DBD_ARCHIVE_DUMP);
  869. return rc;
  870. }
  871. static int _archive_load(slurmdbd_conn_t *slurmdbd_conn,
  872. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  873. {
  874. int rc = SLURM_SUCCESS;
  875. slurmdb_archive_rec_t *arch_rec = NULL;
  876. char *comment = "SUCCESS";
  877. debug2("DBD_ARCHIVE_LOAD: called");
  878. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  879. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  880. < SLURMDB_ADMIN_SUPER_USER) {
  881. comment = "Your user doesn't have privilege to preform this action";
  882. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  883. rc = ESLURM_ACCESS_DENIED;
  884. goto end_it;
  885. }
  886. if (slurmdb_unpack_archive_rec((void *)&arch_rec,
  887. slurmdbd_conn->rpc_version,
  888. in_buffer) != SLURM_SUCCESS) {
  889. comment = "Failed to unpack DBD_ARCHIVE_LOAD message";
  890. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  891. rc = SLURM_ERROR;
  892. goto end_it;
  893. }
  894. rc = jobacct_storage_g_archive_load(slurmdbd_conn->db_conn, arch_rec);
  895. if (rc == ENOENT)
  896. comment = "No archive file given to recover.";
  897. else if (rc != SLURM_SUCCESS)
  898. comment = "Error with request.";
  899. end_it:
  900. slurmdb_destroy_archive_rec(arch_rec);
  901. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  902. rc, comment, DBD_ARCHIVE_LOAD);
  903. return rc;
  904. }
  905. static int _cluster_cpus(slurmdbd_conn_t *slurmdbd_conn,
  906. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  907. {
  908. dbd_cluster_cpus_msg_t *cluster_cpus_msg = NULL;
  909. int rc = SLURM_SUCCESS;
  910. char *comment = NULL;
  911. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)) {
  912. comment = "DBD_CLUSTER_CPUS message from invalid uid";
  913. error("DBD_CLUSTER_CPUS message from invalid uid %u", *uid);
  914. rc = ESLURM_ACCESS_DENIED;
  915. goto end_it;
  916. }
  917. if (slurmdbd_unpack_cluster_cpus_msg(&cluster_cpus_msg,
  918. slurmdbd_conn->rpc_version,
  919. in_buffer) !=
  920. SLURM_SUCCESS) {
  921. comment = "Failed to unpack DBD_CLUSTER_CPUS message";
  922. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  923. rc = SLURM_ERROR;
  924. goto end_it;
  925. }
  926. debug2("DBD_CLUSTER_CPUS: called for %s(%u)",
  927. slurmdbd_conn->cluster_name,
  928. cluster_cpus_msg->cpu_count);
  929. rc = clusteracct_storage_g_cluster_cpus(
  930. slurmdbd_conn->db_conn,
  931. cluster_cpus_msg->cluster_nodes,
  932. cluster_cpus_msg->cpu_count,
  933. cluster_cpus_msg->event_time);
  934. if (rc == ESLURM_ACCESS_DENIED) {
  935. comment = "This cluster hasn't been added to accounting yet";
  936. rc = SLURM_ERROR;
  937. }
  938. end_it:
  939. if (rc == SLURM_SUCCESS)
  940. slurmdbd_conn->cluster_cpus = cluster_cpus_msg->cpu_count;
  941. if (!slurmdbd_conn->ctld_port) {
  942. info("DBD_CLUSTER_CPUS: cluster not registered");
  943. slurmdbd_conn->ctld_port =
  944. clusteracct_storage_g_register_disconn_ctld(
  945. slurmdbd_conn->db_conn, slurmdbd_conn->ip);
  946. }
  947. slurmdbd_free_cluster_cpus_msg(cluster_cpus_msg);
  948. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  949. rc, comment, DBD_CLUSTER_CPUS);
  950. return rc;
  951. }
  952. static int _get_accounts(slurmdbd_conn_t *slurmdbd_conn,
  953. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  954. {
  955. dbd_cond_msg_t *get_msg = NULL;
  956. dbd_list_msg_t list_msg;
  957. char *comment = NULL;
  958. int rc = SLURM_SUCCESS;
  959. debug2("DBD_GET_ACCOUNTS: called");
  960. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  961. DBD_GET_ACCOUNTS, in_buffer) !=
  962. SLURM_SUCCESS) {
  963. comment = "Failed to unpack DBD_GET_ACCOUNTS message";
  964. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  965. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  966. SLURM_ERROR, comment,
  967. DBD_GET_ACCOUNTS);
  968. return SLURM_ERROR;
  969. }
  970. list_msg.my_list = acct_storage_g_get_accounts(slurmdbd_conn->db_conn,
  971. *uid, get_msg->cond);
  972. if (!errno) {
  973. if (!list_msg.my_list)
  974. list_msg.my_list = list_create(NULL);
  975. *out_buffer = init_buf(1024);
  976. pack16((uint16_t) DBD_GOT_ACCOUNTS, *out_buffer);
  977. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  978. DBD_GOT_ACCOUNTS,
  979. *out_buffer);
  980. } else {
  981. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  982. errno, slurm_strerror(errno),
  983. DBD_GET_ACCOUNTS);
  984. rc = SLURM_ERROR;
  985. }
  986. slurmdbd_free_cond_msg(get_msg, DBD_GET_ACCOUNTS);
  987. if (list_msg.my_list)
  988. list_destroy(list_msg.my_list);
  989. return rc;
  990. }
  991. static int _get_assocs(slurmdbd_conn_t *slurmdbd_conn,
  992. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  993. {
  994. dbd_cond_msg_t *get_msg = NULL;
  995. dbd_list_msg_t list_msg;
  996. char *comment = NULL;
  997. int rc = SLURM_SUCCESS;
  998. debug2("DBD_GET_ASSOCS: called");
  999. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  1000. DBD_GET_ASSOCS, in_buffer) !=
  1001. SLURM_SUCCESS) {
  1002. comment = "Failed to unpack DBD_GET_ASSOCS message";
  1003. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1004. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1005. SLURM_ERROR, comment,
  1006. DBD_GET_ASSOCS);
  1007. return SLURM_ERROR;
  1008. }
  1009. list_msg.my_list = acct_storage_g_get_associations(
  1010. slurmdbd_conn->db_conn, *uid, get_msg->cond);
  1011. if (!errno) {
  1012. if (!list_msg.my_list)
  1013. list_msg.my_list = list_create(NULL);
  1014. *out_buffer = init_buf(1024);
  1015. pack16((uint16_t) DBD_GOT_ASSOCS, *out_buffer);
  1016. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1017. DBD_GOT_ASSOCS, *out_buffer);
  1018. } else {
  1019. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1020. errno, slurm_strerror(errno),
  1021. DBD_GET_ASSOCS);
  1022. rc = SLURM_ERROR;
  1023. }
  1024. slurmdbd_free_cond_msg(get_msg, DBD_GET_ASSOCS);
  1025. if (list_msg.my_list)
  1026. list_destroy(list_msg.my_list);
  1027. return rc;
  1028. }
  1029. static int _get_clusters(slurmdbd_conn_t *slurmdbd_conn,
  1030. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1031. {
  1032. dbd_cond_msg_t *get_msg = NULL;
  1033. dbd_list_msg_t list_msg;
  1034. char *comment = NULL;
  1035. int rc = SLURM_SUCCESS;
  1036. debug2("DBD_GET_CLUSTERS: called");
  1037. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  1038. DBD_GET_CLUSTERS, in_buffer) !=
  1039. SLURM_SUCCESS) {
  1040. comment = "Failed to unpack DBD_GET_CLUSTERS message";
  1041. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1042. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1043. SLURM_ERROR, comment,
  1044. DBD_GET_CLUSTERS);
  1045. return SLURM_ERROR;
  1046. }
  1047. list_msg.my_list = acct_storage_g_get_clusters(
  1048. slurmdbd_conn->db_conn, *uid, get_msg->cond);
  1049. if (!errno) {
  1050. if (!list_msg.my_list)
  1051. list_msg.my_list = list_create(NULL);
  1052. *out_buffer = init_buf(1024);
  1053. pack16((uint16_t) DBD_GOT_CLUSTERS, *out_buffer);
  1054. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1055. DBD_GOT_CLUSTERS,
  1056. *out_buffer);
  1057. } else {
  1058. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1059. errno, slurm_strerror(errno),
  1060. DBD_GET_CLUSTERS);
  1061. rc = SLURM_ERROR;
  1062. }
  1063. slurmdbd_free_cond_msg(get_msg, DBD_GET_CLUSTERS);
  1064. if (list_msg.my_list)
  1065. list_destroy(list_msg.my_list);
  1066. return rc;
  1067. }
  1068. static int _unpack_config_name(char **object, Buf buffer)
  1069. {
  1070. char *config_name;
  1071. uint32_t uint32_tmp;
  1072. safe_unpackstr_xmalloc(&config_name, &uint32_tmp, buffer);
  1073. *object = config_name;
  1074. return SLURM_SUCCESS;
  1075. unpack_error:
  1076. *object = NULL;
  1077. return SLURM_ERROR;
  1078. }
  1079. static int _get_config(slurmdbd_conn_t *slurmdbd_conn,
  1080. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1081. {
  1082. char *config_name = NULL;
  1083. dbd_list_msg_t list_msg = { NULL };
  1084. debug2("DBD_GET_CONFIG: called");
  1085. if (slurmdbd_conn->rpc_version >= 10 &&
  1086. _unpack_config_name(&config_name, in_buffer) != SLURM_SUCCESS) {
  1087. char *comment = "Failed to unpack DBD_GET_CONFIG message";
  1088. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1089. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1090. SLURM_ERROR, comment,
  1091. DBD_GET_CONFIG);
  1092. return SLURM_ERROR;
  1093. }
  1094. if (config_name == NULL ||
  1095. strcmp(config_name, "slurmdbd.conf") == 0)
  1096. list_msg.my_list = dump_config();
  1097. else if ((list_msg.my_list = acct_storage_g_get_config(
  1098. slurmdbd_conn->db_conn, config_name)) == NULL) {
  1099. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1100. errno, slurm_strerror(errno),
  1101. DBD_GET_CONFIG);
  1102. xfree(config_name);
  1103. return SLURM_ERROR;
  1104. }
  1105. *out_buffer = init_buf(1024);
  1106. pack16((uint16_t) DBD_GOT_CONFIG, *out_buffer);
  1107. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1108. DBD_GOT_CONFIG, *out_buffer);
  1109. if (list_msg.my_list)
  1110. list_destroy(list_msg.my_list);
  1111. xfree(config_name);
  1112. return SLURM_SUCCESS;
  1113. }
  1114. static int _get_events(slurmdbd_conn_t *slurmdbd_conn,
  1115. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1116. {
  1117. dbd_cond_msg_t *get_msg = NULL;
  1118. dbd_list_msg_t list_msg;
  1119. char *comment = NULL;
  1120. int rc = SLURM_SUCCESS;
  1121. debug2("DBD_GET_EVENTS: called");
  1122. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  1123. DBD_GET_EVENTS, in_buffer) !=
  1124. SLURM_SUCCESS) {
  1125. comment = "Failed to unpack DBD_GET_EVENTS message";
  1126. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1127. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1128. SLURM_ERROR, comment,
  1129. DBD_GET_EVENTS);
  1130. return SLURM_ERROR;
  1131. }
  1132. list_msg.my_list = acct_storage_g_get_events(
  1133. slurmdbd_conn->db_conn, *uid, get_msg->cond);
  1134. if (!errno) {
  1135. if (!list_msg.my_list)
  1136. list_msg.my_list = list_create(NULL);
  1137. *out_buffer = init_buf(1024);
  1138. pack16((uint16_t) DBD_GOT_EVENTS, *out_buffer);
  1139. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1140. DBD_GOT_EVENTS,
  1141. *out_buffer);
  1142. } else {
  1143. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1144. errno, slurm_strerror(errno),
  1145. DBD_GET_EVENTS);
  1146. rc = SLURM_ERROR;
  1147. }
  1148. slurmdbd_free_cond_msg(get_msg, DBD_GET_EVENTS);
  1149. if (list_msg.my_list)
  1150. list_destroy(list_msg.my_list);
  1151. return rc;
  1152. }
  1153. static int _get_jobs_cond(slurmdbd_conn_t *slurmdbd_conn,
  1154. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1155. {
  1156. dbd_cond_msg_t *cond_msg = NULL;
  1157. dbd_list_msg_t list_msg;
  1158. char *comment = NULL;
  1159. int rc = SLURM_SUCCESS;
  1160. debug2("DBD_GET_JOBS_COND: called");
  1161. if (slurmdbd_unpack_cond_msg(&cond_msg, slurmdbd_conn->rpc_version,
  1162. DBD_GET_JOBS_COND, in_buffer) !=
  1163. SLURM_SUCCESS) {
  1164. comment = "Failed to unpack DBD_GET_JOBS_COND message";
  1165. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1166. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1167. SLURM_ERROR, comment,
  1168. DBD_GET_JOBS_COND);
  1169. return SLURM_ERROR;
  1170. }
  1171. list_msg.my_list = jobacct_storage_g_get_jobs_cond(
  1172. slurmdbd_conn->db_conn, *uid, cond_msg->cond);
  1173. if (!errno) {
  1174. if (!list_msg.my_list)
  1175. list_msg.my_list = list_create(NULL);
  1176. *out_buffer = init_buf(1024);
  1177. pack16((uint16_t) DBD_GOT_JOBS, *out_buffer);
  1178. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1179. DBD_GOT_JOBS, *out_buffer);
  1180. } else {
  1181. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1182. errno, slurm_strerror(errno),
  1183. DBD_GET_JOBS_COND);
  1184. rc = SLURM_ERROR;
  1185. }
  1186. slurmdbd_free_cond_msg(cond_msg, DBD_GET_JOBS_COND);
  1187. if (list_msg.my_list)
  1188. list_destroy(list_msg.my_list);
  1189. return rc;
  1190. }
  1191. static int _get_probs(slurmdbd_conn_t *slurmdbd_conn,
  1192. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1193. {
  1194. dbd_cond_msg_t *get_msg = NULL;
  1195. dbd_list_msg_t list_msg;
  1196. char *comment = NULL;
  1197. int rc = SLURM_SUCCESS;
  1198. debug2("DBD_GET_PROBS: called");
  1199. if ((*uid != slurmdbd_conf->slurm_user_id && *uid != 0)
  1200. && assoc_mgr_get_admin_level(slurmdbd_conn->db_conn, *uid)
  1201. < SLURMDB_ADMIN_OPERATOR) {
  1202. comment = "Your user doesn't have privilege to preform this action";
  1203. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1204. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1205. ESLURM_ACCESS_DENIED,
  1206. comment, DBD_GET_PROBS);
  1207. return ESLURM_ACCESS_DENIED;
  1208. }
  1209. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  1210. DBD_GET_PROBS, in_buffer) !=
  1211. SLURM_SUCCESS) {
  1212. comment = "Failed to unpack DBD_GET_PROBS message";
  1213. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1214. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1215. SLURM_ERROR, comment,
  1216. DBD_GET_PROBS);
  1217. return SLURM_ERROR;
  1218. }
  1219. list_msg.my_list = acct_storage_g_get_problems(
  1220. slurmdbd_conn->db_conn, *uid, get_msg->cond);
  1221. if (!errno) {
  1222. if (!list_msg.my_list)
  1223. list_msg.my_list = list_create(NULL);
  1224. *out_buffer = init_buf(1024);
  1225. pack16((uint16_t) DBD_GOT_PROBS, *out_buffer);
  1226. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1227. DBD_GOT_PROBS, *out_buffer);
  1228. } else {
  1229. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1230. errno, slurm_strerror(errno),
  1231. DBD_GET_PROBS);
  1232. rc = SLURM_ERROR;
  1233. }
  1234. slurmdbd_free_cond_msg(get_msg, DBD_GET_PROBS);
  1235. if (list_msg.my_list)
  1236. list_destroy(list_msg.my_list);
  1237. return rc;
  1238. }
  1239. static int _get_qos(slurmdbd_conn_t *slurmdbd_conn,
  1240. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1241. {
  1242. dbd_cond_msg_t *cond_msg = NULL;
  1243. dbd_list_msg_t list_msg;
  1244. char *comment = NULL;
  1245. int rc = SLURM_SUCCESS;
  1246. debug2("DBD_GET_QOS: called");
  1247. if (slurmdbd_unpack_cond_msg(&cond_msg, slurmdbd_conn->rpc_version,
  1248. DBD_GET_QOS, in_buffer) !=
  1249. SLURM_SUCCESS) {
  1250. comment = "Failed to unpack DBD_GET_QOS message";
  1251. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1252. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1253. SLURM_ERROR, comment,
  1254. DBD_GET_QOS);
  1255. return SLURM_ERROR;
  1256. }
  1257. list_msg.my_list = acct_storage_g_get_qos(slurmdbd_conn->db_conn, *uid,
  1258. cond_msg->cond);
  1259. if (errno == ESLURM_ACCESS_DENIED && !list_msg.my_list)
  1260. list_msg.my_list = list_create(NULL);
  1261. if (!errno) {
  1262. if (!list_msg.my_list)
  1263. list_msg.my_list = list_create(NULL);
  1264. *out_buffer = init_buf(1024);
  1265. pack16((uint16_t) DBD_GOT_QOS, *out_buffer);
  1266. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1267. DBD_GOT_QOS, *out_buffer);
  1268. } else {
  1269. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1270. errno, slurm_strerror(errno),
  1271. DBD_GET_QOS);
  1272. rc = SLURM_ERROR;
  1273. }
  1274. slurmdbd_free_cond_msg(cond_msg, DBD_GET_QOS);
  1275. if (list_msg.my_list)
  1276. list_destroy(list_msg.my_list);
  1277. return rc;
  1278. }
  1279. static int _get_txn(slurmdbd_conn_t *slurmdbd_conn,
  1280. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1281. {
  1282. dbd_cond_msg_t *cond_msg = NULL;
  1283. dbd_list_msg_t list_msg;
  1284. char *comment = NULL;
  1285. int rc = SLURM_SUCCESS;
  1286. debug2("DBD_GET_TXN: called");
  1287. if (slurmdbd_unpack_cond_msg(&cond_msg, slurmdbd_conn->rpc_version,
  1288. DBD_GET_TXN, in_buffer) !=
  1289. SLURM_SUCCESS) {
  1290. comment = "Failed to unpack DBD_GET_TXN message";
  1291. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1292. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1293. SLURM_ERROR, comment,
  1294. DBD_GET_TXN);
  1295. return SLURM_ERROR;
  1296. }
  1297. list_msg.my_list = acct_storage_g_get_txn(slurmdbd_conn->db_conn, *uid,
  1298. cond_msg->cond);
  1299. if (!errno) {
  1300. if (!list_msg.my_list)
  1301. list_msg.my_list = list_create(NULL);
  1302. *out_buffer = init_buf(1024);
  1303. pack16((uint16_t) DBD_GOT_TXN, *out_buffer);
  1304. slurmdbd_pack_list_msg(&list_msg, slurmdbd_conn->rpc_version,
  1305. DBD_GOT_TXN, *out_buffer);
  1306. } else {
  1307. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1308. errno, slurm_strerror(errno),
  1309. DBD_GET_TXN);
  1310. rc = SLURM_ERROR;
  1311. }
  1312. slurmdbd_free_cond_msg(cond_msg, DBD_GET_TXN);
  1313. if (list_msg.my_list)
  1314. list_destroy(list_msg.my_list);
  1315. return rc;
  1316. }
  1317. static int _get_usage(uint16_t type, slurmdbd_conn_t *slurmdbd_conn,
  1318. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1319. {
  1320. dbd_usage_msg_t *get_msg = NULL;
  1321. dbd_usage_msg_t got_msg;
  1322. uint16_t ret_type = 0;
  1323. int rc = SLURM_SUCCESS;
  1324. char *comment = NULL;
  1325. info("DBD_GET_USAGE: called type is %s",
  1326. slurmdbd_msg_type_2_str(type, 1));
  1327. if (slurmdbd_unpack_usage_msg(&get_msg, slurmdbd_conn->rpc_version,
  1328. type, in_buffer) !=
  1329. SLURM_SUCCESS) {
  1330. comment = "Failed to unpack DBD_GET_USAGE message";
  1331. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1332. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1333. SLURM_ERROR, comment, type);
  1334. return SLURM_ERROR;
  1335. }
  1336. switch(type) {
  1337. case DBD_GET_ASSOC_USAGE:
  1338. ret_type = DBD_GOT_ASSOC_USAGE;
  1339. break;
  1340. case DBD_GET_WCKEY_USAGE:
  1341. ret_type = DBD_GOT_WCKEY_USAGE;
  1342. break;
  1343. case DBD_GET_CLUSTER_USAGE:
  1344. ret_type = DBD_GOT_CLUSTER_USAGE;
  1345. break;
  1346. default:
  1347. comment = "Unknown type of usage to get";
  1348. error("%s %u", comment, type);
  1349. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1350. SLURM_ERROR, comment, type);
  1351. return SLURM_ERROR;
  1352. }
  1353. rc = acct_storage_g_get_usage(slurmdbd_conn->db_conn,
  1354. *uid, get_msg->rec, type,
  1355. get_msg->start, get_msg->end);
  1356. slurmdbd_free_usage_msg(get_msg, type);
  1357. if (rc != SLURM_SUCCESS) {
  1358. comment = "Problem getting usage info";
  1359. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1360. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1361. rc, comment, type);
  1362. return rc;
  1363. }
  1364. memset(&got_msg, 0, sizeof(dbd_usage_msg_t));
  1365. got_msg.rec = get_msg->rec;
  1366. get_msg->rec = NULL;
  1367. *out_buffer = init_buf(1024);
  1368. pack16((uint16_t) ret_type, *out_buffer);
  1369. slurmdbd_pack_usage_msg(&got_msg, slurmdbd_conn->rpc_version,
  1370. ret_type, *out_buffer);
  1371. return SLURM_SUCCESS;
  1372. }
  1373. static int _get_users(slurmdbd_conn_t *slurmdbd_conn,
  1374. Buf in_buffer, Buf *out_buffer, uint32_t *uid)
  1375. {
  1376. dbd_cond_msg_t *get_msg = NULL;
  1377. dbd_list_msg_t list_msg;
  1378. char *comment = NULL;
  1379. int rc = SLURM_SUCCESS;
  1380. slurmdb_user_cond_t * user_cond = NULL;
  1381. debug2("DBD_GET_USERS: called");
  1382. if (slurmdbd_unpack_cond_msg(&get_msg, slurmdbd_conn->rpc_version,
  1383. DBD_GET_USERS, in_buffer) !=
  1384. SLURM_SUCCESS) {
  1385. comment = "Failed to unpack DBD_GET_USERS message";
  1386. error("CONN:%u %s", slurmdbd_conn->newsockfd, comment);
  1387. *out_buffer = make_dbd_rc_msg(slurmdbd_conn->rpc_version,
  1388. SLURM_ERROR, comment,
  1389. DBD_GET_USERS);
  1390. return SLURM_ERROR;
  1391. }
  1392. user_cond = get_msg->cond;
  1393. if ((!user_cond->with_assocs && !user_cond->with_wckeys)
  1394. && ((slurmdbd_conn->rpc_version < 8)
  1395. || (user_cond->assoc_cond->only_defs))) {
  1396. List cluster_list = user_cond->assoc_cond->cluster_list;
  1397. /* load up with just this cluster to query against
  1398. * since befor 2.2 we had only 1 default account so
  1399. * send the default for this cluster. */
  1400. if (!cluster_list) {
  1401. cluster_list = list_create(NULL);
  1402. list_append(cluster_list, slurmdbd_conn->cluster_name);
  1403. user_cond->assoc_cond->cluster_list = cluster_list;
  1404. }
  1405. }
  1406. list_msg.my_list = acct_storage_g_get_users(slurmdbd_conn->db_conn,
  1407. *uid, user_cond);
  1408. if (!errno) {
  1409. if (!list_msg.my_list)
  1410. list_msg.my_list = list_create(NULL);
  1411. *out_buffer = init_buf(1024);
  1412. pack16((uint16_t) DBD_GOT_USERS, *out_buffer);
  1413. slurmdbd_pac

Large files files are truncated, but you can click here to view the full file