Skip to content

Commit c4c7f65

Browse files
committed
Added Cluster Name column to storage invoice
It is assumed that all Openshift allocations belong to the production Openstack cluster (`stack`), and Openshift allocations to the prod Openshift cluster (`ocp-prod`)
1 parent cc6b1fa commit c4c7f65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class InvoiceRow:
4141
Project_Name: str = ""
4242
Project_ID: str = ""
4343
PI: str = ""
44+
Cluster_Name: str = ""
4445
Invoice_Email: str = ""
4546
Invoice_Address: str = ""
4647
Institution: str = ""
@@ -190,7 +191,7 @@ def upload_to_s3(s3_endpoint, s3_bucket, file_location, invoice_month):
190191
logger.info(f"Uploaded to {secondary_location}.")
191192

192193
def handle(self, *args, **options):
193-
def process_invoice_row(allocation, attrs, su_name, rate):
194+
def process_invoice_row(allocation, attrs, su_name, rate, cluster_name):
194195
"""Calculate the value and write the bill using the writer."""
195196
time = 0
196197
for attribute in attrs:
@@ -211,6 +212,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
211212
attributes.ALLOCATION_PROJECT_ID
212213
),
213214
PI=allocation.project.pi.email,
215+
Cluster_Name=cluster_name,
214216
Institution_Specific_Code=allocation.get_attribute(
215217
attributes.ALLOCATION_INSTITUTION_SPECIFIC_CODE
216218
)
@@ -284,6 +286,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
284286
[attributes.QUOTA_VOLUMES_GB, attributes.QUOTA_OBJECT_GB],
285287
"OpenStack Storage",
286288
openstack_storage_rate,
289+
"stack",
287290
)
288291

289292
for allocation in openshift_allocations:
@@ -301,6 +304,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
301304
],
302305
"OpenShift Storage",
303306
openshift_storage_rate,
307+
"ocp-prod",
304308
)
305309

306310
if options["upload_to_s3"]:

0 commit comments

Comments
 (0)