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
Added support for VMS search options max/page #102
Conversation
|
@tbrisker this patch is required to have pagination support for oVirt. This was tested with oVirt 3.6, should work with RHEV. We only need to override |
|
We need to backport this into 0.0.8x branch as well. |
|
@lzap is it possible to also get a total count? it may be required for datatables to do the pagination correctly (it needs to know how many pages there are). |
|
Looks like we need to do separate call: system_service.get.summary.vms.total |
|
Can we do it without total? Because it looks like this will actually slow down cases when you only have dozens of systems. Two calls instead of one. |
|
I have just amended one additional change. This looks for |
| search = opts[:search] || ("datacenter=%s" % current_datacenter.name) | ||
| "?search=%s" % CGI.escape(search) | ||
| search = opts[:search] || ("datacenter=\"%s\"" % current_datacenter.name) | ||
| search += " page #{opts[:page]}" if opts[:page] |
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.
why not be able to pass any search attribute?
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, via search key?
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.
ok, but then you would need to add the datacenter option in foreman then?
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 agree, if I understand correctly the user provided search should be added to the datacenter filter instead of replacing it?
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.
Like that?
|
@tbrisker can you test now? |
|
@lzap Works just fine. |
|
@lzap is it possible to add ordering parameters? |
|
I think that ovirt search supports that already, you just need to pass it
as a search parameter.
|
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
| headers = {:accept => "application/xml"} | ||
| else | ||
| headers = {:accept => "application/xml; detail=disks; detail=nics; detail=hosts"} | ||
| end | ||
| path = "/vms" | ||
| path += search_url(opts) unless 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.
Are all the search options actually limited in the filtered api? if not, please split them so those that are allowed in the filtered api can still be used. (I'm guessing pagination has nothing to do with the 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.
Sorry what?
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.
Currently, all the pagination options will only work if filtered_api is false.
Are these options limited only to the non-filtered api?
Or can they still be used even when accessing the oVirt instance via the 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.
I have no clue.
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.
@oourfali since you originally wrote this line, and going over the ovirt/rhev docs has not given me any insight on this, what options are actually allowed in the filtered api? Could you point us to some place that documents the filtered api's limitations?
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 agree with @ohadlevy, let's get this working so we can paginate the results and handle any issues with the filtered api if we run into them later.
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 are customers who want to use RHEV/oVirt via normal accounts (not admin ones) for some reason apparently.
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.
@lzap thats fine, I just learned that:
- oVirt admin account are not like our accounts, they are closer to roles that are tagged as admin (so you can give more people admin account, limited by its role)
- filtered API is really limited API and uses oVirt search internally (hence you can't use the search again in most / some cases).
Since foreman does not support filtered api, I don't see it as a problem for foreman, nor as a problem to rbovirt (as you will default to previous behaviour) so IMHO this is OK to merge.
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.
|
Since this is subject of backporting and we will be doing this for Satellite, I don't like adding other new features like sorting. Let's keep it smallest possible and plan ordinary feature for that. |
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
|
Merged as b56ec67 and backporting into 0.0 series. |
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
Loading all VMs for the compute resource view can be a very heavy task, which leads to timeouts when attempting to load all VMs for a compute resource that has many hundreds or thousands of VMs. This patch allows us to take advantage of datatable's ability to dynamically load data from the server so we only load 10 VMs at a time. Currently this is only supported for oVirt (dependant on abenari/rbovirt#102 being merged into rbovirt) but can easily be extended for other providers as well.
This adds support for two new options: max and page. This can be used for
pagination. It should work through fog, I need to test tomorrow.