Skip to content

Commit

Permalink
Merge pull request #270 from fasrc/cp_nesequotarounding
Browse files Browse the repository at this point in the history
change nese quota rounding
  • Loading branch information
claire-peters authored Dec 13, 2023
2 parents 0da9b21 + c226522 commit 2108bc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion coldfront/core/allocation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def size(self):
if self.size_exact:
if 'TB' in self.get_parent_resource.quantity_label:
divisor = 1099511627776
return self.size_exact/divisor
size = self.size_exact/divisor
if 'nesetape' in self.get_parent_resource.name:
size = round(size, -1)
return size
return None
except TypeError:
return None
Expand Down
6 changes: 4 additions & 2 deletions coldfront/plugins/fasrc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def produce_query_statement(self, vol_type, volumes=None):
d = query_dict[vol_type]

if not volumes:
volumes = [r.name.split('/')[0] for r in Resource.objects.filter(resource_type__name='Storage')]
volumes = [
r.name.split('/')[0] for r in Resource.objects.filter(resource_type__name='Storage')
]
volumes = '|'.join(volumes)
where = f"(e.{d['server']} =~ '.*({volumes}).*')"
statement = {
Expand Down Expand Up @@ -145,7 +147,7 @@ def _standardize_nesefile(self):
data['storage_type'] = 'tape'
data['byte_allocation'] = data['mib_capacity'] * 1048576
data['byte_usage'] = data['mib_used'] * 1048576
data['tb_allocation'] = data['mib_capacity'] / 953674.3164
data['tb_allocation'] = round((data['mib_capacity'] / 953674.3164), -1)
data['tb_usage'] = data['mib_used'] / 953674.3164
data['fs_path'] = None
data = data[[
Expand Down

0 comments on commit 2108bc2

Please sign in to comment.