incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1095516 [1/4] - in /incubator/deltacloud/trunk/server: lib/deltacloud/drivers/rhevm/ tests/drivers/rhevm/ tests/drivers/rhevm/fixtures/
Date Wed, 20 Apr 2011 21:25:33 GMT
Author: mfojtik
Date: Wed Apr 20 21:25:31 2011
New Revision: 1095516

URL: http://svn.apache.org/viewvc?rev=1095516&view=rev
Log:
Code cleanup in RHEV-M client and added support for 9.2 milestone of RHEV-M REST API

Added:
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1af892fbbfb755ca03f1811656cc8e3d1b420574.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-9d3f53d21c21757854e4d7389936988c0926a9fa.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-00aa4ce291425cddda060610af1e2b78b3cf33e3.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-074acfab72ac40f5af853ff52dac39f9173c4307.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-33a70f1ed1ea33cb209804a2470bb87278c06c8a.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-37f932402c97a6c4549f109edb33055fe6781cf1.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-3ec2d121b6e2515036b0c0553f4a4a9f8806265f.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-47bd80314ec170ee08a56fde4a64daa5d2ec32b2.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-50f72766b065ab7e770c19e6108605ecb45b5680.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-5480c0954736af37bd6c45bbb97af0dd2aff1e18.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-5ac72e96eac9b6ecdad2b1e8fbf059ccb01ea4d1.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-63e31fa4abb03ce3ced734b14d2c08b803cadf6a.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-6e9c26487ca34873261a95cf1c769ee4fc5d1f45.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-70c8beddbd85ea713b95923a655c600ad7e5b02a.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-7addf8136843c7721cfbf349f218b53c24d8c5c1.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-9b42595ade5956e2a479d4d55ff1f87f27c80557.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-9dbb57e652dc0df6b0c38917500240a78068d282.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-9e6bdce6d894c0bdc1416c292a9c1276d94dacaa.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-a27ff728fbf0908dc321f8112eb92c54413bc626.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-b725e6609631e772cd5d959e1e5f89745ca1e16c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-be045aca4b4efa1b0b410ce93fd2d4a25ed58336.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-c3a26ca10909a44f5ecaf01f6368c942e4d0189d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-e35967943cfbfa708dd75761107adfd7cfa9c31d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-f3865f3833d2c30eddcaec678cafd8ca6595003e.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-4e1a0e33822815562beb69261ce28bc3ad0d015c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-872f5c5d048a598a1355c166ffd921f55ed450aa.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-87a5a627cece4153c3fff405d573202332a26062.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-cc2023c9b8e63403223e142622ea7f300762eb0c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-dcf49f698d1e58513843690cf4f18afdc37c7309.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-e03c1ee0f5a68178db2cbd7a298e3c5fc430bb6f.yml
Removed:
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1a9b2a10d0ae75cb896ec0f7eab763a24655be5d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-3a4e4d1322c4d156f0deb494c393279988bbd39a.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-016edb2a494ed85580278b0c6c3f1a4479b5085c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0ba2d49323703782cd30a091384b20893d622123.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-3077509564f1476d2c3af4b49e35037942eff7aa.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-3c07aabee09e6505d0988439f73266254982d41d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-8c8d35995dba82349983c9032d47dd60b35ea21c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-c666a67647a7f83115966459e8ea8cdd6890db16.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-db47714d43ffdab799b3e39b16614715c7329fd8.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-edbf9da8eda44c7ca19c7838c9399f0ef29d1bf0.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-ef9d972f1dd070df8726d95ce02053822513a03f.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-2795a0c64909909bc4d9e489c35977f40afdf74c.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-363723759af2ac2362dac729f82e0956276138e8.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-639022a9b1093eab3f5a15c8b41f9056ad065fa0.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-760971439d11d63dacee8b8a52d6609057bf4b5b.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-b27572686072b5dc8f8aa723eff53049c22419ce.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/post-e6a1deb5e8f63747ba36351f2c1a35ee81ae755b.yml
Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0f50173e8cba941468c17039c11d63e940e351f7.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-163a76f09d41670494c54dcd2eab373a5588683d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-620965396fa389179e1f43d6a4e553d9a8ad9523.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-dd7d02910e76e86ce94d113c1175f2ddb2ec711d.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-f1d6fe5300bb627fd7d85a415b2e1a6ffe3194af.yml
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/hardware_profiles_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/rhevm/instances_test.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb?rev=1095516&r1=1095515&r2=1095516&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb Wed Apr 20 21:25:31 2011
@@ -1,19 +1,4 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
+require 'rubygems'
 require 'base64'
 require 'restclient'
 require 'nokogiri'
@@ -22,281 +7,326 @@ require 'json'
 
 module RHEVM
 
-  class FixtureNotFound < Exception; end
-  class ConnectionError < StandardError
-    attr_reader :code, :cause, :details
-    def initialize(code, cause, message, details)
-      super(message)
-      @code = code
-      @cause = cause
-      @details = details
-    end
+  def self.client(url)
+    RestClient::Resource.new(url)
   end
 
   class Client
 
-    attr_reader :base_uri
-    attr_reader :host
-    attr_reader :entry_points
-    attr_reader :username
-
-    # Define a list of supported collections which will be handled automatically
-    # by method_missing
-    @@COLLECTIONS = [ :templates, :clusters, :storagedomains, :vms, :datacenters ]
-
-    def initialize(username, password, base_uri, opts={})
-      @username, @password = username, password
-      uri = URI.parse(base_uri)
-      @host = "#{uri.scheme}://#{uri.host}:#{uri.port}"
-      @base_uri = base_uri
-      @entry_points = {}
-      discover_entry_points()
+    attr_reader :credentials, :api_entrypoint
+
+    def initialize(username, password, api_entrypoint)
+      @credentials = { :username => username, :password => password }
+      @api_entrypoint = api_entrypoint
     end
 
-    def method_missing(method_name, *args)
-      opts = args[0] if args[0].class.eql?(Hash)
-      opts ||= {}
-      if @@COLLECTIONS.include?(method_name.to_sym)
-        if opts[:id]
-          object = Nokogiri::XML(get("#{@entry_points[method_name.to_s]}/#{opts[:id]}"))
-          element = method_name.to_s
-          element = 'data_centers' if method_name.eql?(:datacenters)
-          @current_element = element
-          inst = ::RHEVM.const_get(element.classify)
-          return inst::new(self, object)
-        else
-          objects = Nokogiri::XML(get(@entry_points[method_name.to_s]))
-          objects_arr = []
-          element = method_name.to_s
-          # FIXME:
-          # This is an exception/or bug in RHEV-M API:
-          # (uri is /datacenters but root element it 'data_centers')
-          element = 'data_centers' if method_name.eql?(:datacenters)
-          element = 'storage_domains' if method_name.eql?(:storagedomains)
-          @current_element = element
-          (objects/"#{element}/#{element.singularize}").each do |item|
-            inst = ::RHEVM.const_get(element.classify)
-            objects_arr << inst.new(self, item)
-          end
-          return objects_arr
+    def vms(opts={})
+      headers = {
+        :accept => "application/xml; detail=disks; detail=nics; detail=hosts"
+      }
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/vms/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::VM::new(self, vm)]
+      else
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/vms"].get(headers)).xpath('/vms/vm').collect do |vm|
+          RHEVM::VM::new(self, vm)
         end
       end
     end
 
-    def vm_action(action, vm)
-      response = post("#{@base_uri}/vms/#{vm}/%s" % action)
-      Nokogiri::XML(response)
-    end
-
-    def create_vm(opts="")
-      (Nokogiri::XML(post("#{@base_uri}/vms", opts))/'vm').first
+    def vm_action(id, action, headers={})
+      headers.merge!(auth_header)
+      headers.merge!({
+        :content_type => 'application/xml',
+        :accept => 'application/xml',
+      })
+      if action==:delete
+        RHEVM::client(@api_entrypoint)["/vms/%s" % id].delete(headers)
+      else
+        xml_response = Client::parse_response(RHEVM::client(@api_entrypoint)["/vms/%s/%s" % [id, action]].post('<action/>', headers))
+        return false if (xml_response/'action/status').first.text!="COMPLETE"
+      end
+      return true
     end
 
-    def delete_vm(id)
-      delete("#{@base_uri}/vms/#{id}")
+    def create_vm(template_id, opts={})
+      opts ||= {}
+      builder = Nokogiri::XML::Builder.new do
+        vm {
+          name opts[:name] || "i-#{Time.now.to_i}"
+          template_(:id => template_id)
+          cluster(:id => opts[:realm_id] || clusters.first.id)
+          type_ opts[:hwp_id] || 'desktop'
+          memory opts[:hwp_memory] || (512*1024*1024).to_s
+          cpu {
+            topology( :cores => (opts[:hwp_cpu] || '1'), :sockets => '1' )
+          }
+        }
+      end
+      headers = opts[:headers] || {}
+      headers.merge!({
+        :content_type => 'application/xml',
+        :accept => 'application/xml',
+      })
+      headers.merge!(auth_header)
+      vm = RHEVM::client(@api_entrypoint)["/vms"].post(Nokogiri::XML(builder.to_xml).root.to_s, headers)
+      RHEVM::VM::new(self, Nokogiri::XML(vm).root)
     end
 
-    def delete(uri)
+    def templates(opts={})
       headers = {
-        :authorization => "Basic " + Base64.encode64("#{@username}:#{@password}"),
-        :accept => 'application/xml',
+        :accept => "application/xml"
       }
-      RestClient.delete(uri, headers).to_s
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/templates/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::Template::new(self, vm)]
+      else
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/templates"].get(headers)).xpath('/templates/template').collect do |vm|
+          RHEVM::Template::new(self, vm)
+        end
+      end
     end
 
-    def get(uri)
+    def clusters(opts={})
       headers = {
-        :authorization => "Basic " + Base64.encode64("#{@username}:#{@password}"),
-        :accept => 'application/xml',
+        :accept => "application/xml; detail=datacenters"
       }
-      begin
-        response = RestClient.get(uri, headers).to_s
-      rescue Exception => e
-        raise ConnectionError::new(500, "GET #{uri}", "#{e.message} (GET #{uri})", e.backtrace)
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/clusters/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::Cluster::new(self, vm)]
+      else
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/clusters"].get(headers)).xpath('/clusters/cluster').collect do |vm|
+          RHEVM::Cluster::new(self, vm)
+        end
       end
-      response
     end
 
-    def post(uri, params="")
+    def datacenters(opts={})
       headers = {
-        :authorization => "Basic " + Base64.encode64("#{@username}:#{@password}"),
-        :accept => 'application/xml',
-        :content_type => 'application/xml'
+        :accept => "application/xml"
       }
-      params = "<action/>" if params.size==0
-      RestClient.post(uri, params, headers).to_s
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/datacenters/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::DataCenter::new(self, vm)]
+      else
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/datacenters"].get(headers)).xpath('/data_centers/data_center').collect do |vm|
+          RHEVM::DataCenter::new(self, vm)
+        end
+      end
     end
 
-    def discover_entry_points()
-      return if @discovered
-      begin
-        doc = Nokogiri.XML(get(@base_uri))
-      rescue Exception => e
-        raise ConnectionError::new(500, "RHEV-M Connection Error (#{@base_uri})", "#{e.message} (#{@base_uri})", e.backtrace)
-      end
-      doc.xpath('api/link').each() do |link|
-        @entry_points[link['rel']] = @host + link['href']
+    def hosts(opts={})
+      headers = {
+        :accept => "application/xml"
+      }
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/hosts/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::Host::new(self, vm)]
+      else
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/hosts"].get(headers)).xpath('/hosts/host').collect do |vm|
+          RHEVM::Host::new(self, vm)
+        end
       end
-      @discovered = true
     end
 
-    def read_fake_url(filename)
-      fixture_file = "../tests/rhevm/support/fixtures/#{filename}"
-      if File.exists?(fixture_file)
-        return JSON::parse(File.read(fixture_file))
+    def storagedomains(opts={})
+      headers = {
+        :accept => "application/xml"
+      }
+      headers.merge!(auth_header)
+      if opts[:id]
+        vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/storagedomains/%s" % opts[:id]].get(headers)).root
+        [ RHEVM::StorageDomain::new(self, vm)]
       else
-        raise FixtureNotFound.new
+        Client::parse_response(RHEVM::client(@api_entrypoint)["/storagedomains"].get(headers)).xpath('/storage_domains/storage_domain').collect do |vm|
+          RHEVM::StorageDomain::new(self, vm)
+        end
       end
     end
 
-    def singularize(str)
-      str.gsub(/s$/, '')
+    def auth_header
+      { :authorization => "Basic " + Base64.encode64("#{@credentials[:username]}:#{@credentials[:password]}"), }
+    end
+
+    def base_url
+      url = URI.parse(@api_entrypoint)
+      "#{url.scheme}://#{url.host}:#{url.port}"
+    end
+
+    def self.parse_response(response)
+      Nokogiri::XML(response)
     end
 
   end
 
-  class BaseModel
-    attr_accessor(:id, :href, :name)
+  class BaseObject
+    attr_accessor :id, :href, :name
+    attr_reader :client
 
-    def initialize(client, xml)
+    def initialize(client, id, href, name)
+      @id, @href, @name = id, href, name
       @client = client
-      @id = xml[:id]
-      @href = "#{@client.base_uri}#{xml[:href]}"
-      @name = xml.xpath('name').text
+      self
     end
+
   end
 
-  class StorageDomain < BaseModel
-    attr_accessor(:status, :storage_type, :storage_address, :storage_path)
-    attr_accessor(:name, :available, :used, :kind)
+  class Link
+    attr_accessor :id, :href, :client
 
-    def initialize(client, xml)
-      super(client, xml)
-      @kind = xml.xpath('type').text
-      @name = xml.xpath('name').text
-      @storage_type = xml.xpath('storage/type').text
-      @storage_address = xml.xpath('storage/address').text
-      @storage_path = xml.xpath('storage/path').text
-      @address = xml.xpath('storage/address').text
-      @available = xml.xpath('available').text.to_f
-      @used= xml.xpath('used').text.to_f
+    def initialize(client, id, href)
+      @id, @href = id, href
+      @client = client
+    end
+
+    def follow
+      xml = Client::parse_response(RHEVM::client(@client.base_url)[@href].get(@client.auth_header))
+      object_class = ::RHEVM.const_get(xml.root.name.camelize)
+      object_class.new(@client, (xml.root))
     end
+
   end
 
-  class Vm < BaseModel
-    attr_accessor(:status, :memory, :sockets, :cores, :bootdevs, :host, :cluster, :template, :vmpool, :profile)
-    attr_accessor(:creation_time, :storage, :nics, :display)
+  class VM < BaseObject
+    attr_reader :description, :status, :memory, :profile, :display, :host, :cluster, :template, :macs
+    attr_reader :storage, :cores, :username, :creation_time
+    attr_reader :ip
 
     def initialize(client, xml)
-      super(client, xml)
-      @status = xml.xpath('status').text
-      @memory = xml.xpath('memory').text.to_f
-      @profile = xml.xpath('type').text
-      @sockets = xml.xpath('cpu/topology').first[:sockets] rescue ''
-      @cores = xml.xpath('cpu/topology').first[:cores] rescue ''
-      @bootdevs = []
-      xml.xpath('os/boot').each do |boot|
-        @bootdevs << boot[:dev]
-      end
-      @host = xml.xpath('host')[:id]
-      @cluster = xml.xpath('cluster').first[:id]
-      @template = xml.xpath('template').first[:id]
-      @vmpool = xml.xpath('vmpool').first[:id] if xml.xpath('vmpool').size >0
-      @creation_time = xml.xpath('creation_time').text
-      storage_link = xml.xpath('link[@rel="disks"]').first[:href]
-      disks_response = Nokogiri::XML(client.get("#{client.host}#{storage_link}"))
-      @storage = disks_response.xpath('disks/disk/size').collect { |s| s.text.to_f }
-      @storage = @storage.inject(nil) { |p, i| p ? p+i : i }
-      @display = {
-        :type => (xml/'display/type').text,
-        :address => (xml/'display/address').text,
-        :port => (xml/'display/port').text
-      } if (xml/'display')
-      @nics = get_nics(client, xml)
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      @username = client.credentials[:username]
+      parse_xml_attributes!(xml)
       self
     end
 
-    def get_nics(client, xml)
-      nics = []
-      doc = Nokogiri::XML(client.get(client.host + (xml/'link[@rel="nics"]').first[:href]))
-      (doc/'nics/nic').each do |nic|
-        nics << {
-          :mac => (nic/'mac').first[:address],
-          :address => (nic/'ip').first ? (nic/'ip').first[:address]  : nil
-        }
-      end
-      nics
+    private
+
+    def parse_xml_attributes!(xml)
+      @description = (xml/'description').first.text
+      @status = (xml/'status').first.text
+      @memory = (xml/'memory').first.text
+      @profile = (xml/'type').first.text
+      @template = Link::new(@client, (xml/'template').first[:id], (xml/'template').first[:href])
+      @host = Link::new(@client, (xml/'host').first[:id], (xml/'host').first[:href]) rescue nil
+      @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href])
+      @display = {
+        :type => (xml/'display/type').first.text,
+        :address => ((xml/'display/address').first.text rescue nil),
+        :port => ((xml/'display/port').first.text rescue nil),
+        :monitors => (xml/'display/monitors').first.text
+      }
+      @cores = ((xml/'cpu/topology').first[:cores] rescue nil)
+      @storage = ((xml/'disks/disk/size').first.text rescue nil)
+      @macs = (xml/'nics/nic/mac').collect { |mac| mac[:address] }
+      @creation_time = (xml/'creation_time').text
+      @ip = ((xml/'guest_info/ip').first[:address] rescue nil)
     end
 
   end
 
-  class Template < BaseModel
-    attr_accessor(:status, :memory, :name, :description)
-    
+  class Template < BaseObject
+    attr_reader :description, :status, :cluster
+
     def initialize(client, xml)
-      super(client, xml)
-      @status = (xml/'status').text
-      @memory = (xml/'memory').text
-      @description = (xml/'description').text
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      parse_xml_attributes!(xml)
+      self
     end
-  end
 
-  class DataCenter < BaseModel
-    attr_accessor :name, :storage_type, :description, :status
+    private
 
-    def initialize(client, xml)
-      super(client, xml)
-      @name, @storage_type, @description = (xml/'name').text, (xml/'storage_type').text, (xml/'description').text
-      @status = (xml/'status').text
+    def parse_xml_attributes!(xml)
+      @description = ((xml/'description').first.text rescue nil)
+      @status = (xml/'status').first.text
+      @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href])
     end
   end
 
-  class Cluster < BaseModel
-    attr_accessor :name, :datacenter_id, :cpu
+  class Cluster < BaseObject
+    attr_reader :description, :datacenter
 
     def initialize(client, xml)
-      super(client, xml)
-      @name = (xml/'name').text
-      @datacenter_id = (xml/'data_center').first['id']
-      @cpu = (xml/'cpu').first['id']
-      @name = (xml/'name').text
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      parse_xml_attributes!(xml)
+      self
+    end
+
+    private
+
+    def parse_xml_attributes!(xml)
+      @description = ((xml/'description').first.text rescue nil)
+      @datacenter = Link::new(@client, (xml/'data_center').first[:id], (xml/'data_center').first[:href])
     end
   end
 
-end
+  class DataCenter < BaseObject
+    attr_reader :description, :status
 
-class String
+    def initialize(client, xml)
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      parse_xml_attributes!(xml)
+      self
+    end
 
-  unless method_defined?(:classify)
-    # Create a class name from string
-    def classify
-      self.singularize.camelize
+    private
+
+    def parse_xml_attributes!(xml)
+      @description = ((xml/'description').first.text rescue nil)
+      @status = (xml/'status').first.text
     end
   end
 
-  unless method_defined?(:camelize)
-    # Camelize converts strings to UpperCamelCase
-    def camelize
-      self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
+  class Host < BaseObject
+    attr_reader :description, :status, :cluster
+
+    def initialize(client, xml)
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      parse_xml_attributes!(xml)
+      self
     end
-  end
 
-  unless method_defined?(:singularize)
-    # Strip 's' character from end of string
-    def singularize
-      self.gsub(/s$/, '')
+    private
+
+    def parse_xml_attributes!(xml)
+      @description = ((xml/'description').first.text rescue nil)
+      @status = (xml/'status').first.text
+      @clister = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href])
     end
   end
 
-  # Convert string to float if string value seems like Float
-  def convert
-    return self.to_f if self.strip =~ /^([\d\.]+$)/
-    self
-  end
+  class StorageDomain < BaseObject
+    attr_reader :available, :used, :kind, :address, :path
+
+    def initialize(client, xml)
+      super(client, xml[:id], xml[:href], (xml/'name').first.text)
+      parse_xml_attributes!(xml)
+      self
+    end
 
-  # Simply converts whitespaces and - symbols to '_' which is safe for Ruby
-  def sanitize
-    self.strip.gsub(/(\W+)/, '_')
+    private
+
+    def parse_xml_attributes!(xml)
+      @available = (xml/'available').first.text
+      @used = (xml/'used').first.text
+      @kind = (xml/'storage/type').first.text
+      @address = ((xml/'storage/address').first.text rescue nil)
+      @path = ((xml/'storage/path').first.text rescue nil)
+    end
   end
+  
+end
 
+class String
+  unless method_defined?(:camelize)
+    # Camelize converts strings to UpperCamelCase
+    def camelize
+      self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
+    end
+  end
 end
+

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb?rev=1095516&r1=1095515&r2=1095516&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb Wed Apr 20 21:25:31 2011
@@ -42,14 +42,14 @@ class RHEVMDriver < Deltacloud::BaseDriv
   # Values like RAM or STORAGE are reported by VM
   # so they are not static.
 
-  define_hardware_profile 'SERVER' do
+  define_hardware_profile 'server' do
     cpu         ( 1..4 )
     memory      ( 512 .. 32*1024 )
     storage     ( 1 .. 100*1024 )
     architecture 'x86_64'
   end
 
-  define_hardware_profile 'DESKTOP' do
+  define_hardware_profile 'desktop' do
     cpu         ( 1..4 )
     memory      ( 512 .. 32*1024 )
     storage     ( 1 .. 100*1024 )
@@ -77,13 +77,9 @@ class RHEVMDriver < Deltacloud::BaseDriv
     start.to( :pending )          .automatically
     pending.to( :running )        .automatically
     pending.to( :stopped )        .automatically
-    pending.to( :finish )         .on(:destroy)
     stopped.to( :running )        .on( :start )
-    stopped.to( :finish )         .on( :destroy )
-    running.to( :running )        .on( :reboot )
     running.to( :stopping )       .on( :stop )
-    shutting_down.to( :stopped )  .automatically
-    stopped.to( :finish )         .automatically
+    stopped.to( :finish )         .on( :destroy )
   end
 
   #
@@ -96,7 +92,7 @@ class RHEVMDriver < Deltacloud::BaseDriv
     safely do
       clusters = client.clusters
       clusters.each do |r|
-        d = client.datacenters(:id => r.datacenter_id)
+        d = client.datacenters(:id => r.datacenter.id).first
         realm_arr << convert_realm(r, d)
       end
     end
@@ -123,7 +119,11 @@ class RHEVMDriver < Deltacloud::BaseDriv
     client = new_client(credentials)
     inst_arr = []
     safely do
-      vms = client.vms
+      if opts[:id]
+        vms = client.vms(:id => opts[:id])
+      else
+        vms = client.vms
+      end
       vms.each do |vm|
         inst_arr << convert_instance(client, vm)
       end
@@ -135,21 +135,21 @@ class RHEVMDriver < Deltacloud::BaseDriv
   def start_instance(credentials, id)
     client = new_client(credentials)
     safely do
-      client.vm_action(:start, id)
+      raise "ERROR: Operation start failed" unless client.vm_action(id, :start)
     end
   end
 
   def stop_instance(credentials, id)
     client = new_client(credentials)
     safely do
-      client.vm_action(:shutdown, id)
+      raise "ERROR: Operation start failed" unless client.vm_action(id, :shutdown)
     end
   end
 
   def destroy_instance(credentials, id)
     client = new_client(credentials)
     safely do
-      client.delete_vm(id)
+      raise "ERROR: Operation start failed" unless client.vm_action(id, :delete)
     end
   end
 
@@ -167,29 +167,14 @@ class RHEVMDriver < Deltacloud::BaseDriv
 
   def create_instance(credentials, image_id, opts={})
     client = new_client(credentials)
+    params = {}
     safely do
-      # TODO: Add setting CPU topology here
-      # FIXME: Condor is using GlobalJobId here as a name, which is malformed
-      #        and contains >50 characters
-      #
-      # FIXME: Memory calculation is wrong in Conductor, they are sending value/1024
-      #
-      vm_name = opts[:name] ? "<name>#{opts[:name].split("#").last}</name>" : "<name>#{Time.now.to_i}</name>"
-      vm_template = "<template id='#{image_id}'/>"
-      vm_cluster = opts[:realm_id] ? "<cluster id='#{opts[:realm_id]}'/>" : "<cluster id='0'/>"
-      vm_type = opts[:hwp_id] ? "<type>#{opts[:hwp_id].upcase}</type>" : "<type>DESKTOP</type>"
-      vm_memory = opts[:hwp_memory] ? "<memory>#{opts[:hwp_memory].to_i*1024*1024}</memory>"  : ''
-      vm_cpus = opts[:hwp_cpu] ? "<cpu><topology cores='#{opts[:hwp_cpu]}' sockets='1'/></cpu>"  : ''
-      xml = "<vm>"+
-        vm_name +
-        vm_template +
-        vm_cluster +
-        vm_type +
-        vm_memory +
-        vm_cpus +
-        "</vm>"
-      # TODO: Add storage here (it isn't supported by RHEV-M API so far)
-      convert_instance(client, ::RHEVM::Vm::new(client, client.create_vm(xml)))
+      params[:name] = opts[:name] if opts[:name]
+      params[:realm_id] = opts[:realm_id] if opts[:realm_id]
+      params[:hwp_id] = opts[:hwp_id] if opts[:hwp_id]
+      params[:hwp_memory] = opts[:hwp_memory] if opts[:hwp_memory]
+      params[:hwp_cpu] = opts[:hwp_cpu] if opts[:hwp_cpu]
+      convert_instance(client, client.create_vm(image_id, params))
     end
   end
 
@@ -214,34 +199,25 @@ class RHEVMDriver < Deltacloud::BaseDriv
 
   def convert_instance(client, inst)
     state = convert_state(inst.status)
-    storage_size = inst.storage.nil? ? 1 :  (inst.storage/1024/1024)
+    storage_size = inst.storage.nil? ? 1 :  (inst.storage.to_i/1048576/100)
     profile = InstanceProfile::new(inst.profile, 
-                                   :hwp_memory => inst.memory/1024,
+                                   :hwp_memory => inst.memory.to_i/1024/1204,
                                    :hwp_cpu => inst.cores,
                                    :hwp_storage => "#{storage_size}"
     )
     # Include VNC and SPICE addresses
-    if inst.display
-      display_address = { 
-        :type => inst.display[:type],
-        :address => inst.display[:address],
-        :port => inst.display[:port]
-      }
-    end
-    public_addresses = []
-    unless inst.nics.empty?
-      inst.nics.each do |nic|
-        public_addresses << { :address => nic[:address], :mac => nic[:mac]}
-      end
+    if inst.ip
+      public_addresses = [ inst.ip ]
+    else
+      public_addresses = [ inst.macs ]
     end
-    public_addresses << display_address if display_address
     Instance.new(
       :id => inst.id,
       :name => inst.name,
       :state => state,
-      :image_id => inst.template,
-      :realm_id => inst.cluster,
-      :owner_id => client.username,
+      :image_id => inst.template.id,
+      :realm_id => inst.cluster.id,
+      :owner_id => inst.username,
       :launch_time => inst.creation_time,
       :instance_profile => profile,
       :hardware_profile_id => profile.id,
@@ -260,12 +236,11 @@ class RHEVMDriver < Deltacloud::BaseDriv
   def convert_state(state)
     case state
     when 'WAIT_FOR_LAUNCH', 'REBOOT_IN_PROGRESS', 'SAVING_STATE',
-      'RESTORING_STATE', 'POWERING_DOWN' then
+      'RESTORING_STATE', 'POWERING_DOWN', 'POWERING_UP', 'IMAGE_LOCKED', 'SAVING_STATE' then
       'PENDING'
-    when 'UNASSIGNED', 'DOWN', 'POWERING_DOWN', 'PAUSED', 'NOT_RESPONDING', 'SAVING_STATE', 
-      'SUSPENDED', 'IMAGE_ILLEGAL', 'IMAGE_LOCKED', 'UNKNOWN' then
+    when 'UNASSIGNED', 'DOWN', 'PAUSED', 'NOT_RESPONDING', 'SUSPENDED', 'IMAGE_ILLEGAL', 'UNKNOWN' then
       'STOPPED'
-    when 'POWERING_UP', 'UP', 'MIGRATING_TO', 'MIGRATING_FROM'
+    when 'UP', 'MIGRATING_TO', 'MIGRATING_FROM'
       'RUNNING'
     end
   end
@@ -274,11 +249,11 @@ class RHEVMDriver < Deltacloud::BaseDriv
     StorageVolume.new(
       :id => volume.id,
       :state => 'AVAILABLE',
-      :capacity => ((volume.available-volume.used)/1024/1024).abs,
+      :capacity => ((volume.available.to_i-volume.used.to_i)/1024/1024).abs,
       :instance_id => nil,
       :kind => volume.kind,
       :name => volume.name,
-      :device => "#{volume.storage_address}:#{volume.storage_path}"
+      :device => volume.address ? "#{volume.address}:#{volume.path}" : nil
     )
   end
 
@@ -287,7 +262,7 @@ class RHEVMDriver < Deltacloud::BaseDriv
       :id => img.id,
       :name => img.name,
       :description => img.description,
-      :owner_id => client.username,
+      :owner_id => client.credentials[:username],
       :architecture => 'x86_64', # All RHEV-M VMs are x86_64
       :state => img.status
     )

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1af892fbbfb755ca03f1811656cc8e3d1b420574.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1af892fbbfb755ca03f1811656cc8e3d1b420574.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1af892fbbfb755ca03f1811656cc8e3d1b420574.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-1af892fbbfb755ca03f1811656cc8e3d1b420574.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,135 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:22:15 GMT
+      content-length: 
+      - "3525"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7">
+          <name>mock-test2</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/statistics"/>
+          <type>server</type>
+          <status>DOWN</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <port>5919</port>
+              <monitors>1</monitors>
+          </display>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="b68b8d09-6696-4f16-ba71-5d11d68cf81d">
+                  <description>_mock-test2_4/20/2011 1:18:26 PM</description>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="60bd2833-83fd-4396-b677-6ee6b4613534">
+                  <name>nic1</name>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5f"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :delete
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7
+    body: 
+    headers: 
+      accept: 
+      - application/xml
+      content-type: 
+      - application/xml
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 204
+      message: No Content
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:22:51 GMT
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: 
+    http_version: "1.1"

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-9d3f53d21c21757854e4d7389936988c0926a9fa.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-9d3f53d21c21757854e4d7389936988c0926a9fa.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-9d3f53d21c21757854e4d7389936988c0926a9fa.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/delete-9d3f53d21c21757854e4d7389936988c0926a9fa.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,135 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:21:12 GMT
+      content-length: 
+      - "3526"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413">
+          <name>mock-test1</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/statistics"/>
+          <type>desktop</type>
+          <status>DOWN</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <port>5914</port>
+              <monitors>1</monitors>
+          </display>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="5781a459-0055-4a01-8b6f-5886b6fac325">
+                  <description>_mock-test1_4/20/2011 1:18:23 PM</description>
+                  <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="64ea1a12-03e0-46bf-a719-340301ff16ce">
+                  <name>nic1</name>
+                  <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5e"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :delete
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413
+    body: 
+    headers: 
+      accept: 
+      - application/xml
+      content-type: 
+      - application/xml
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 204
+      message: No Content
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:21:24 GMT
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: 
+    http_version: "1.1"

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-00aa4ce291425cddda060610af1e2b78b3cf33e3.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-00aa4ce291425cddda060610af1e2b78b3cf33e3.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-00aa4ce291425cddda060610af1e2b78b3cf33e3.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-00aa4ce291425cddda060610af1e2b78b3cf33e3.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,109 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:19:33 GMT
+      content-length: 
+      - "3683"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413">
+          <name>mock-test1</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/52ccd5ee-5a6e-4dea-8ed1-f26e57766413/statistics"/>
+          <type>desktop</type>
+          <status>POWERING_UP</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <address>10.34.32.183</address>
+              <port>5914</port>
+              <monitors>1</monitors>
+          </display>
+          <host id="0" href="/rhevm-api-powershell/hosts/0"/>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <start_time>2011-04-20T20:18:48.009Z</start_time>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="5781a459-0055-4a01-8b6f-5886b6fac325">
+                  <description>_mock-test1_4/20/2011 1:18:23 PM</description>
+                  <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="64ea1a12-03e0-46bf-a719-340301ff16ce">
+                  <name>nic1</name>
+                  <vm id="52ccd5ee-5a6e-4dea-8ed1-f26e57766413"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5e"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-074acfab72ac40f5af853ff52dac39f9173c4307.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-074acfab72ac40f5af853ff52dac39f9173c4307.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-074acfab72ac40f5af853ff52dac39f9173c4307.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-074acfab72ac40f5af853ff52dac39f9173c4307.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,109 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:21:06 GMT
+      content-length: 
+      - "3684"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7">
+          <name>mock-test2</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/statistics"/>
+          <type>server</type>
+          <status>POWERING_DOWN</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <address>10.34.32.183</address>
+              <port>5919</port>
+              <monitors>1</monitors>
+          </display>
+          <host id="0" href="/rhevm-api-powershell/hosts/0"/>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <start_time>2011-04-20T20:18:51.456Z</start_time>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="b68b8d09-6696-4f16-ba71-5d11d68cf81d">
+                  <description>_mock-test2_4/20/2011 1:18:26 PM</description>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="60bd2833-83fd-4396-b677-6ee6b4613534">
+                  <name>nic1</name>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5f"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"

