lib/rbovirt.rb in rbovirt-0.0.4 vs lib/rbovirt.rb in rbovirt-0.0.5

- old
+ new

@@ -5,10 +5,11 @@ require "ovirt/storage_domain" require "ovirt/template" require "ovirt/vm" require "ovirt/volume" require "ovirt/interface" +require "ovirt/network" require "nokogiri" require "rest_client" module OVIRT @@ -142,10 +143,17 @@ 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) + 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 def current_datacenter @current_datacenter ||= self.datacenter_id ? datacenter(self.datacenter_id) : datacenters.first end \ No newline at end of file