httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1728161 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_balancer.c mod_proxy_hcheck.c
Date Tue, 02 Feb 2016 17:23:44 GMT
Author: jim
Date: Tue Feb  2 17:23:43 2016
New Revision: 1728161

URL: http://svn.apache.org/viewvc?rev=1728161&view=rev
Log:
Tie bal-man to hcheck for dynamic adjustments... right now,
actually editing not implemented yet.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1728161&r1=1728160&r2=1728161&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Tue Feb  2 17:23:43 2016
@@ -562,8 +562,9 @@ struct proxy_balancer_method {
 #define PROXY_DECLARE_DATA             __declspec(dllimport)
 #endif
 
+/* Following 3 from health check */
 APR_DECLARE_OPTIONAL_FN(void, hc_show_exprs, (request_rec *));
-
+APR_DECLARE_OPTIONAL_FN(void, hc_select_exprs, (request_rec *, const char *));
 APR_DECLARE_OPTIONAL_FN(const char *, set_worker_hc_param,
                         (apr_pool_t *, server_rec *, proxy_worker *,
                          const char *, const char *, void *));

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1728161&r1=1728160&r2=1728161&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Tue Feb  2 17:23:43 2016
@@ -34,6 +34,7 @@ static int (*ap_proxy_retry_worker_fn)(c
         proxy_worker *worker, server_rec *s) = NULL;
 
 static APR_OPTIONAL_FN_TYPE(hc_show_exprs) *hc_show_exprs_f = NULL;
+static APR_OPTIONAL_FN_TYPE(hc_select_exprs) *hc_select_exprs_f = NULL;
 
 
 /*
@@ -53,6 +54,7 @@ static int balancer_pre_config(apr_pool_
     }
     set_worker_hc_param_f = APR_RETRIEVE_OPTIONAL_FN(set_worker_hc_param);
     hc_show_exprs_f = APR_RETRIEVE_OPTIONAL_FN(hc_show_exprs);
+    hc_select_exprs_f = APR_RETRIEVE_OPTIONAL_FN(hc_select_exprs);
     return OK;
 }
 
@@ -1601,7 +1603,7 @@ static int balancer_handler(request_rec
                      "<th>Draining Mode</th>"
                      "<th>Disabled</th>"
                      "<th>Hot Standby</th>", r);
-            if (set_worker_hc_param_f) {
+            if (hc_show_exprs_f) {
                 ap_rputs("<th>HC Fail</th>", r);
             }
             ap_rputs("<th>Stopped</th></tr>\n<tr>", r);
@@ -1609,12 +1611,34 @@ static int balancer_handler(request_rec
             create_radio("w_status_N", (PROXY_WORKER_IS(wsel, PROXY_WORKER_DRAIN)), r);
             create_radio("w_status_D", (PROXY_WORKER_IS(wsel, PROXY_WORKER_DISABLED)), r);
             create_radio("w_status_H", (PROXY_WORKER_IS(wsel, PROXY_WORKER_HOT_STANDBY)),
r);
-            if (set_worker_hc_param_f) {
+            if (hc_show_exprs_f) {
                 create_radio("w_status_C", (PROXY_WORKER_IS(wsel, PROXY_WORKER_HC_FAIL)),
r);
             }
             create_radio("w_status_S", (PROXY_WORKER_IS(wsel, PROXY_WORKER_STOPPED)), r);
-            ap_rputs("</tr></table>\n", r);
-            ap_rputs("<tr><td colspan=2><input type=submit value='Submit'></td></tr>\n",
r);
+            ap_rputs("</tr></table></td></tr>\n", r);
+            if (hc_select_exprs_f) {
+                proxy_hcmethods_t *method = proxy_hcmethods;
+                ap_rputs("<tr><td colspan='2'>\n<table align='center'><tr><th>Health
Check param</th><th>Value</th></tr>\n", r);
+                ap_rputs("<tr><td>Method</td><td><select name='hcmethod'>\n",
r);
+                for (; method->name; method++) {
+                    if (method->implemented) {
+                        ap_rprintf(r, "<option value='%s' %s >%s</option>\n",
+                                method->name,
+                                (wsel->s->method == method->method) ? "selected"
: "",
+                                method->name);
+                    }
+                }
+                ap_rputs("</select>\n</td></tr>\n", r);
+                ap_rputs("<tr><td>Expr</td><td><select name='hcexpr'>\n",
r);
+                hc_select_exprs_f(r, wsel->s->hcexpr);
+                ap_rputs("</select>\n</td></tr>\n", r);
+                ap_rprintf(r, "<tr><td>Interval (secs)</td><td>%d</td></tr>\n",
(int)apr_time_sec(wsel->s->interval));
+                ap_rprintf(r, "<tr><td>Fails trigger</td><td>%d</td></tr>\n",
wsel->s->fails);
+                ap_rprintf(r, "<tr><td>Passes trigger</td><td>%d</td></tr>\n",
wsel->s->passes);
+                ap_rprintf(r, "<tr><td>HC uri</td><td>%s</td></tr>\n",
wsel->s->hcuri);
+                ap_rputs("</table>\n</td></tr>\n", r);
+            }
+            ap_rputs("<tr><td colspan='2'><input type=submit value='Submit'></td></tr>\n",
r);
             ap_rvputs(r, "</table>\n<input type=hidden name='w' id='w' ",  NULL);
             ap_rvputs(r, "value='", ap_escape_uri(r->pool, wsel->s->name), "'>\n",
NULL);
             ap_rvputs(r, "<input type=hidden name='b' id='b' ", NULL);

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c?rev=1728161&r1=1728160&r2=1728161&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c Tue Feb  2 17:23:43 2016
@@ -1011,7 +1011,7 @@ static void hc_show_exprs(request_rec *r
         return;
 
     ap_rputs("\n\n<table>"
-             "<tr><th colspan=\"2\">Health check cond. expressions:</th></tr>\n"
+             "<tr><th colspan='2'>Health check cond. expressions:</th></tr>\n"
              "<tr><th>Expr name</th><th>Expression</th></tr>\n",
r);
 
     hdr = apr_table_elts(ctx->conditions);
@@ -1028,6 +1028,28 @@ static void hc_show_exprs(request_rec *r
     ap_rputs("</table><hr/>\n", r);
 }
 
+static void hc_select_exprs(request_rec *r, const char *expr)
+{
+    const apr_table_entry_t *elts;
+    const apr_array_header_t *hdr;
+    int i;
+    sctx_t *ctx = (sctx_t *) ap_get_module_config(r->server->module_config,
+                                                  &proxy_hcheck_module);
+    if (apr_is_empty_table(ctx->conditions))
+        return;
+
+    hdr = apr_table_elts(ctx->conditions);
+    elts = (const apr_table_entry_t *) hdr->elts;
+    for (i = 0; i < hdr->nelts; ++i) {
+        if (!elts[i].key) {
+            continue;
+        }
+        ap_rprintf(r, "<option value='%s' %s >%s</option>\n", elts[i].key,
+                   (!ap_casecmpstr(elts[i].key, expr)) ? "selected" : "",
+                   elts[i].key);
+    }
+}
+
 static const char *hc_get_body(request_rec *r)
 {
     apr_off_t length;
@@ -1115,6 +1137,7 @@ static void hc_register_hooks(apr_pool_t
     static const char *const aszSucc[] = { "mod_watchdog.c", NULL};
     APR_REGISTER_OPTIONAL_FN(set_worker_hc_param);
     APR_REGISTER_OPTIONAL_FN(hc_show_exprs);
+    APR_REGISTER_OPTIONAL_FN(hc_select_exprs);
     ap_hook_post_config(hc_post_config, aszPre, aszSucc, APR_HOOK_LAST);
     ap_hook_expr_lookup(hc_expr_lookup, NULL, NULL, APR_HOOK_MIDDLE);
 }



Mime
View raw message