controller will pass resource <name, value> pair than <idx, value> pair
This commit is contained in:
parent
9f6741c2c4
commit
d47b3375e7
16 changed files with 183 additions and 86 deletions
|
|
@ -272,11 +272,23 @@ xce_sched_worker_t* make_sched_worker(void* arg, xce_worker_t* w)
|
|||
|
||||
/* fill resource values */
|
||||
for (i = 0; i < w->nresvals_to_sched; i++) {
|
||||
int idx = w->resvals_to_sched[i]->idx;
|
||||
xce_val_t* val = NULL;
|
||||
xce_name_val_t* nv = w->resvals_to_sched[i];
|
||||
xce_resource_t* r = NULL;
|
||||
xce_val_t* val = NULL;
|
||||
|
||||
MOVE_PTR(val, w->resvals_to_sched[i]->val);
|
||||
zarray_put(&(worker->resvals), idx, val);
|
||||
if (nv == NULL || nv->name == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key_find(sched->resmgr, (void*)nv->name, (void**)&r) < 0
|
||||
|| r == NULL) {
|
||||
WARN("%s unknown resource '%s' in worker resvals, skipping",
|
||||
__func__, nv->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
MOVE_PTR(val, nv->val);
|
||||
zarray_put(&(worker->resvals), r->idx, val);
|
||||
}
|
||||
|
||||
return worker;
|
||||
|
|
|
|||
|
|
@ -576,11 +576,23 @@ static int sched_init_sharedInst(xce_scheduler_t* sched)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < sched->config->nresvals; i++) {
|
||||
int idx = sched->config->resvals[i]->idx;
|
||||
xce_val_t* val = NULL;
|
||||
xce_name_val_t* nv = sched->config->resvals[i];
|
||||
xce_resource_t* r = NULL;
|
||||
xce_val_t* val = NULL;
|
||||
|
||||
MOVE_PTR(val, sched->config->resvals[i]->val);
|
||||
zarray_put(&(sched->sharedInst), idx, val);
|
||||
if (nv == NULL || nv->name == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key_find(sched->resmgr, (void*)nv->name, (void**)&r) < 0
|
||||
|| r == NULL) {
|
||||
WARN("%s unknown resource '%s' in resvals, skipping",
|
||||
__func__, nv->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
MOVE_PTR(val, nv->val);
|
||||
zarray_put(&(sched->sharedInst), r->idx, val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue