incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Su <r...@redhat.com>
Subject [PATCH core 1/2] RHEV 3 API start and stop compatiblity
Date Sat, 10 Sep 2011 00:50:14 GMT
Start instance call fails with <template id="namevalue"> but succeeds with
<template><name>namevalue</name></template>. Possibly a bug in RHEV
API.

Statuses are also case sensitive.
---
 .../lib/deltacloud/drivers/rhevm/rhevm_client.rb   |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
index ca8e3d9..d1314c2 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
@@ -78,7 +78,7 @@ module RHEVM
         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"
+        return false if (xml_response/'action/status').first.text.strip.upcase!="COMPLETE"
       end
       return true
     end
@@ -114,7 +114,13 @@ module RHEVM
       builder = Nokogiri::XML::Builder.new do
         vm {
           name opts[:name] || "i-#{Time.now.to_i}"
-          template_(:id => template_id)
+          if api_version?('3')
+            template_ {
+              name template_id
+            }
+          else
+            template_(:id => template_id)
+          end
           cluster(:id => opts[:realm_id] || clusters.first.id)
           type_ opts[:hwp_id] || 'desktop'
           memory opts[:hwp_memory] ? (opts[:hwp_memory].to_i*1024*1024).to_s : (512*1024*1024).to_s
-- 
1.7.6


Mime
View raw message