From: Florian Forster Date: Wed, 30 Sep 2009 16:16:15 +0000 (+0200) Subject: netapp plugin: Subtract snap_norm_used from norm_used in any case. X-Git-Tag: collectd-4.9.0~73^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3ab61b1ff7e5c259256660a39c3e83f13a9a70f6;p=collectd.git netapp plugin: Subtract snap_norm_used from norm_used in any case. --- diff --git a/src/netapp.c b/src/netapp.c index 7f0fa199..b11e9fa2 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -1378,9 +1378,21 @@ static int cna_submit_volume_usage_data (const char *hostname, /* {{{ */ snap_reserve_free = 0; snap_reserve_used = v->snap_reserved; snap_norm_used = v->snap_used - v->snap_reserved; - if (HAS_ALL_FLAGS (v->flags, HAVE_VOLUME_USAGE_NORM_USED) - && (norm_used >= snap_norm_used)) - norm_used -= snap_norm_used; + } + } + + /* The space used by snapshots but not reserved for them is included in + * both, norm_used and snap_norm_used. If possible, subtract this here. */ + if (HAS_ALL_FLAGS (v->flags, HAVE_VOLUME_USAGE_NORM_USED | HAVE_VOLUME_USAGE_SNAP_USED)) + { + if (norm_used >= snap_norm_used) + norm_used -= snap_norm_used; + else + { + ERROR ("netapp plugin: (norm_used = %"PRIu64") < (snap_norm_used = " + "%"PRIu64"). Invalidating both.", + norm_used, snap_norm_used); + v->flags &= ~(HAVE_VOLUME_USAGE_NORM_USED | HAVE_VOLUME_USAGE_SNAP_USED); } }