Modified: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0f50173e8cba941468c17039c11d63e940e351f7.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0f50173e8cba941468c17039c11d63e940e351f7.yml?rev=1095516&r1=1095515&r2=1095516&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0f50173e8cba941468c17039c11d63e940e351f7.yml (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-0f50173e8cba941468c17039c11d63e940e351f7.yml Wed Apr 20 21:25:31 2011
@@ -2,89 +2,11 @@
 - !ruby/struct:VCR::HTTPInteraction 
   request: !ruby/struct:VCR::Request 
     method: :get
-    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell
-    body: 
-    headers: 
-      accept: 
-      - application/xml
-      accept-encoding: 
-      - gzip, deflate
-  response: !ruby/struct:VCR::Response 
-    status: !ruby/struct:VCR::ResponseStatus 
-      code: 200
-      message: OK
-    headers: 
-      expires: 
-      - Wed, 31 Dec 1969 16:00:00 PST
-      content-type: 
-      - application/xml
-      server: 
-      - Apache-Coyote/1.1
-      date: 
-      - Mon, 11 Apr 2011 16:17:39 GMT
-      content-length: 
-      - "2163"
-      link: 
-      - <https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/capabilities>; rel=capabilities,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters>; rel=clusters,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters?search={query}>; rel=clusters/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/datacenters>; rel=datacenters,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/datacenters?search={query}>; rel=datacenters/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/events>; rel=events,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/events?search={query}>; rel=events/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/hosts>; rel=hosts,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/hosts?search={query}>; rel=hosts/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/networks>; rel=ne
 tworks,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/roles>; rel=roles,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/storagedomains>; rel=storagedomains,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/storagedomains?search={query}>; rel=storagedomains/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/tags>; rel=tags,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/templates>; rel=templates,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/templates?search={query}>; rel=templates/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/users>; rel=users,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/users?search={query}>; rel=users/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vmpools>; rel=vmpools,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vmpools?search={query}>; rel=vmpools/sea
 rch,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms>; rel=vms,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms?search={query}>; rel=vms/search
-      cache-control: 
-      - no-cache
-      pragma: 
-      - No-cache
-    body: |
-      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-      <api>
-          <link rel="capabilities" href="/rhevm-api-powershell/capabilities"/>
-          <link rel="clusters" href="/rhevm-api-powershell/clusters"/>
-          <link rel="clusters/search" href="/rhevm-api-powershell/clusters?search={query}"/>
-          <link rel="datacenters" href="/rhevm-api-powershell/datacenters"/>
-          <link rel="datacenters/search" href="/rhevm-api-powershell/datacenters?search={query}"/>
-          <link rel="events" href="/rhevm-api-powershell/events"/>
-          <link rel="events/search" href="/rhevm-api-powershell/events?search={query}"/>
-          <link rel="hosts" href="/rhevm-api-powershell/hosts"/>
-          <link rel="hosts/search" href="/rhevm-api-powershell/hosts?search={query}"/>
-          <link rel="networks" href="/rhevm-api-powershell/networks"/>
-          <link rel="roles" href="/rhevm-api-powershell/roles"/>
-          <link rel="storagedomains" href="/rhevm-api-powershell/storagedomains"/>
-          <link rel="storagedomains/search" href="/rhevm-api-powershell/storagedomains?search={query}"/>
-          <link rel="tags" href="/rhevm-api-powershell/tags"/>
-          <link rel="templates" href="/rhevm-api-powershell/templates"/>
-          <link rel="templates/search" href="/rhevm-api-powershell/templates?search={query}"/>
-          <link rel="users" href="/rhevm-api-powershell/users"/>
-          <link rel="users/search" href="/rhevm-api-powershell/users?search={query}"/>
-          <link rel="vmpools" href="/rhevm-api-powershell/vmpools"/>
-          <link rel="vmpools/search" href="/rhevm-api-powershell/vmpools?search={query}"/>
-          <link rel="vms" href="/rhevm-api-powershell/vms"/>
-          <link rel="vms/search" href="/rhevm-api-powershell/vms?search={query}"/>
-          <system_version revision="51796" build="4" minor="2" major="2"/>
-          <summary>
-              <vms>
-                  <total>10</total>
-                  <active>10</active>
-              </vms>
-              <hosts>
-                  <total>1</total>
-                  <active>1</active>
-              </hosts>
-              <users>
-                  <total>5</total>
-                  <active>4</active>
-              </users>
-              <storage_domains>
-                  <total>2</total>
-                  <active>2</active>
-              </storage_domains>
-          </summary>
-      </api>
-
-    http_version: "1.1"
-- !ruby/struct:VCR::HTTPInteraction 
-  request: !ruby/struct:VCR::Request 
-    method: :get
     uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters
     body: 
     headers: 
       accept: 
-      - application/xml
+      - application/xml; detail=datacenters
       accept-encoding: 
       - gzip, deflate
   response: !ruby/struct:VCR::Response 
@@ -99,7 +21,7 @@
       server: 
       - Apache-Coyote/1.1
       date: 
-      - Mon, 11 Apr 2011 16:17:39 GMT
+      - Wed, 20 Apr 2011 20:23:22 GMT
       content-length: 
       - "738"
       cache-control: 
@@ -148,7 +70,7 @@
       server: 
       - Apache-Coyote/1.1
       date: 
-      - Mon, 11 Apr 2011 16:17:39 GMT
+      - Wed, 20 Apr 2011 20:23:22 GMT
       content-length: 
       - "707"
       cache-control: 
@@ -162,7 +84,7 @@
           <description>The default Data Center</description>
           <link rel="files" href="/rhevm-api-powershell/datacenters/ae5ff258-82f3-4cf6-8280-8f685ac068ac/files"/>
           <link rel="storagedomains" href="/rhevm-api-powershell/datacenters/ae5ff258-82f3-4cf6-8280-8f685ac068ac/storagedomains"/>
-          <storage_type>ISCSI</storage_type>
+          <storage_type>iscsi</storage_type>
           <version minor="2" major="2"/>
           <supported_versions>
               <version minor="2" major="2"/>

Modified: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-163a76f09d41670494c54dcd2eab373a5588683d.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-163a76f09d41670494c54dcd2eab373a5588683d.yml?rev=1095516&r1=1095515&r2=1095516&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-163a76f09d41670494c54dcd2eab373a5588683d.yml (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-163a76f09d41670494c54dcd2eab373a5588683d.yml Wed Apr 20 21:25:31 2011
@@ -2,89 +2,11 @@
 - !ruby/struct:VCR::HTTPInteraction 
   request: !ruby/struct:VCR::Request 
     method: :get
-    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell
-    body: 
-    headers: 
-      accept: 
-      - application/xml
-      accept-encoding: 
-      - gzip, deflate
-  response: !ruby/struct:VCR::Response 
-    status: !ruby/struct:VCR::ResponseStatus 
-      code: 200
-      message: OK
-    headers: 
-      expires: 
-      - Wed, 31 Dec 1969 16:00:00 PST
-      content-type: 
-      - application/xml
-      server: 
-      - Apache-Coyote/1.1
-      date: 
-      - Mon, 11 Apr 2011 16:13:39 GMT
-      content-length: 
-      - "2163"
-      link: 
-      - <https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/capabilities>; rel=capabilities,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters>; rel=clusters,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters?search={query}>; rel=clusters/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/datacenters>; rel=datacenters,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/datacenters?search={query}>; rel=datacenters/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/events>; rel=events,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/events?search={query}>; rel=events/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/hosts>; rel=hosts,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/hosts?search={query}>; rel=hosts/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/networks>; rel=ne
 tworks,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/roles>; rel=roles,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/storagedomains>; rel=storagedomains,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/storagedomains?search={query}>; rel=storagedomains/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/tags>; rel=tags,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/templates>; rel=templates,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/templates?search={query}>; rel=templates/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/users>; rel=users,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/users?search={query}>; rel=users/search,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vmpools>; rel=vmpools,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vmpools?search={query}>; rel=vmpools/sea
 rch,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms>; rel=vms,<https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms?search={query}>; rel=vms/search
-      cache-control: 
-      - no-cache
-      pragma: 
-      - No-cache
-    body: |
-      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-      <api>
-          <link rel="capabilities" href="/rhevm-api-powershell/capabilities"/>
-          <link rel="clusters" href="/rhevm-api-powershell/clusters"/>
-          <link rel="clusters/search" href="/rhevm-api-powershell/clusters?search={query}"/>
-          <link rel="datacenters" href="/rhevm-api-powershell/datacenters"/>
-          <link rel="datacenters/search" href="/rhevm-api-powershell/datacenters?search={query}"/>
-          <link rel="events" href="/rhevm-api-powershell/events"/>
-          <link rel="events/search" href="/rhevm-api-powershell/events?search={query}"/>
-          <link rel="hosts" href="/rhevm-api-powershell/hosts"/>
-          <link rel="hosts/search" href="/rhevm-api-powershell/hosts?search={query}"/>
-          <link rel="networks" href="/rhevm-api-powershell/networks"/>
-          <link rel="roles" href="/rhevm-api-powershell/roles"/>
-          <link rel="storagedomains" href="/rhevm-api-powershell/storagedomains"/>
-          <link rel="storagedomains/search" href="/rhevm-api-powershell/storagedomains?search={query}"/>
-          <link rel="tags" href="/rhevm-api-powershell/tags"/>
-          <link rel="templates" href="/rhevm-api-powershell/templates"/>
-          <link rel="templates/search" href="/rhevm-api-powershell/templates?search={query}"/>
-          <link rel="users" href="/rhevm-api-powershell/users"/>
-          <link rel="users/search" href="/rhevm-api-powershell/users?search={query}"/>
-          <link rel="vmpools" href="/rhevm-api-powershell/vmpools"/>
-          <link rel="vmpools/search" href="/rhevm-api-powershell/vmpools?search={query}"/>
-          <link rel="vms" href="/rhevm-api-powershell/vms"/>
-          <link rel="vms/search" href="/rhevm-api-powershell/vms?search={query}"/>
-          <system_version revision="51796" build="4" minor="2" major="2"/>
-          <summary>
-              <vms>
-                  <total>10</total>
-                  <active>10</active>
-              </vms>
-              <hosts>
-                  <total>1</total>
-                  <active>1</active>
-              </hosts>
-              <users>
-                  <total>5</total>
-                  <active>4</active>
-              </users>
-              <storage_domains>
-                  <total>2</total>
-                  <active>2</active>
-              </storage_domains>
-          </summary>
-      </api>
-
-    http_version: "1.1"
-- !ruby/struct:VCR::HTTPInteraction 
-  request: !ruby/struct:VCR::Request 
-    method: :get
     uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/clusters
     body: 
     headers: 
       accept: 
-      - application/xml
+      - application/xml; detail=datacenters
       accept-encoding: 
       - gzip, deflate
   response: !ruby/struct:VCR::Response 
@@ -99,7 +21,7 @@
       server: 
       - Apache-Coyote/1.1
       date: 
-      - Mon, 11 Apr 2011 16:13:39 GMT
+      - Wed, 20 Apr 2011 20:18:12 GMT
       content-length: 
       - "738"
       cache-control: 
@@ -148,7 +70,7 @@
       server: 
       - Apache-Coyote/1.1
       date: 
-      - Mon, 11 Apr 2011 16:13:39 GMT
+      - Wed, 20 Apr 2011 20:18:12 GMT
       content-length: 
       - "707"
       cache-control: 
@@ -162,7 +84,7 @@
           <description>The default Data Center</description>
           <link rel="files" href="/rhevm-api-powershell/datacenters/ae5ff258-82f3-4cf6-8280-8f685ac068ac/files"/>
           <link rel="storagedomains" href="/rhevm-api-powershell/datacenters/ae5ff258-82f3-4cf6-8280-8f685ac068ac/storagedomains"/>
-          <storage_type>ISCSI</storage_type>
+          <storage_type>iscsi</storage_type>
           <version minor="2" major="2"/>
           <supported_versions>
               <version minor="2" major="2"/>

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-33a70f1ed1ea33cb209804a2470bb87278c06c8a.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-33a70f1ed1ea33cb209804a2470bb87278c06c8a.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-33a70f1ed1ea33cb209804a2470bb87278c06c8a.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-33a70f1ed1ea33cb209804a2470bb87278c06c8a.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,105 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:18:40 GMT
+      content-length: 
+      - "3499"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7">
+          <name>mock-test2</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/statistics"/>
+          <type>server</type>
+          <status>DOWN</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <monitors>1</monitors>
+          </display>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="b68b8d09-6696-4f16-ba71-5d11d68cf81d">
+                  <description>_mock-test2_4/20/2011 1:18:26 PM</description>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="60bd2833-83fd-4396-b677-6ee6b4613534">
+                  <name>nic1</name>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5f"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"

Added: incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-37f932402c97a6c4549f109edb33055fe6781cf1.yml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-37f932402c97a6c4549f109edb33055fe6781cf1.yml?rev=1095516&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-37f932402c97a6c4549f109edb33055fe6781cf1.yml (added)
+++ incubator/deltacloud/trunk/server/tests/drivers/rhevm/fixtures/get-37f932402c97a6c4549f109edb33055fe6781cf1.yml Wed Apr 20 21:25:31 2011
@@ -0,0 +1,105 @@
+--- 
+- !ruby/struct:VCR::HTTPInteraction 
+  request: !ruby/struct:VCR::Request 
+    method: :get
+    uri: https://rhev-m%40deltacloud.local:RedHat001@rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7
+    body: 
+    headers: 
+      accept: 
+      - application/xml; detail=disks; detail=nics; detail=hosts
+      accept-encoding: 
+      - gzip, deflate
+  response: !ruby/struct:VCR::Response 
+    status: !ruby/struct:VCR::ResponseStatus 
+      code: 200
+      message: OK
+    headers: 
+      expires: 
+      - Wed, 31 Dec 1969 16:00:00 PST
+      content-type: 
+      - application/xml
+      server: 
+      - Apache-Coyote/1.1
+      date: 
+      - Wed, 20 Apr 2011 20:18:39 GMT
+      content-length: 
+      - "3499"
+      cache-control: 
+      - no-cache
+      pragma: 
+      - No-cache
+    body: |
+      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+      <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7">
+          <name>mock-test2</name>
+          <description>F14 Minimal installation with Ruby preinstalled</description>
+          <actions>
+              <link rel="migrate" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/migrate"/>
+              <link rel="export" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/export"/>
+              <link rel="ticket" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/ticket"/>
+              <link rel="shutdown" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/shutdown"/>
+              <link rel="start" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/start"/>
+              <link rel="stop" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/stop"/>
+              <link rel="suspend" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/suspend"/>
+              <link rel="detach" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/detach"/>
+          </actions>
+          <link rel="cdroms" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/cdroms"/>
+          <link rel="disks" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/disks"/>
+          <link rel="nics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/nics"/>
+          <link rel="snapshots" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/snapshots"/>
+          <link rel="tags" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/tags"/>
+          <link rel="statistics" href="/rhevm-api-powershell/vms/a4437689-0ede-4b61-ab96-6bbd97e81da7/statistics"/>
+          <type>server</type>
+          <status>DOWN</status>
+          <memory>536870912</memory>
+          <cpu>
+              <topology cores="1" sockets="1"/>
+          </cpu>
+          <os type="OtherLinux">
+              <boot dev="hd"/>
+          </os>
+          <high_availability>
+              <enabled>false</enabled>
+              <priority>0</priority>
+          </high_availability>
+          <display>
+              <type>spice</type>
+              <monitors>1</monitors>
+          </display>
+          <cluster id="0" href="/rhevm-api-powershell/clusters/0"/>
+          <template id="bb2e79bd-fd73-46a1-b391-a390b1998f03" href="/rhevm-api-powershell/templates/bb2e79bd-fd73-46a1-b391-a390b1998f03"/>
+          <creation_time>2011-04-20T13:18:00.000Z</creation_time>
+          <origin>rhev</origin>
+          <stateless>false</stateless>
+          <domain>
+              <name>deltacloud.local</name>
+          </domain>
+          <disks>
+              <disk id="b68b8d09-6696-4f16-ba71-5d11d68cf81d">
+                  <description>_mock-test2_4/20/2011 1:18:26 PM</description>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <size>1073741824</size>
+                  <type>system</type>
+                  <status>OK</status>
+                  <interface>virtio</interface>
+                  <format>cow</format>
+                  <sparse>true</sparse>
+                  <bootable>true</bootable>
+                  <wipe_after_delete>false</wipe_after_delete>
+                  <propagate_errors>false</propagate_errors>
+              </disk>
+          </disks>
+          <nics>
+              <nic id="60bd2833-83fd-4396-b677-6ee6b4613534">
+                  <name>nic1</name>
+                  <vm id="a4437689-0ede-4b61-ab96-6bbd97e81da7"/>
+                  <network>
+                      <name>rhevm</name>
+                  </network>
+                  <type>virtio</type>
+                  <mac address="00:1a:4a:22:20:5f"/>
+              </nic>
+          </nics>
+      </vm>
+
+    http_version: "1.1"



Mime
View raw message