Commit ef138eeb authored by Alain Takoudjou's avatar Alain Takoudjou

slapos.collect: fix partition disk usage reported value, use Kb

parent 8efa3740
......@@ -78,7 +78,7 @@ class User(object):
limit = 1
query = database.select(table="folder", columns="date, time",
order=order, limit=limit,
where="partition=%s" % self.name)
where="partition='%s'" % self.name)
query_result = zip(*query)
if len(query_result):
date, time = (query_result[0][0], query_result[1][0])
......@@ -93,7 +93,7 @@ class User(object):
disk_snapshot = FolderSizeSnapshot(self.path, pid_file)
disk_snapshot.update_folder_size()
# Skeep insert empty partition: size <= 1Mb
if disk_snapshot.disk_usage <= 1.0 and \
if disk_snapshot.disk_usage <= 1024.0 and \
not self.disk_snapshot_params.get('testing', False):
return
database.inserFolderSnapshot(self.name,
......
......@@ -219,7 +219,7 @@ class ConsumptionReport(object):
journal.newMovement(transaction,
resource="service_module/disk_used",
title="Partition Disk Used Average for %s" % (user),
quantity=str(partition_disk_used),
quantity=str(partition_disk_used/1024.0),
reference=user,
category="")
......
......@@ -108,7 +108,7 @@ class FolderSizeSnapshot(_Snapshot):
def _getSize(self, file_path):
size = 0
command = 'du -sm %s' % file_path
command = 'du -s %s' % file_path
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
if self.pid_file:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment