stats gathering: fix storage server stats if not tracking consumed

the RIStatsProvider interface requires that counter and stat values be
ChoiceOf(float, int, long)  the recent changes to storage server to not
track 'consumed' led to returning None as the value of a counter.
this causes violations to be experienced by nodes whose stats are being
gathered.

this patch simply omits that stat if 'consumed' is not being tracked.
This commit is contained in:
robk-tahoe 2008-04-09 18:23:06 -07:00
parent ef0f523fe0
commit 35319c3380
1 changed files with 4 additions and 3 deletions

View File

@ -728,9 +728,10 @@ class StorageServer(service.MultiService, Referenceable):
fileutil.rm_dir(self.incomingdir)
def get_stats(self):
return { 'storage_server.consumed': self.consumed,
'storage_server.allocated': self.allocated_size(),
}
stats = { 'storage_server.allocated': self.allocated_size(), }
if self.consumed is not None:
stats['storage_server.consumed'] = self.consumed
return stats
def allocated_size(self):
space = self.consumed or 0