Sha256: 9db454ba2cd62e846edf602c59e3d0bde2c44d210b548453e9ddaa4554caec76

Contents?: true

Size: 686 Bytes

Versions: 5

Compression:

Stored size: 686 Bytes

Contents

module OVIRT
  class Client
    def storagedomain(sd_id)
      sd = http_get("/storagedomains/%s" % sd_id)
      OVIRT::StorageDomain::new(self, sd.root)
    end

    def storagedomains(opts={})
      search= opts[:search] || ("datacenter=%s" % current_datacenter.name)
      http_get("/storagedomains?search=%s" % CGI.escape(search)).xpath('/storage_domains/storage_domain').collect do |sd|
        storage_domain = OVIRT::StorageDomain::new(self, sd)
        #filter by role is not supported by the search language. The work around is to list all, then filter.
        (opts[:role].nil? || storage_domain.role == opts[:role]) ? storage_domain : nil
      end.compact
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbovirt-0.0.15 lib/client/storage_domain_api.rb
rbovirt-0.0.14 lib/client/storage_domain_api.rb
rbovirt-0.0.13 lib/client/storage_domain_api.rb
rbovirt-0.0.12 lib/client/storage_domain_api.rb
rbovirt-0.0.11 lib/client/storage_domain_api.rb