Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:42.3:Staging:A
pacemaker
pacemaker-crmd-functionize-setting-throttle-loa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-crmd-functionize-setting-throttle-load-target.patch of Package pacemaker
commit a882a3ff25bcae8d703277ebd850fde0b1128ce9 Author: Ken Gaillot <kgaillot@redhat.com> Date: Tue Apr 25 17:23:04 2017 -0500 Refactor: crmd: functionize setting throttle load target Make as much in throttle.c static as possible, for better isolation. diff --git a/crmd/control.c b/crmd/control.c index f4823b97c..af9c2c2f2 100644 --- a/crmd/control.c +++ b/crmd/control.c @@ -1046,14 +1046,14 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void value = crmd_pref(config_hash, "load-threshold"); if(value) { - throttle_load_target = strtof(value, NULL) / 100; + throttle_set_load_target(strtof(value, NULL) / 100.0); } value = crmd_pref(config_hash, "no-quorum-policy"); if (safe_str_eq(value, "suicide") && pcmk_locate_sbd()) { no_quorum_suicide_escalation = TRUE; } - + value = crmd_pref(config_hash,"stonith-max-attempts"); update_stonith_max_attempts(value); diff --git a/crmd/throttle.c b/crmd/throttle.c index ce330fe6d..b9add7da2 100644 --- a/crmd/throttle.c +++ b/crmd/throttle.c @@ -33,8 +33,7 @@ #include <throttle.h> -enum throttle_state_e -{ +enum throttle_state_e { throttle_extreme = 0x1000, throttle_high = 0x0100, throttle_med = 0x0010, @@ -42,24 +41,24 @@ enum throttle_state_e throttle_none = 0x0000, }; -struct throttle_record_s -{ - int max; - enum throttle_state_e mode; - char *node; +struct throttle_record_s { + int max; + enum throttle_state_e mode; + char *node; }; -int throttle_job_max = 0; -float throttle_load_target = 0.0; +static int throttle_job_max = 0; +static float throttle_load_target = 0.0; #define THROTTLE_FACTOR_LOW 1.2 #define THROTTLE_FACTOR_MEDIUM 1.6 #define THROTTLE_FACTOR_HIGH 2.0 -GHashTable *throttle_records = NULL; -mainloop_timer_t *throttle_timer = NULL; +static GHashTable *throttle_records = NULL; +static mainloop_timer_t *throttle_timer = NULL; -int throttle_num_cores(void) +static int +throttle_num_cores(void) { static int cores = 0; char buffer[256]; @@ -102,14 +101,16 @@ int throttle_num_cores(void) * This will return NULL if the daemon is being run via valgrind. * This should be called only on Linux systems. */ -static char *find_cib_loadfile(void) +static char * +find_cib_loadfile(void) { int pid = crm_procfs_pid_of("cib"); return pid? crm_strdup_printf("/proc/%d/stat", pid) : NULL; } -static bool throttle_cib_load(float *load) +static bool +throttle_cib_load(float *load) { /* /proc/[pid]/stat @@ -233,7 +234,8 @@ static bool throttle_cib_load(float *load) return FALSE; } -static bool throttle_load_avg(float *load) +static bool +throttle_load_avg(float *load) { char buffer[256]; FILE *stream = NULL; @@ -266,7 +268,8 @@ static bool throttle_load_avg(float *load) return FALSE; } -static bool throttle_io_load(float *load, unsigned int *blocked) +static bool +throttle_io_load(float *load, unsigned int *blocked) { char buffer[64*1024]; FILE *stream = NULL; @@ -514,7 +517,13 @@ throttle_record_free(gpointer p) } void -throttle_update_job_max(const char *preference) +throttle_set_load_target(float target) +{ + throttle_load_target = target; +} + +void +throttle_update_job_max(const char *preference) { int max = 0; @@ -547,7 +556,6 @@ throttle_update_job_max(const char *preference) } } - void throttle_init(void) { @@ -568,7 +576,6 @@ throttle_fini(void) g_hash_table_destroy(throttle_records); throttle_records = NULL; } - int throttle_get_total_job_limit(int l) { @@ -673,4 +680,3 @@ throttle_update(xmlNode *xml) crm_debug("Host %s supports a maximum of %d jobs and throttle mode %.4x. New job limit is %d", from, max, mode, throttle_get_job_limit(from)); } - diff --git a/crmd/throttle.h b/crmd/throttle.h index bdb33e75b..9d1b97b89 100644 --- a/crmd/throttle.h +++ b/crmd/throttle.h @@ -17,12 +17,10 @@ */ -extern float throttle_load_target; - void throttle_init(void); void throttle_fini(void); -int throttle_num_cores(void); +void throttle_set_load_target(float target); void throttle_update(xmlNode *xml); void throttle_update_job_max(const char *preference); int throttle_get_job_limit(const char *node);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor