Sha256: 0591dc224cb534d923b64e7a2b9ef29f93c7f8c2ae09dc14e9482a72a3feb7f7

Contents?: true

Size: 1.23 KB

Versions: 33

Compression:

Stored size: 1.23 KB

Contents

module OVIRT
  class Client
    def cluster_version(cluster_id)
      c = cluster(cluster_id)
      return c.version.split('.')[0].to_i, c.version.split('.')[1].to_i
    end

    def cluster_version?(cluster_id, major)
      c = cluster(cluster_id)
      c.version.split('.')[0] == major
    end

    def clusters(opts={})
      headers = {:accept => "application/xml; detail=datacenters"}
      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 filtered_api || (cluster.datacenter.id == current_datacenter.id)
      end.compact
    end

    def cluster(cluster_id)
      headers = {:accept => "application/xml; detail=datacenters"}
      cluster_xml = http_get("/clusters/%s" % cluster_id, headers)
      OVIRT::Cluster.new(self, cluster_xml.root)
    end

    def networks(opts)
      cluster_id = opts[:cluster_id] || current_cluster.id
      http_get("/clusters/%s/networks" % cluster_id, http_headers).xpath('/networks/network').collect do |cl|
        OVIRT::Network.new(self, cl)
      end
    end
  end
end

Version data entries

33 entries across 31 versions & 2 rubygems

Version Path
rbovirt-0.1.7 lib/client/cluster_api.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/rbovirt-0.1.6/lib/client/cluster_api.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rbovirt-0.1.6/lib/client/cluster_api.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/rbovirt-0.1.6/lib/client/cluster_api.rb
rbovirt-0.1.6 lib/client/cluster_api.rb
rbovirt-0.1.5 lib/client/cluster_api.rb
rbovirt-0.1.4 lib/client/cluster_api.rb
rbovirt-0.1.3 lib/client/cluster_api.rb
rbovirt-0.1.2 lib/client/cluster_api.rb
rbovirt-0.0.38 lib/client/cluster_api.rb
rbovirt-0.1.1 lib/client/cluster_api.rb
rbovirt-0.0.37 lib/client/cluster_api.rb
rbovirt-0.0.36 lib/client/cluster_api.rb
rbovirt-0.1.0 lib/client/cluster_api.rb
rbovirt-0.0.35 lib/client/cluster_api.rb
rbovirt-0.0.34 lib/client/cluster_api.rb
rbovirt-0.0.33 lib/client/cluster_api.rb
rbovirt-0.0.32 lib/client/cluster_api.rb
rbovirt-0.0.31 lib/client/cluster_api.rb
rbovirt-0.0.30 lib/client/cluster_api.rb