save works

This commit is contained in:
Rongsong Shen 2026-03-03 16:49:26 +08:00
parent f4b1ba4cd7
commit acfbec875b
51 changed files with 622 additions and 1175 deletions

View file

@ -350,8 +350,6 @@ int add_worker(void* cls, endpoint_t* ep, const char* host, hostattrs_t* attrs)
mark_host_res(c, w, hconfig->resources[i]);
}
DEREF_OBJ(w); /* release update lock */
return idx;
}
@ -373,8 +371,6 @@ int restore_worker(void* cls, xce_worker_t host)
idx = w->idx;
w->host.status |= XCE_WORKER_UNAVAIL;
DEREF_OBJ(w);
return idx;
}
@ -396,30 +392,32 @@ static int worker_push_config(cluster_t* c, endpoint_t* ep)
{
xce_configdata_t configdata;
int rc = 0;
xlist_t clist;
memset(&configdata, 0x0, sizeof(configdata));
configdata.data.conf4worker
= (xce_conf4worker_t*)calloc(1, sizeof(xce_conf4worker_t));
configdata.data.conf4worker = calloc(1, sizeof(xce_conf4worker_t));
if (configdata.data.conf4worker == NULL) {
return -ENOMEM;
}
collect_confvars(c, (collect_check_fn_t)check_conf4worker_,
&(configdata.data.conf4worker->n_confvars),
&(configdata.data.conf4worker->confvars));
configdata.data_which = ConfigData_data_workerconfig;
xlist_init(&clist, 256);
collect_confvars(c, (collect_check_fn_t)check_conf4worker_, &clist);
configdata.data.conf4worker->n_confvars = clist.count;
configdata.data.conf4worker->confvars = (xce_config_t**)clist.data;
configdata.data_which = ConfigData_data_workerconfig;
configdata.data.conf4worker->clustername
= c->myconf->cluster_config->clustername;
rc = xce_pushconfig_req(ep, c->myhost, &configdata);
deref_objs(configdata.data.conf4worker->n_confvars,
(void**)configdata.data.conf4worker->confvars);
FREEUP(configdata.data.conf4worker->confvars);
FREEUP(configdata.data.conf4worker);
xlist_fini(&clist);
return rc;
}
@ -453,7 +451,6 @@ int get_resval(cluster_t* c, char* resname, char* host, xce_val_t* val)
if ((r->flags & XCE_RESF_SHARED) == 0) {
if ((host == NULL) || (strlen(host) == 0)) {
obj_deref(r);
return -EINVAL;
}
@ -537,7 +534,6 @@ int handle_worker_leave(cluster_t* c, int idx)
mark_worker_unavail(c, w);
obj_deref(w);
return 0;
}
@ -584,6 +580,5 @@ int worker_ctrl(cluster_t* c, xce_hostctrl_t* ctrl)
HOOK_AFTER_EVENT, HOOK_DETAIL_WORKER_UPDATE, c, w);
}
clean:
obj_deref(w);
return rc;
}