update controller code
This commit is contained in:
parent
2836d196da
commit
41f56fa6ed
54 changed files with 9688 additions and 214 deletions
75
src/controller/reply.c
Normal file
75
src/controller/reply.c
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cluster.h"
|
||||
#include "xce/cluster_def.h"
|
||||
|
||||
int handle_clusterconf(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
/* clang-format off */
|
||||
xce_reply_t reply;
|
||||
int rc = 0;
|
||||
xce_clusterconf_t clusterconf = {
|
||||
.name = c->myconf->cluster_config->clustername,
|
||||
.wlist = {
|
||||
.count = 0,
|
||||
.workers = NULL
|
||||
},
|
||||
.uglist = {
|
||||
.count = 0,
|
||||
.groups = NULL
|
||||
},
|
||||
.hglist = {
|
||||
.count = 0,
|
||||
.groups = NULL
|
||||
}
|
||||
};
|
||||
/* clang-format on */
|
||||
int i;
|
||||
|
||||
init_reply_by_req(&reply, request);
|
||||
|
||||
reply.status = 0;
|
||||
reply.data_which = RequestReply_data_clusterconf;
|
||||
reply.data.clusterconf = &clusterconf;
|
||||
|
||||
collect_confvars(c, NULL, &(clusterconf.cfglist.count),
|
||||
&(clusterconf.cfglist.configs));
|
||||
collect_queues(c, NULL, &(clusterconf.qlist.count),
|
||||
&(clusterconf.qlist.queues));
|
||||
collect_resources(c, NULL, &(clusterconf.reslist.count),
|
||||
&(clusterconf.reslist.res));
|
||||
collect_workers(c, (collect_check_fn_t)check_worker_,
|
||||
&(clusterconf.wlist.count),
|
||||
&(clusterconf.wlist.workers));
|
||||
|
||||
xce_reply(ep, c->myhost, &reply);
|
||||
|
||||
for (i = 0; i < clusterconf.wlist.count; i++) {
|
||||
xce_worker_t* w = clusterconf.wlist.workers[i];
|
||||
|
||||
free_resval_with_idx_list(&(w->resvals_to_sched),
|
||||
w->nresvals_to_sched);
|
||||
}
|
||||
|
||||
deref_objs(clusterconf.cfglist.count,
|
||||
(void**)clusterconf.cfglist.configs);
|
||||
deref_objs(clusterconf.qlist.count,
|
||||
(void**)clusterconf.qlist.queues);
|
||||
deref_objs(clusterconf.reslist.count,
|
||||
(void**)clusterconf.reslist.res);
|
||||
deref_objs(clusterconf.wlist.count,
|
||||
(void**)clusterconf.wlist.workers);
|
||||
|
||||
FREEUP(clusterconf.cfglist.configs);
|
||||
FREEUP(clusterconf.qlist.queues);
|
||||
FREEUP(clusterconf.reslist.res);
|
||||
FREEUP(clusterconf.wlist.workers);
|
||||
|
||||
return rc;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue