Skip to content

Conversation

@QuanMPhm
Copy link
Contributor

@QuanMPhm QuanMPhm commented Sep 15, 2025

Closes #239. This PR consists of the last commit. Built on top of #245. More details in the commit message.

@knikolla @jtriley I have a small bug in how error handling is done when the object storage quota is missing. Just want to confirm that my change is desirable.

@QuanMPhm QuanMPhm changed the title 239/agnostic validate Refactor to allow resource-agnostic validation Sep 15, 2025
Copy link
Collaborator

@knikolla knikolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start, but not going as far as I would like in terms of making it "resource-agnostic", as you still have a lot of if resource_name in OPENSHIFT|OPENSTACK.

Try thinking about a way to push those resource-specific functions inside the respective allocators and creating a new function in the base Allocator that serves as the abstraction.

See my comment about validate project exist.


return quota_str

def validate_project_exists(self, allocator, project_id, resource_name):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should define this in the coldfront_plugin_cloud.base.ResourceAllocator and then implement these in the OpenStack and OpenShift resource allocators. This would make this part of the codebase be Resource Agnostic.

@QuanMPhm
Copy link
Contributor Author

Note-to-self: The branch name for the original solution (before time of this comment) is 239/agnostic_validate_first

@QuanMPhm QuanMPhm force-pushed the 239/agnostic_validate branch from 9153d7b to a86da68 Compare November 11, 2025 19:33
@QuanMPhm QuanMPhm requested a review from knikolla November 11, 2025 19:33
@QuanMPhm QuanMPhm force-pushed the 239/agnostic_validate branch from a86da68 to 40883e2 Compare November 11, 2025 19:47
Quota validation will now behave the same for both resource types.
OpenStack's particular use of default quotas is reflected in a new
test in `openstack/test_allocation.py`

OpenStack integration code is slightly changed to
better handle missing object storage quotas

Much of the validation logic has been pushed into
`base.py`, `openshift.py`, and `openstack.py`
@QuanMPhm QuanMPhm force-pushed the 239/agnostic_validate branch from 40883e2 to 129234b Compare November 11, 2025 20:08
@QuanMPhm
Copy link
Contributor Author

QuanMPhm commented Nov 11, 2025

@knikolla I've cleaned house on validate_allocations.py. Hopefully this is closer to your vision. I haven't included tests for idempotency yet. For the sake of not making this PR too complicated, I believe that should be done in a subsequent PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor validate_allocations to be resource-agnostic

2 participants