feat(libxce-failover): wrap 18 reply-bearing xcecli_* ops in failover loop under per-ctx lock; correct nop OpCategory (task 5.1)
This commit is contained in:
parent
8783ce5a9d
commit
4345974b54
5 changed files with 202 additions and 22 deletions
|
|
@ -199,7 +199,8 @@ int xcecli_hello(xcecli_ctx_t c, char* msg)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_hello(&(ctx->ctx), msg);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_hello(&(ctx->ctx), msg));
|
||||
}
|
||||
|
||||
int xcecli_nop(xcecli_ctx_t c)
|
||||
|
|
@ -243,7 +244,8 @@ int xcecli_reslist(xcecli_ctx_t c, xce_resource_t*** res)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_reslist(&(ctx->ctx), res);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_reslist(&(ctx->ctx), res));
|
||||
}
|
||||
|
||||
int xcecli_join(xcecli_ctx_t c, int role, hostattrs_t* attrs)
|
||||
|
|
@ -253,7 +255,8 @@ int xcecli_join(xcecli_ctx_t c, int role, hostattrs_t* attrs)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_join(&(ctx->ctx), role, attrs);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_join(&(ctx->ctx), role, attrs));
|
||||
}
|
||||
|
||||
int xcecli_workerlist(xcecli_ctx_t c, xce_worker_t*** workers)
|
||||
|
|
@ -263,7 +266,8 @@ int xcecli_workerlist(xcecli_ctx_t c, xce_worker_t*** workers)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_workerlist(&(ctx->ctx), workers);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_workerlist(&(ctx->ctx), workers));
|
||||
}
|
||||
|
||||
int xcecli_jobdispatch(xcecli_ctx_t c, xce_job_dispatch_t* info)
|
||||
|
|
@ -274,7 +278,8 @@ int xcecli_jobdispatch(xcecli_ctx_t c, xce_job_dispatch_t* info)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_jobdispatch(&(ctx->ctx), info);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_jobdispatch(&(ctx->ctx), info));
|
||||
}
|
||||
|
||||
int xcecli_jobsubmit(xcecli_ctx_t c, xce_job_submit_t* submit, uint64_t* jobid)
|
||||
|
|
@ -285,7 +290,8 @@ int xcecli_jobsubmit(xcecli_ctx_t c, xce_job_submit_t* submit, uint64_t* jobid)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_jobsubmit(&(ctx->ctx), submit, jobid);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_jobsubmit(&(ctx->ctx), submit, jobid));
|
||||
}
|
||||
|
||||
int xcecli_joblist(xcecli_ctx_t c, xce_job_t*** jobs)
|
||||
|
|
@ -296,7 +302,8 @@ int xcecli_joblist(xcecli_ctx_t c, xce_job_t*** jobs)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_joblist(&(ctx->ctx), jobs);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_joblist(&(ctx->ctx), jobs));
|
||||
}
|
||||
|
||||
int xcecli_clusterconf(xcecli_ctx_t c, xce_clusterconf_t** conf)
|
||||
|
|
@ -307,7 +314,8 @@ int xcecli_clusterconf(xcecli_ctx_t c, xce_clusterconf_t** conf)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_clusterconf(&(ctx->ctx), conf);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_clusterconf(&(ctx->ctx), conf));
|
||||
}
|
||||
|
||||
int xcecli_notify_jobfinish(xcecli_ctx_t c, xce_jobfinish_t* jfinish)
|
||||
|
|
@ -342,7 +350,8 @@ int xcecli_update_resvals(xcecli_ctx_t c, int nres, xce_resval_t** vals)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_update_resvals(&(ctx->ctx), nres, vals);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_update_resvals(&(ctx->ctx), nres, vals));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -358,8 +367,10 @@ int xcecli_update_jusage(xcecli_ctx_t c, uint64_t jobid, int npids, int* pids,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_update_jusage(&(ctx->ctx), jobid, npids, pids, npgids, pgids,
|
||||
nusage, usages);
|
||||
rc = XCECLI_FAILOVER_CALL(
|
||||
ctx, /*is_write=*/true,
|
||||
xce_update_jusage(&(ctx->ctx), jobid, npids, pids, npgids, pgids, nusage,
|
||||
usages));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -376,7 +387,8 @@ int xcecli_resval(xcecli_ctx_t c, char* host, char* res, xce_resval_t*** val)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return xce_resval(&(ctx->ctx), host, res, val);
|
||||
return XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_resval(&(ctx->ctx), host, res, val));
|
||||
}
|
||||
|
||||
int xcecli_notify(xcecli_ctx_t c, xce_notify_data_t* data)
|
||||
|
|
@ -441,7 +453,8 @@ int xcecli_jobctrl(xcecli_ctx_t c, xce_jobctrl_t* ctrlinfo)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_jobctrl(&(ctx->ctx), ctrlinfo);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_jobctrl(&(ctx->ctx), ctrlinfo));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -535,7 +548,8 @@ int xcecli_queuectrl(xcecli_ctx_t c, xce_queuectrl_t* ctrlinfo)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_queuectrl(&(ctx->ctx), ctrlinfo);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_queuectrl(&(ctx->ctx), ctrlinfo));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -549,7 +563,8 @@ int xcecli_hostctrl(xcecli_ctx_t c, xce_hostctrl_t* ctrlinfo)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_hostctrl(&(ctx->ctx), ctrlinfo);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_hostctrl(&(ctx->ctx), ctrlinfo));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -566,7 +581,8 @@ int xcecli_runtask(xcecli_ctx_t c, xce_taskrun_t* info)
|
|||
* controller to trace back
|
||||
* client
|
||||
*/
|
||||
rc = xce_runtask(&(ctx->ctx), info);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_runtask(&(ctx->ctx), info));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -658,7 +674,8 @@ int xcecli_set_pend_reason(xcecli_ctx_t c, xce_preason_set_t* reasons)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_set_pend_reason(&(ctx->ctx), reasons);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_set_pend_reason(&(ctx->ctx), reasons));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +698,8 @@ int xcecli_clear_reason(xcecli_ctx_t c, int njobs, uint64_t* jobs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
rc = xce_clear_reason(&(ctx->ctx), &reason);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/true,
|
||||
xce_clear_reason(&(ctx->ctx), &reason));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -694,6 +712,7 @@ int xcecli_jobinfo(xcecli_ctx_t c, uint64_t jobid, xce_job_t** job)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_jobinfo(&(ctx->ctx), jobid, job);
|
||||
rc = XCECLI_FAILOVER_CALL(ctx, /*is_write=*/false,
|
||||
xce_jobinfo(&(ctx->ctx), jobid, job));
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue