deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1233874 - /deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
Date Fri, 20 Jan 2012 11:29:59 GMT
Author: mfojtik
Date: Fri Jan 20 11:29:59 2012
New Revision: 1233874

URL: http://svn.apache.org/viewvc?rev=1233874&view=rev
Log:
RHEV-M: Add more verbose exception when floppyinject is not enabled on target RHEV-M backend
(BZ: 765855)

Modified:
    deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb

Modified: deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb?rev=1233874&r1=1233873&r2=1233874&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb (original)
+++ deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb Fri Jan 20 11:29:59
2012
@@ -119,6 +119,16 @@ module RHEVM
       (result_xml/'/cluster/version').first[:major].strip == major
     end
 
+    def capability?(name)
+      headers = {
+        :content_type => 'application/xml',
+        :accept => 'application/xml'
+      }
+      headers.merge!(auth_header)
+      result_xml = Nokogiri::XML(RHEVM::client(@api_entrypoint)["/capabilities"].get(headers))
+      !(result_xml/"/capabilities/version/custom_properties/custom_property[@name='#{name}']").empty?
+    end
+
     def create_vm(template_id, opts={})
       opts ||= {}
       templ = template(template_id)
@@ -135,6 +145,7 @@ module RHEVM
           }
           if opts[:user_data] and not opts[:user_data].empty?
             if api_version?('3') and cluster_version?((opts[:realm_id] || clusters.first.id),
'3')
+              raise "Required VDSM hook 'floppyinject' not supported by RHEV-M" unless capability?(:floppyinject)
               custom_properties {
                 custom_property({
                   :name => "floppyinject",



Mime
View raw message