From 3ab61b1ff7e5c259256660a39c3e83f13a9a70f6 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 30 Sep 2009 18:16:15 +0200 Subject: [PATCH] netapp plugin: Subtract snap_norm_used from norm_used in any case. --- src/netapp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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); } } -- 2.30.2