/* main - slurmctld main function, start various threads and process RPCs */ int main(int argc, char *argv[]) { pthread_attr_t thread_attr; char node_name[128]; void *db_conn = NULL; assoc_init_args_t assoc_init_arg; _init_config(); log_init(argv[0], log_opts, LOG_DAEMON, NULL); if (read_slurmdbd_conf()) exit(1); _parse_commandline(argc, argv); _update_logging(true); _update_nice(); if (slurm_auth_init(NULL) != SLURM_SUCCESS) { fatal("Unable to initialize %s authentication plugin", slurmdbd_conf->auth_type); } if (slurm_acct_storage_init(NULL) != SLURM_SUCCESS) { fatal("Unable to initialize %s accounting storage plugin", slurmdbd_conf->storage_type); } _kill_old_slurmdbd(); if (foreground == 0) _daemonize(); /* * Need to create pidfile here in case we setuid() below * (init_pidfile() exits if it can't initialize pid file). * On Linux we also need to make this setuid job explicitly * able to write a core dump. * This also has to happen after daemon(), which closes all fd's, * so we keep the write lock of the pidfile. */ _init_pidfile(); _become_slurm_user(); if (foreground == 0) _set_work_dir(); log_config(); #ifdef PR_SET_DUMPABLE if (prctl(PR_SET_DUMPABLE, 1) < 0) debug ("Unable to set dumpable to 1"); #endif /* PR_SET_DUMPABLE */ if (xsignal_block(dbd_sigarray) < 0) error("Unable to block signals"); /* Create attached thread for signal handling */ slurm_attr_init(&thread_attr); if (pthread_create(&signal_handler_thread, &thread_attr, _signal_handler, NULL)) fatal("pthread_create %m"); slurm_attr_destroy(&thread_attr); registered_clusters = list_create(NULL); slurm_attr_init(&thread_attr); if (pthread_create(&commit_handler_thread, &thread_attr, _commit_handler, NULL)) fatal("pthread_create %m"); slurm_attr_destroy(&thread_attr); memset(&assoc_init_arg, 0, sizeof(assoc_init_args_t)); /* If we are tacking wckey we need to cache wckeys, if we aren't only cache the users, qos */ assoc_init_arg.cache_level = ASSOC_MGR_CACHE_USER | ASSOC_MGR_CACHE_QOS; if (slurmdbd_conf->track_wckey) assoc_init_arg.cache_level |= ASSOC_MGR_CACHE_WCKEY; db_conn = acct_storage_g_get_connection(NULL, 0, true, NULL); if (assoc_mgr_init(db_conn, &assoc_init_arg, errno) == SLURM_ERROR) { error("Problem getting cache of data"); acct_storage_g_close_connection(&db_conn); goto end_it; } if (gethostname_short(node_name, sizeof(node_name))) fatal("getnodename: %m"); while (1) { if (slurmdbd_conf->dbd_backup && (!strcmp(node_name, slurmdbd_conf->dbd_backup) || !strcmp(slurmdbd_conf->dbd_backup, "localhost"))) { info("slurmdbd running in background mode"); have_control = false; backup = true; /* make sure any locks are released */ acct_storage_g_commit(db_conn, 1); run_dbd_backup(); if (!shutdown_time) assoc_mgr_refresh_lists(db_conn); } else if (slurmdbd_conf->dbd_host && (!strcmp(slurmdbd_conf->dbd_host, node_name) || !strcmp(slurmdbd_conf->dbd_host, "localhost"))) { backup = false; have_control = true; } else { fatal("This host not configured to run SlurmDBD " "(%s != %s | (backup) %s)", node_name, slurmdbd_conf->dbd_host, slurmdbd_conf->dbd_backup); } if (!shutdown_time) { /* Create attached thread to process incoming RPCs */ slurm_attr_init(&thread_attr); if (pthread_create(&rpc_handler_thread, &thread_attr, rpc_mgr, NULL)) fatal("pthread_create error %m"); slurm_attr_destroy(&thread_attr); } if (!shutdown_time) { /* Create attached thread to do usage rollup */ slurm_attr_init(&thread_attr); if (pthread_create(&rollup_handler_thread, &thread_attr, _rollup_handler, db_conn)) fatal("pthread_create error %m"); slurm_attr_destroy(&thread_attr); } /* Daemon is fully operational here */ if (!shutdown_time || primary_resumed) { shutdown_time = 0; info("slurmdbd version %s started", SLURM_VERSION_STRING); if (backup) run_dbd_backup(); } _request_registrations(db_conn); acct_storage_g_commit(db_conn, 1); /* this is only ran if not backup */ if (rollup_handler_thread) pthread_join(rollup_handler_thread, NULL); if (rpc_handler_thread) pthread_join(rpc_handler_thread, NULL); if (backup && primary_resumed) { shutdown_time = 0; info("Backup has given up control"); } if (shutdown_time) break; } /* Daemon termination handled here */ end_it: if (signal_handler_thread) pthread_join(signal_handler_thread, NULL); if (commit_handler_thread) pthread_join(commit_handler_thread, NULL); acct_storage_g_commit(db_conn, 1); acct_storage_g_close_connection(&db_conn); if (slurmdbd_conf->pid_file && (unlink(slurmdbd_conf->pid_file) < 0)) { verbose("Unable to remove pidfile '%s': %m", slurmdbd_conf->pid_file); } FREE_NULL_LIST(registered_clusters); assoc_mgr_fini(NULL); slurm_acct_storage_fini(); slurm_auth_fini(); log_fini(); free_slurmdbd_conf(); exit(0); }
int _setup_assoc_list(void) { slurmdb_update_object_t update; slurmdb_assoc_rec_t *assoc = NULL; /* make the main list */ assoc_mgr_assoc_list = list_create(slurmdb_destroy_assoc_rec); assoc_mgr_user_list = list_create(slurmdb_destroy_user_rec); assoc_mgr_qos_list = list_create(slurmdb_destroy_qos_rec); /* we just want make it so we setup_children so just pretend * we are running off cache */ running_cache = 1; assoc_mgr_init(NULL, NULL, SLURM_SUCCESS); /* Here we make the associations we want to add to the system. * We do this as an update to avoid having to do setup. */ memset(&update, 0, sizeof(slurmdb_update_object_t)); update.type = SLURMDB_ADD_ASSOC; update.objects = list_create(slurmdb_destroy_assoc_rec); /* root assoc */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 1; assoc->acct = xstrdup("root"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 2; assoc->parent_id = 1; assoc->shares_raw = 40; assoc->acct = xstrdup("aA"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 21; assoc->parent_id = 2; assoc->shares_raw = 30; assoc->acct = xstrdup("aAA"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 211; assoc->parent_id = 21; assoc->shares_raw = 1; assoc->usage->usage_raw = 20; assoc->acct = xstrdup("aAA"); assoc->user = xstrdup("uAA1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 22; assoc->parent_id = 2; assoc->shares_raw = 10; assoc->acct = xstrdup("aAB"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 221; assoc->parent_id = 22; assoc->shares_raw = 1; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("aAB"); assoc->user = xstrdup("uAB1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 222; assoc->parent_id = 22; assoc->shares_raw = 1; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aAB"); assoc->user = xstrdup("uAB2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 3; assoc->parent_id = 1; assoc->shares_raw = 60; assoc->acct = xstrdup("aB"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 31; assoc->parent_id = 3; assoc->shares_raw = 25; assoc->acct = xstrdup("aBA"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 311; assoc->parent_id = 31; assoc->shares_raw = 1; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("aBA"); assoc->user = xstrdup("uBA1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 32; assoc->parent_id = 3; assoc->shares_raw = 35; assoc->acct = xstrdup("aBB"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 321; assoc->parent_id = 32; assoc->shares_raw = 1; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aBB"); assoc->user = xstrdup("uBB1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 4; assoc->parent_id = 1; assoc->shares_raw = 0; assoc->usage->usage_raw = 30; assoc->acct = xstrdup("aC"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 41; assoc->parent_id = 4; assoc->shares_raw = 0; assoc->usage->usage_raw = 30; assoc->acct = xstrdup("aC"); assoc->user = xstrdup("uC1"); list_append(update.objects, assoc); /* Check for proper handling of Fairshare=parent */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 5; assoc->parent_id = 1; assoc->shares_raw = 50; assoc->acct = xstrdup("aD"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 51; assoc->parent_id = 5; assoc->shares_raw = SLURMDB_FS_USE_PARENT; assoc->usage->usage_raw = 35; assoc->acct = xstrdup("aDA"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 511; assoc->parent_id = 51; assoc->shares_raw = SLURMDB_FS_USE_PARENT; assoc->usage->usage_raw = 10; assoc->acct = xstrdup("aDA"); assoc->user = xstrdup("uDA1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 512; assoc->parent_id = 51; assoc->shares_raw = 30; assoc->usage->usage_raw = 10; assoc->acct = xstrdup("aDA"); assoc->user = xstrdup("uDA2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 513; assoc->parent_id = 51; assoc->shares_raw = 50; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("aDA"); assoc->user = xstrdup("uDA3"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 52; assoc->parent_id = 5; assoc->shares_raw = SLURMDB_FS_USE_PARENT; assoc->usage->usage_raw = 20; assoc->acct = xstrdup("aD"); assoc->user = xstrdup("uD1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 53; assoc->parent_id = 5; assoc->shares_raw = 40; assoc->usage->usage_raw = 20; assoc->acct = xstrdup("aD"); assoc->user = xstrdup("uD2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 54; assoc->parent_id = 5; assoc->shares_raw = 50; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("aD"); assoc->user = xstrdup("uD3"); list_append(update.objects, assoc); /* Check for proper tie handling */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 6; assoc->parent_id = 1; assoc->shares_raw = 10; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aE"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 61; assoc->parent_id = 6; assoc->shares_raw = 10; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aE"); assoc->user = xstrdup("aE1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 62; assoc->parent_id = 6; assoc->shares_raw = 10; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aE"); assoc->user = xstrdup("aE2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 7; assoc->parent_id = 1; assoc->shares_raw = 10; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("root"); assoc->user = xstrdup("u1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 8; assoc->parent_id = 1; assoc->shares_raw = 20; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aF"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 81; assoc->parent_id = 8; assoc->shares_raw = 10; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aF"); assoc->user = xstrdup("uF1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 82; assoc->parent_id = 8; assoc->shares_raw = 20; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("aF"); assoc->user = xstrdup("uF2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 9; assoc->parent_id = 1; assoc->shares_raw = 8; assoc->usage->usage_raw = 20; assoc->acct = xstrdup("aG"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 91; assoc->parent_id = 9; assoc->shares_raw = 10; assoc->usage->usage_raw = 10; assoc->acct = xstrdup("aG"); assoc->user = xstrdup("uG1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 92; assoc->parent_id = 9; assoc->shares_raw = 10; assoc->usage->usage_raw = 10; assoc->acct = xstrdup("aGA"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 921; assoc->parent_id = 92; assoc->shares_raw = 20; assoc->usage->usage_raw = 4; assoc->acct = xstrdup("aGA"); assoc->user = xstrdup("uGA1"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 921; assoc->parent_id = 92; assoc->shares_raw = 20; assoc->usage->usage_raw = 6; assoc->acct = xstrdup("aGA"); assoc->user = xstrdup("uGA2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 1001; assoc->parent_id = 1; assoc->shares_raw = 10; assoc->usage->usage_raw = 10; assoc->acct = xstrdup("root"); assoc->user = xstrdup("u2"); list_append(update.objects, assoc); if (assoc_mgr_update_assocs(&update, false)) error("assoc_mgr_update_assocs: %m"); list_destroy(update.objects); return SLURM_SUCCESS; }
int _setup_assoc_list(void) { slurmdb_update_object_t update; slurmdb_assoc_rec_t *assoc = NULL; /* make the main list */ assoc_mgr_assoc_list = list_create(slurmdb_destroy_assoc_rec); assoc_mgr_user_list = list_create(slurmdb_destroy_user_rec); assoc_mgr_qos_list = list_create(slurmdb_destroy_qos_rec); /* we just want make it so we setup_children so just pretend * we are running off cache */ running_cache = 1; assoc_mgr_init(NULL, NULL, SLURM_SUCCESS); /* Here we make the associations we want to add to the system. * We do this as an update to avoid having to do setup. */ memset(&update, 0, sizeof(slurmdb_update_object_t)); update.type = SLURMDB_ADD_ASSOC; update.objects = list_create(slurmdb_destroy_assoc_rec); /* Just so we don't have to worry about lft's and rgt's we * will just append these on in order. * Note: the commented out lfts and rgts as of 10-29-10 are * correct. By doing an append they go on * sorted in hierarchy order. The sort that happens inside * the internal slurm code will sort alpha automatically, (You can * test this by putting AccountF before AccountE. */ /* First only add the accounts */ /* root association */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 1; /* assoc->lft = 1; */ /* assoc->rgt = 28; */ assoc->acct = xstrdup("root"); list_append(update.objects, assoc); /* sub of root id 1 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 2; assoc->parent_id = 1; assoc->shares_raw = 40; /* assoc->lft = 2; */ /* assoc->rgt = 13; */ assoc->acct = xstrdup("AccountA"); list_append(update.objects, assoc); /* sub of AccountA id 2 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 21; /* assoc->lft = 3; */ /* assoc->rgt = 6; */ assoc->parent_id = 2; assoc->shares_raw = 30; assoc->acct = xstrdup("AccountB"); list_append(update.objects, assoc); /* sub of AccountB id 21 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 211; /* assoc->lft = 4; */ /* assoc->rgt = 5; */ assoc->parent_id = 21; assoc->shares_raw = 1; assoc->usage->usage_raw = 20; assoc->acct = xstrdup("AccountB"); assoc->user = xstrdup("User1"); list_append(update.objects, assoc); /* sub of AccountA id 2 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 22; /* assoc->lft = 7; */ /* assoc->rgt = 12; */ assoc->parent_id = 2; assoc->shares_raw = 10; assoc->acct = xstrdup("AccountC"); list_append(update.objects, assoc); /* sub of AccountC id 22 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 221; /* assoc->lft = 8; */ /* assoc->rgt = 9; */ assoc->parent_id = 22; assoc->shares_raw = 1; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("AccountC"); assoc->user = xstrdup("User2"); list_append(update.objects, assoc); assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 222; /* assoc->lft = 10; */ /* assoc->rgt = 11; */ assoc->parent_id = 22; assoc->shares_raw = 1; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("AccountC"); assoc->user = xstrdup("User3"); list_append(update.objects, assoc); /* sub of root id 1 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 3; /* assoc->lft = 14; */ /* assoc->rgt = 23; */ assoc->parent_id = 1; assoc->shares_raw = 60; assoc->acct = xstrdup("AccountD"); list_append(update.objects, assoc); /* sub of AccountD id 3 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 31; /* assoc->lft = 19; */ /* assoc->rgt = 22; */ assoc->parent_id = 3; assoc->shares_raw = 25; assoc->acct = xstrdup("AccountE"); list_append(update.objects, assoc); /* sub of AccountE id 31 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 311; /* assoc->lft = 20; */ /* assoc->rgt = 21; */ assoc->parent_id = 31; assoc->shares_raw = 1; assoc->usage->usage_raw = 25; assoc->acct = xstrdup("AccountE"); assoc->user = xstrdup("User4"); list_append(update.objects, assoc); /* sub of AccountD id 3 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 32; /* assoc->lft = 15; */ /* assoc->rgt = 18; */ assoc->parent_id = 3; assoc->shares_raw = 35; assoc->acct = xstrdup("AccountF"); list_append(update.objects, assoc); /* sub of AccountF id 32 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 321; /* assoc->lft = 16; */ /* assoc->rgt = 17; */ assoc->parent_id = 32; assoc->shares_raw = 1; assoc->usage->usage_raw = 0; assoc->acct = xstrdup("AccountF"); assoc->user = xstrdup("User5"); list_append(update.objects, assoc); /* sub of root id 1 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 4; /* assoc->lft = 24; */ /* assoc->rgt = 27; */ assoc->parent_id = 1; assoc->shares_raw = 0; assoc->acct = xstrdup("AccountG"); list_append(update.objects, assoc); /* sub of AccountG id 4 */ assoc = xmalloc(sizeof(slurmdb_assoc_rec_t)); assoc->usage = create_assoc_mgr_assoc_usage(); assoc->id = 41; /* assoc->lft = 25; */ /* assoc->rgt = 26; */ assoc->parent_id = 4; assoc->shares_raw = 0; assoc->usage->usage_raw = 30; assoc->acct = xstrdup("AccountG"); assoc->user = xstrdup("User6"); list_append(update.objects, assoc); if (assoc_mgr_update_assocs(&update)) error("assoc_mgr_update_assocs: %m"); list_destroy(update.objects); return SLURM_SUCCESS; }