File pacemaker-crmd-remove-IO-load-checks.patch of Package pacemaker.14737

commit 0307614c92664078ffae0566324de85c2f990353
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Fri Apr 28 14:41:50 2017 -0500

    Low: crmd: remove I/O load checks
    
    Due to bugs, the crmd's throttling checks for I/O load and blocked processes
    would always get 0. In any case, both are already included in the load average
    checked elsewhere, so there is no need to check them.

diff --git a/crmd/throttle.c b/crmd/throttle.c
index 8ab6f0185..387e58d31 100644
--- a/crmd/throttle.c
+++ b/crmd/throttle.c
@@ -268,88 +268,6 @@ throttle_load_avg(float *load)
     return FALSE;
 }
 
-static bool
-throttle_io_load(float *load, unsigned int *blocked)
-{
-    char buffer[64*1024];
-    FILE *stream = NULL;
-    const char *loadfile = "/proc/stat";
-
-    if(load == NULL) {
-        return FALSE;
-    }
-
-    stream = fopen(loadfile, "r");
-    if(stream == NULL) {
-        int rc = errno;
-        crm_warn("Couldn't read %s: %s (%d)", loadfile, pcmk_strerror(rc), rc);
-        return FALSE;
-    }
-
-    if(fgets(buffer, sizeof(buffer), stream)) {
-        /* Borrowed from procps-ng's sysinfo.c */
-
-        char *b = NULL;
-        unsigned long long cpu_use = 0;
-        unsigned long long cpu_nic = 0;
-        unsigned long long cpu_sys = 0;
-        unsigned long long cpu_idl = 0;
-        unsigned long long cpu_iow = 0; /* not separated out until the 2.5.41 kernel */
-        unsigned long long cpu_xxx = 0; /* not separated out until the 2.6.0-test4 kernel */
-        unsigned long long cpu_yyy = 0; /* not separated out until the 2.6.0-test4 kernel */
-        unsigned long long cpu_zzz = 0; /* not separated out until the 2.6.11 kernel */
-
-        long long divo2 = 0;
-        long long duse = 0;
-        long long dsys = 0;
-        long long didl =0;
-        long long diow =0;
-        long long dstl = 0;
-        long long Div = 0;
-
-        b = strstr(buffer, "cpu ");
-        if(b) sscanf(b,  "cpu  %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
-               &cpu_use, &cpu_nic, &cpu_sys, &cpu_idl, &cpu_iow, &cpu_xxx, &cpu_yyy, &cpu_zzz);
-
-        if(blocked) {
-            b = strstr(buffer, "procs_blocked ");
-            if(b) sscanf(b,  "procs_blocked %u", blocked);
-        }
-
-        duse = cpu_use + cpu_nic;
-        dsys = cpu_sys + cpu_xxx + cpu_yyy;
-        didl = cpu_idl;
-        diow = cpu_iow;
-        dstl = cpu_zzz;
-        Div = duse + dsys + didl + diow + dstl;
-        if (!Div) Div = 1, didl = 1;
-        divo2 = Div / 2UL;
-
-        /* vmstat output:
-         *
-         * procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- 
-         * r  b   swpd   free   buff  cache     si   so    bi    bo   in   cs us sy id wa
-         * 1  0 5537800 958592 204180 1737740    1    1    12    15    0    0  2  1 97  0
-         *
-         * The last four columns are calculated as:
-         *
-         * (unsigned)( (100*duse			+ divo2) / Div ),
-         * (unsigned)( (100*dsys			+ divo2) / Div ),
-         * (unsigned)( (100*didl			+ divo2) / Div ),
-         * (unsigned)( (100*diow			+ divo2) / Div )
-         *
-         */
-        *load = (diow + divo2) / Div;
-        crm_debug("Current IO load is %f", *load);
-
-        fclose(stream);
-        return TRUE;
-    }
-
-    fclose(stream);
-    return FALSE;
-}
-
 /*!
  * \internal
  * \brief Check a load value against throttling thresholds
@@ -412,7 +330,6 @@ throttle_mode(void)
     int cores;
     float load;
     float thresholds[4];
-    unsigned int blocked = 0;
     enum throttle_state_e mode = throttle_none;
 
 #if defined(ON_BSD) || defined(ON_SOLARIS)
@@ -459,11 +376,6 @@ throttle_mode(void)
         mode |= throttle_handle_load(load, "CPU load", cores);
     }
 
-    if(throttle_io_load(&load, &blocked)) {
-        mode |= throttle_handle_load(load, "IO load", 0);
-        mode |= throttle_handle_load(blocked, "blocked IO ratio", cores);
-    }
-
     if(mode & throttle_extreme) {
         return throttle_extreme;
     } else if(mode & throttle_high) {
openSUSE Build Service is sponsored by