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

Added support for VMS search options max/page #102

Closed
wants to merge 1 commit into from

Conversation

lzap
Copy link
Collaborator

@lzap lzap commented Mar 8, 2016

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.

@lzap
Copy link
Collaborator Author

lzap commented Mar 8, 2016

@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 vms method in model/ovirt.rb and pass the option hash into Fog driver. It supports it: https://github.com/fog/fog/blob/master/lib/fog/ovirt/requests/compute/list_virtual_machines.rb#L5-L7 so the Foreman change is trivial.

@lzap
Copy link
Collaborator Author

lzap commented Mar 8, 2016

We need to backport this into 0.0.8x branch as well.

@tbrisker
Copy link

tbrisker commented Mar 8, 2016

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

@lzap
Copy link
Collaborator Author

lzap commented Mar 8, 2016

Looks like we need to do separate call: system_service.get.summary.vms.total

@lzap
Copy link
Collaborator Author

lzap commented Mar 9, 2016

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.

@lzap
Copy link
Collaborator Author

lzap commented Mar 9, 2016

I have just amended one additional change. This looks for without_details option and when provided, loading of 150 VMs on slow line (Olomouc -> Boston lab) shortens the total loading time from 17 secs to 5 seconds. Since both rbovirt and fog does not provide VM count number, I recommend to limit the total number of VMs showed in foreman in a global setting value with default of 100. This gives us reasonable times.

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]
Copy link
Contributor

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?

Copy link
Collaborator Author

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?

Copy link
Contributor

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?

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Like that?

@lzap
Copy link
Collaborator Author

lzap commented Mar 11, 2016

@tbrisker can you test now?

@tbrisker
Copy link

@lzap Works just fine.

@tbrisker
Copy link

@lzap is it possible to add ordering parameters?

@ohadlevy
Copy link
Contributor

ohadlevy commented Mar 13, 2016 via email

tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 13, 2016
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.
tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 13, 2016
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.
tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 13, 2016
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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry what?

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have no clue.

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Choose a reason for hiding this comment

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

@lzap It seems that limitations to oVirt's filtered api prevent any sort of searching or pagination for non-admin users (@oourfali @jhernand - correct me if I'm wrong). I suggest we get this working for admin users first, and see what we can do about non-admins at a later stage.

@lzap
Copy link
Collaborator Author

lzap commented Mar 16, 2016

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.

tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 16, 2016
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.
tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 16, 2016
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.
@lzap
Copy link
Collaborator Author

lzap commented Mar 17, 2016

Merged as b56ec67 and backporting into 0.0 series.

@lzap lzap closed this Mar 17, 2016
@lzap lzap deleted the pagination branch March 17, 2016 10:24
tbrisker added a commit to tbrisker/foreman that referenced this pull request Mar 17, 2016
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.
lzap pushed a commit to theforeman/foreman that referenced this pull request Mar 18, 2016
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.
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.

None yet

4 participants