nerc-project / coldfront-plugin-cloud

ColdFront plugin to manage resource allocations on OpenStack and OpenShift
GNU General Public License v3.0
4 stars 10 forks source link

Convert swift quotas from GB to GiB #162

Closed knikolla closed 5 months ago

knikolla commented 6 months ago

Related https://github.com/nerc-project/operations/issues/587

QuanMPhm commented 5 months ago

I'll update validate_allocations to convert all existing Swift quotas to GiB

QuanMPhm commented 5 months ago

@knikolla Do you want me to rename variables that reference GB appropriately? So QUOTA_OBJECT_GB and GB_IN_BYTES will be QUOTA_OBJECT_GiB and GiB_IN_BYTES. This may make a very messy diff?

knikolla commented 5 months ago

I'll update validate_allocations to convert all existing Swift quotas to GB

Don't do this as part of validate_allocations as that will introduce more complications. The reason why it would be more complicated like this, is because get_quota will round to the nearest GB, so we would have to break one abstraction layer to get the actual value.

Create a new one-off command that will be called once to do the conversion, calling set_quota for only swift with the new values for all active/expired allocations on OpenStack.

Do you want me to rename variables that reference GB appropriately? So QUOTA_OBJECT_GB and GB_IN_BYTES will be QUOTA_OBJECT_GiB and GiB_IN_BYTES. This may make a very messy diff?

Keep the underlying variable name the same, however introduce a new attribute name migration (similar to #163 ) that renames the attribute to a similar naming scheme.

QuanMPhm commented 5 months ago

@knikolla Sorry for the late response. I see. I'll make a one-time command convert_swift_quota_to_gib.py then. Do you think it would be worth it to do an "informal check" to see if a Swift quota is in Gb or Gib? By that I mean...

Right now, given the current code, I assume that all of our Swift quotas are in quantities that are divisible by 1000^2. After the conversion from Gb to Gib, we can still do checks in the future to see if any Swift quotas were (inadvertently or not) set in Gb or Gib by seeing if they're divisible by 1,000^2 or 1024^2. This would make the command not a one-time thing?

joachimweyl commented 5 months ago

@QuanMPhm can you link the PR here please.

knikolla commented 5 months ago

@knikolla Sorry for the late response. I see. I'll make a one-time command convert_swift_quota_to_gib.py then. Do you think it would be worth it to do an "informal check" to see if a Swift quota is in Gb or Gib? By that I mean...

Right now, given the current code, I assume that all of our Swift quotas are in quantities that are divisible by 1000^2. After the conversion from Gb to Gib, we can still do checks in the future to see if any Swift quotas were (inadvertently or not) set in Gb or Gib by seeing if they're divisible by 1,000^2 or 1024^2. This would make the command not a one-time thing?

I don't think those checks are necessary.

QuanMPhm commented 5 months ago

@QuanMPhm can you link the PR here please.

I'm sorry. I'm encountering a problem with running VMs on my computer, and it's taking an absurd amount of time