Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

ares
Copy link
Member

@ares ares commented Mar 8, 2016

No description provided.

@@ -0,0 +1,5 @@
class AddFilteredApiToOvirt < ActiveRecord::Migration
def change
add_column :compute_resources, :filtered_api, :boolean, :default => false, :null => false
Copy link
Member

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?

Copy link
Member Author

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?)

@ares
Copy link
Member Author

ares commented Mar 8, 2016

@ohadlevy anything else I could do to get this ready for merge?

@iNecas
Copy link
Member

iNecas commented Mar 11, 2016

Tested and works well. 👍 code-wise from me

@ares
Copy link
Member Author

ares commented Mar 14, 2016

Thank you, setting ready to merge so someone with permissions could merge.

@domcleal
Copy link
Contributor

Sorry, I'm going to unset it unless a committer's reviewed it. (Looks like that's @ohadlevy.)

@ohadlevy
Copy link
Member

/me delegate to @tbrisker :)

@ares
Copy link
Member Author

ares commented Mar 14, 2016

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') %>
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

that was my first attempt but it looked weird
popover

but I can add it if you think it's better

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if it looks any better
popover1

This is what we have for interfaces flag, also does not look great to me.
popover2

I think I find this the best.
popover3

Which one do you prefer?

@tbrisker
Copy link
Member

@ares tested, this works just fine. Once the comment about the help text is fixed I'll merge.

@ares
Copy link
Member Author

ares commented Mar 15, 2016

@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.

@ares
Copy link
Member Author

ares commented Mar 17, 2016

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.')
Copy link
Member

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.

@ares
Copy link
Member Author

ares commented Mar 17, 2016

@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') %>
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

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

@tbrisker no need to applologize, I'm glad we're moving somewhere. Fixed.

@ohadlevy I'm not sure I properly understand your suggestion, create ovirt plugin that adds this checkbox? On our side it does not add much to maintain. If it does not work on ovirt side, I hope they are willing to fix it.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@ares I'm not aware they prioritize fixing this issue, maybe @oourfali can expand on it?

Copy link
Member Author

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)

@tbrisker
Copy link
Member

This works and code & text are good to merge as far as I'm concerned once tests finish.
However, we need to make a decision whether we want to make this change at all.
I'm afraid I do not have enough experience with oVirt and I don't know enough about users' use cases to make that call, so I will leave that up to those of you who know more to make the decision.

@oourfali
Copy link
Contributor

There are many gaps in the filtered api. It wasn't designed for the use foreman does with the API.
IMHO it shouldn't be pushed, as it might cause other issues. Even if things will work, they will be less performant.

@ares
Copy link
Member Author

ares commented Mar 17, 2016

@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

@iNecas
Copy link
Member

iNecas commented Mar 17, 2016

@oourfali out next step is to add jsessionid support (we already have support on rbovirt side), from the performance reasons.

@oourfali
Copy link
Contributor

The performance aspects are different. Not related to the session id.
The user api works differently, running queries rather than using the search mechanism. So, for different things might be less performant, especially when combined with search.

@iNecas
Copy link
Member

iNecas commented Mar 18, 2016

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?

@oourfali
Copy link
Contributor

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 are also supposed to change the VM MAC address search to be based on our search, rather than searching locally.

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.
Admin doesn't mean super user, btw, you just need to have one admin role assigned to one object, so in case you're managing things through Foreman - the ovirt admin should give you this minimum permission so you can work with it. Thus, I don't see this as a serious limitation.
How many customers asked for that?

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.

@ares
Copy link
Member Author

ares commented Mar 29, 2016

Closing, we'll document what admin roles/permissions are required instead.

@ares ares closed this Mar 29, 2016
@ares ares deleted the fix/6835 branch March 29, 2016 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reached an impasse Needs broader discussion Ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants