-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #6835 - support filtered API for oVirt #3288
Conversation
@@ -0,0 +1,5 @@ | |||
class AddFilteredApiToOvirt < ActiveRecord::Migration | |||
def change | |||
add_column :compute_resources, :filtered_api, :boolean, :default => false, :null => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use the serialized attribute instead of adding db columns that do not fit other compute resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, I don't want to :-) especially in this table I don't expect thousands of records and I think the number of downsides it brings is too big (migration touching serialized data, possible inconsistency between two objects of same class, faulty implementation that uses method_missing without defining respond_to?)
@ohadlevy anything else I could do to get this ready for merge? |
Tested and works well. 👍 code-wise from me |
Thank you, setting ready to merge so someone with permissions could merge. |
Sorry, I'm going to unset it unless a committer's reviewed it. (Looks like that's @ohadlevy.) |
/me delegate to @tbrisker :) |
Great, it got things moving :-) Sorry if it was too bold. |
@@ -1,6 +1,7 @@ | |||
<%= text_f f, :url, :size => "col-md-8", :help_block => _("e.g. https://ovirt.example.com/api"), :help_inline => documentation_button('5.2.7oVirt/RHEVNotes') %> | |||
<%= text_f f, :user, :help_block => _("e.g. admin@internal") %> | |||
<%= password_f f, :password, :unset => unset_password? %> | |||
<%= checkbox_f f, :filtered_api, :help_block => _("If you don't have admin permissions you can use slower filtered API, that works with user account."), :label => _('Filtered API') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making the help_block
an inline popover?
Also, nitpick, you are repeating yourself in the text. I think "If you don't have admin permissions you can use slower filtered API."
should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you use :help_inline
instead of :help_block
it should look better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ares tested, this works just fine. Once the comment about the help text is fixed I'll merge. |
@tbrisker I improved error handling that was asked in #3308 (diff). I keep it in separate commit for easier reviewing, I'll squash after review. |
btw tests failures are unrelated |
errors[:url] << _('HTTPS URL is required for API access') | ||
when /insufficient permissions/ | ||
# ovirt does not add code 400 to error message | ||
errors[:user] << e.message + ' ' + _('If your username and password is correct, try using user level API.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also make sure terminology here matches that on the checkbox.
@tbrisker I've modified texts. Sadly, it's not well documented in oVirt docs and it's always the same API just with different header. Anyway I think this should be clear enough now. I also added the value to v2 API. Please re-review. |
@@ -1,6 +1,7 @@ | |||
<%= text_f f, :url, :size => "col-md-8", :help_block => _("e.g. https://ovirt.example.com/api"), :help_inline => documentation_button('5.2.7oVirt/RHEVNotes') %> | |||
<%= text_f f, :user, :help_block => _("e.g. admin@internal") %> | |||
<%= password_f f, :password, :unset => unset_password? %> | |||
<%= checkbox_f f, :filtered_api, :help_inline => _("Use Filter header which makes API limited and slower but is available to non-admin users."), :label => _('User account') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to be nitpicking again on this, I think "Use the 'Filter' header for API calls, which makes them limited and slower, but available to non-admin users."
would be clearer, with the label being Filter API calls
.
Also the help text now breaks a line and looks bad, please reconsider using a popover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No plugin please. This pretty much limits the usage of ovirt just to ones with admin rights. If something changes on ovirt side, we can reconsider, but right now, it's really solving real issue for us (and I expect others are in a situation they can't have admin account)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ohadlevy adding such features is great but I'm not sure whether big setup (probably lower % of users) should cut support for feature that would work only with smaller setups (higher number of users I guess)
I can imagine introducing some capabilities model that would tell us what a given CR is capable of, it could be handy also to manage versions of CR (with different feature sets)
This works and code & text are good to merge as far as I'm concerned once tests finish. |
There are many gaps in the filtered api. It wasn't designed for the use foreman does with the API. |
@oourfali is there a different way to use ovirt API without admin account that foreman (or anything else) could use for automating the provisioning? There was some interest https://bugzilla.redhat.com/show_bug.cgi?id=1123676 |
@oourfali out next step is to add jsessionid support (we already have support on rbovirt side), from the performance reasons. |
The performance aspects are different. Not related to the session id. |
Regardless the performance limitations, I still think not providing the user-level accounts an ability to use Foreman with this credentials is a serious limitation. We have even customer cases already demanding this. If the ovirt has performance limitations on this use-case, I would rather see improvements on the ovirt side to improve this, rather then avoiding using it at all. If the user-level API was officially deprecated and communicated, that this will not be supported anymore (and the question would be when, because if it's too far away, it still might be worth having it here until the day comes). If there are use-cases that the filtered API is not good for, in ideal world the API would be explicit enough about that, when this use comes. On the other hand, I can't think of more basic use-case for a virtualization platform than provisioning a host. I can imagine limiting the other cases (such as listing VMs) not being available in case the calls are deprecated/show serious issues. But the basic end-to-end provisioning via API seems to be valid use-case that I would expect from ovirt to handle without need for admin-level account. From my perspective, this is pretty small change, that unblocks non-admin users using it and can be reverted/disable anytime an Ovirt version is released that deprecates it. What about a note about about the lower performance in the description? |
Foreman is in your hands... We support the user-level API completely, but some things work differently, and some functionality doesn't exist there, by design. we might not be able to handle performance/functionality issues. You recently added paging support by using our search API, which isn't fully supported and won't be supported in the user-level API. You can use that without paging and search and that will probably work (wasn't tested, though) , but as you rely more on the API in other use-cases in Foreman, you might run into using something that doesn't exist in the user level api, and you'll need to block stuff on your side, or suggest alternatives, if the user chose the filtered view. In my opinion the requirement to be admin is reasonable. We require the same on the other side of the integration. Some API calls require you to be an admin. Bottom line, as one of the owners of the oVirt API, my recommendation is not to support that, or support it but block functionality, and in that case we can't promise a blocked functionality will be added, and a performance issue at scale will be resolved. |
Closing, we'll document what admin roles/permissions are required instead. |
No description provided.