I don't think the approach you are suggesting will work.

I would suggest duplicating the workers at startup, enable/disable in each balancer to 'move' them.

-Paul


Vinicius Petrucci wrote:
hi,

I'm writing a module that needs to modify the elements (workers) of
load balancers. That is, to move workers between different balancers.

for example, suppose we have two balancers b1 and b2.  also, we have a
worker "w"  to be moved from "b1" to "b2"

basically, I do a push in "b2->workers" array:

new_worker = apr_array_push(b2->workers);
memcpy(new_worker, w, sizeof(proxy_worker));

then, I decrement by one the elements from "b1" --- we still need to guarantee
that the positions of "b1->workers" array  are fixed (shifted):

proxy_worker *tmp_w = w++;
for (j = i; j < b1->workers->nelts-1; j++, tmp_w = w, w++) {
   memcpy(tmp_w, w, sizeof(proxy_worker));
}
b1->workers->nelts--;

the problem is that in my module these changes are made. but when I
use the balancer-manager interface to list the balancer and respective
workers' settings, nothing has changed. this information isn't shared between
the modules?

I'm using the following piece of code to get the configuration so that
I can get balancer and worker data structures references to be modified:

conf = (proxy_server_conf *)
ap_get_module_config(frontend_info->s->module_config, &proxy_module);
balancer = (proxy_balancer *) conf->balancers->elts;

thanks in advance,

Vinicius

Reply via email to