ATIX-AG / foreman_resource_quota

Foreman plugin to allow resource management with Resource Quotas among users and usergroups.
GNU General Public License v3.0
4 stars 0 forks source link

[RFC] How to handle Resource Quota assignment at host registration #53

Open bastian-src opened 4 months ago

bastian-src commented 4 months ago

Problem

When registering a new host using the host registration form, a new host is created in the database. One validation step during the host creation is the assignment of a resource quota. It fails, if no resource quota is assigned to the new host.

Such assignment cannot be performed when using the host registration.

Possible Solutions

A: Make the resource quota assignment optional in the global settings (Resource quota optional assignment).

B: Implement a default quota. A default quota can be set for a user which is used automatically if none was given.

C: Identify that this host is being registered using the host registration form and make this bypass the validation (→ it is ok to assign no quota if a host is registered using the host registration form)

A can already be used as of now. B and C must be implemented.

maximiliankolb commented 4 months ago

Hey Bastian,

My question: what happens if I edit a VM? Is there a validation when I click "submit"? Could I cheat by registering my existing small VM and then rebuild it to something bigger?

Can you somehow store/differentiate between resources someone consumes and resources they bring by registering an existing host?

bastian-src commented 4 months ago

Thanks for your comment!

Can you somehow store/differentiate between resources someone consumes and resources they bring by registering an existing host?

I gotta check whether such differentiation (a Foreman-deployed host vs an externally registered one) is already done within Foreman. If that's the case, I can easily disregard registered hosts from the resource quota check.

My question: what happens if I edit a VM? Is there a validation when I click "submit"? Could I cheat by registering my existing small VM and then rebuild it to something bigger?

The validation is also executed when editing a host. So, currently such a cheat would not be possible. But, if implementing the first and when a hosts stays "externally registered" even after editing it, such cheat would be made possible.