support limit

This commit is contained in:
Rongsong Shen 2026-01-12 15:20:51 +08:00
parent bef32ace38
commit ecf1916d78
33 changed files with 3036 additions and 243 deletions

View file

@ -81,6 +81,7 @@ typedef struct {
#define XCE_RESF_RELEASE (0x20)
#define XCE_RESF_DEFAULT_HOST (0x40)
#define XCE_RESF_CONSUMABLE (0x80)
#define XCE_RESF_LIMIT (0x100)
typedef struct {
int count;
@ -111,12 +112,12 @@ typedef struct {
char* name;
xce_strlist_t members;
xce_strlist_t ex_members;
} xce_group_t;
} xce_group_config_t;
typedef struct {
int count;
xce_group_t** groups;
} xce_grouplist_t;
int count;
xce_group_config_t** groups;
} xce_group_configlist_t;
typedef struct {
xce_val_t* value;
@ -501,8 +502,8 @@ typedef struct {
int32_t accept_interval;
int32_t sched_delay;
char* resreq;
xce_group_t* users;
xce_group_t* hosts;
xce_group_config_t* users;
xce_group_config_t* hosts;
int32_t nthresholds;
xce_res_threshold_t** thresholds;
xce_timewindow_t* runwindow;
@ -525,13 +526,13 @@ typedef struct {
} xce_queuelist_t;
typedef struct {
char* name;
xce_reslist_t reslist;
xce_queuelist_t qlist;
xce_workerlist_t wlist;
xce_grouplist_t uglist;
xce_grouplist_t hglist;
xce_configlist_t cfglist;
char* name;
xce_reslist_t reslist;
xce_queuelist_t qlist;
xce_workerlist_t wlist;
xce_group_configlist_t uglist;
xce_group_configlist_t hglist;
xce_configlist_t cfglist;
} xce_clusterconf_t;
typedef enum {
@ -695,4 +696,76 @@ typedef struct {
xce_pendreason_t** reasons;
} xce_preason_set_t;
typedef struct {
char* name;
char* prov_type;
char* conf_path;
char* script_path;
char* script_option;
} scaler_config_t;
typedef struct xce_group_ xce_group_t;
typedef struct xce_g_member_ xce_g_member_t;
struct xce_g_member_ {
unsigned int is_group : 1;
union {
char* name;
xce_group_t* g;
} u;
};
struct xce_group_ {
char* name;
unsigned int dirty : 1;
xlist_t affecteds; /* groups affected by this group */
xlist_t members;
xlist_t ex_members;
};
typedef enum {
CONSUMER_USER = 0,
CONSUMER_QUEUE,
CONSUMER_PROJECT,
CONSUMER_HOST,
CONSUMER_MAX /* keep this the last */
} xce_consumer_type_t;
typedef struct {
xce_consumer_type_t ctype;
unsigned int per_consumer : 1;
xce_group_t* group;
} xce_consumer_t;
typedef struct {
char* resname;
unsigned int percent : 1;
float val;
} xce_limit_val_t;
typedef struct {
char* name;
unsigned int per_user : 1;
unsigned int per_queue : 1;
unsigned int per_project : 1;
unsigned int per_host : 1;
xce_group_config_t* users;
xce_group_config_t* queues;
xce_group_config_t* projects;
xce_group_config_t* hosts;
xce_limit_val_t* val;
} xce_limit_config_t;
typedef struct {
char* name;
xce_consumer_t* consumers[CONSUMER_MAX];
xce_limit_val_t val;
} xce_limit_t;
typedef struct {
xce_resource_t* vres;
xce_resource_t* res;
xce_limit_t* limit;
} xce_vres_t;
#endif