mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
analyze: bug fix shared networks counts
This also fixes backup state counts that were added to shared networks twice, making the numbers to be much greater than they really where. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
7cd381ed83
commit
d25e7afa1c
2 changed files with 20 additions and 35 deletions
|
|
@ -60,7 +60,8 @@ void do_counting(struct conf_t *state)
|
||||||
{
|
{
|
||||||
struct range_t *restrict range_p = state->ranges;
|
struct range_t *restrict range_p = state->ranges;
|
||||||
const struct leases_t *restrict l = state->leases;
|
const struct leases_t *restrict l = state->leases;
|
||||||
unsigned long i, k, block_size;
|
unsigned long i;
|
||||||
|
double block_size;
|
||||||
|
|
||||||
/* Walk through ranges */
|
/* Walk through ranges */
|
||||||
for (i = 0; i < state->num_ranges; i++) {
|
for (i = 0; i < state->num_ranges; i++) {
|
||||||
|
|
@ -83,38 +84,22 @@ void do_counting(struct conf_t *state)
|
||||||
range_p->backups++;
|
range_p->backups++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (range_p->shared_net) {
|
|
||||||
switch (l->type) {
|
|
||||||
case FREE:
|
|
||||||
range_p->shared_net->touched++;
|
|
||||||
break;
|
|
||||||
case ACTIVE:
|
|
||||||
range_p->shared_net->used++;
|
|
||||||
break;
|
|
||||||
case BACKUP:
|
|
||||||
range_p->shared_net->backups++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Size of range, shared net & all networks */
|
/* Size of range size. */
|
||||||
block_size = get_range_size(range_p);
|
block_size = get_range_size(range_p);
|
||||||
if (range_p->shared_net)
|
/* Count together ranges within shared network block. */
|
||||||
range_p->shared_net->available += block_size;
|
range_p->shared_net->available += block_size;
|
||||||
range_p++;
|
range_p->shared_net->used += range_p->count;
|
||||||
}
|
range_p->shared_net->touched += range_p->touched;
|
||||||
/* FIXME: During count of other shared networks default network
|
range_p->shared_net->backups += range_p->backups;
|
||||||
* and all networks got mixed together semantically. The below
|
/* When shared network is not 'all networks' add it as well. */
|
||||||
* fixes the problem, but is not elegant. */
|
if (range_p->shared_net != state->shared_networks) {
|
||||||
state->shared_networks->available = 0;
|
state->shared_networks->available += block_size;
|
||||||
state->shared_networks->used = 0;
|
state->shared_networks->used += range_p->count;
|
||||||
state->shared_networks->touched = 0;
|
state->shared_networks->touched += range_p->touched;
|
||||||
range_p = state->ranges;
|
state->shared_networks->backups += range_p->backups;
|
||||||
for (k = 0; k < state->num_ranges; k++) {
|
}
|
||||||
state->shared_networks->available += get_range_size(range_p);
|
/* Next range. */
|
||||||
state->shared_networks->used += range_p->count;
|
|
||||||
state->shared_networks->touched += range_p->touched;
|
|
||||||
state->shared_networks->backups += range_p->backups;
|
|
||||||
range_p++;
|
range_p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@ Summary:
|
||||||
percent: 43
|
percent: 43
|
||||||
touch_count: 43
|
touch_count: 43
|
||||||
touch_percent: 43
|
touch_percent: 43
|
||||||
backup_count: 3
|
backup_count: 2
|
||||||
backup_percent: 3
|
backup_percent: 2
|
||||||
status: 0
|
status: 0
|
||||||
|
|
||||||
--- skip ok ---
|
--- skip ok ---
|
||||||
|
|
@ -185,7 +185,7 @@ Summary:
|
||||||
percent: 43
|
percent: 43
|
||||||
touch_count: 43
|
touch_count: 43
|
||||||
touch_percent: 43
|
touch_percent: 43
|
||||||
backup_count: 3
|
backup_count: 2
|
||||||
backup_percent: 3
|
backup_percent: 2
|
||||||
status: 0
|
status: 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue