lib/client/cluster_api.rb in rbovirt-0.0.15 vs lib/client/cluster_api.rb in rbovirt-0.0.16
- old
+ new
@@ -10,14 +10,15 @@
c.version.split('.')[0] == major
end
def clusters(opts={})
headers = {:accept => "application/xml; detail=datacenters"}
- search= opts[:search] || ("datacenter=%s" % current_datacenter.name)
- http_get("/clusters?search=%s" % CGI.escape(search), headers).xpath('/clusters/cluster').collect do |cl|
+ path = "/clusters"
+ path += search_url(opts) unless filtered_api
+ http_get(path, headers).xpath('/clusters/cluster').collect do |cl|
cluster = OVIRT::Cluster.new(self, cl)
#the following line is needed as a work-around a bug in RHEV 3.0 rest-api
- cluster if cluster.datacenter.id == current_datacenter.id
+ cluster if !filtered_api || (cluster.datacenter.id == current_datacenter.id)
end.compact
end
def cluster(cluster_id)
headers = {:accept => "application/xml; detail=datacenters"}