save works
This commit is contained in:
parent
b1faeb94b6
commit
b748e30d20
35 changed files with 1247 additions and 2149 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <errno.h>
|
||||
#include <rtti.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -104,12 +105,11 @@ int build_consumer(xce_consumer_t** pconsumer, groupmgr_t* mgr,
|
|||
sprintf(consumer_group_name, "%s-%s-group", default_name_prefix,
|
||||
suffix);
|
||||
default_g_name = consumer_group_name;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
default_g_name = g_config->name;
|
||||
}
|
||||
|
||||
g = build_group(mgr, g_config, default_g_name);
|
||||
g = makeGroup(mgr, g_config, default_g_name);
|
||||
if (g == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -369,16 +369,21 @@ int build_vres_name(char** vname, xce_limit_t* limit, char* user, char* queue,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int is_host_based_limit(resmgr_t* mgr, xce_limit_t* limit)
|
||||
int is_host_based_limit(var resmgr, xce_limit_t* limit)
|
||||
{
|
||||
xce_consumer_t* c = NULL;
|
||||
xce_resource_t* r = NULL;
|
||||
int rc = 0;
|
||||
xce_consumer_t* c = NULL;
|
||||
xce_resource_t* r = NULL;
|
||||
|
||||
if (limit == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = resmgr_lockres(mgr, limit->val.resname, OBJREF_NOP);
|
||||
rc = key_find(resmgr, (void*)limit->val.resname, (void**)&r);
|
||||
if (rc <= 0) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
if ((r->flags & (XCE_RESF_GLOBAL | XCE_RESF_SHARED)) == 0) {
|
||||
if (limit->val.percent != 0) {
|
||||
return 1;
|
||||
|
|
@ -393,7 +398,7 @@ int is_host_based_limit(resmgr_t* mgr, xce_limit_t* limit)
|
|||
return c->per_consumer;
|
||||
}
|
||||
|
||||
int add_vres(xce_resource_t** pvres, resmgr_t* mgr, char* name, int global)
|
||||
int add_vres(xce_resource_t** pvres, var resmgr, char* name, int global)
|
||||
{
|
||||
xce_resource_t* vres = NULL;
|
||||
int rc;
|
||||
|
|
@ -417,7 +422,7 @@ int add_vres(xce_resource_t** pvres, resmgr_t* mgr, char* name, int global)
|
|||
vres->flags |= XCE_RESF_DEFAULT_HOST;
|
||||
}
|
||||
|
||||
rc = resmgr_add_res(mgr, vres);
|
||||
rc = key_add(resmgr, (void*)vres->name, (void*)vres);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -426,7 +431,7 @@ int add_vres(xce_resource_t** pvres, resmgr_t* mgr, char* name, int global)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int instantiate_limit(xce_vres_t** pvres, resmgr_t* mgr, xce_limit_t* limit,
|
||||
int instantiate_limit(xce_vres_t** pvres, var resmgr, xce_limit_t* limit,
|
||||
char* user, char* queue, char* project)
|
||||
{
|
||||
xce_vres_t* vres = NULL;
|
||||
|
|
@ -434,7 +439,7 @@ int instantiate_limit(xce_vres_t** pvres, resmgr_t* mgr, xce_limit_t* limit,
|
|||
char* vresname = NULL;
|
||||
int shared = 1;
|
||||
|
||||
if ((pvres == NULL) || (mgr == NULL) || (limit == NULL) || (user == NULL)
|
||||
if ((pvres == NULL) || (resmgr == NULL) || (limit == NULL) || (user == NULL)
|
||||
|| (queue == NULL) || (project == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -448,7 +453,7 @@ int instantiate_limit(xce_vres_t** pvres, resmgr_t* mgr, xce_limit_t* limit,
|
|||
|
||||
vres->limit = limit;
|
||||
|
||||
if (is_host_based_limit(mgr, limit)) {
|
||||
if (is_host_based_limit(resmgr, limit)) {
|
||||
shared = 0;
|
||||
}
|
||||
|
||||
|
|
@ -457,9 +462,13 @@ int instantiate_limit(xce_vres_t** pvres, resmgr_t* mgr, xce_limit_t* limit,
|
|||
return rc;
|
||||
}
|
||||
|
||||
vres->vres = resmgr_lockres(mgr, vresname, OBJREF_NOP);
|
||||
if (vres->vres == NULL) {
|
||||
rc = add_vres(&(vres->vres), mgr, vresname, shared);
|
||||
rc = key_find(resmgr, (void*)vresname, (void**)&(vres->vres));
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
rc = add_vres(&(vres->vres), resmgr, vresname, shared);
|
||||
if (rc < 0) {
|
||||
FREEUP(vresname);
|
||||
return rc;
|
||||
|
|
@ -468,8 +477,12 @@ int instantiate_limit(xce_vres_t** pvres, resmgr_t* mgr, xce_limit_t* limit,
|
|||
|
||||
FREEUP(vresname);
|
||||
|
||||
vres->res = resmgr_lockres(mgr, limit->val.resname, OBJREF_NOP);
|
||||
if (vres->res == NULL) {
|
||||
rc = key_find(resmgr, (void*)limit->val.resname, (void**)&(vres->res));
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue