incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH core 1/2] RHEV 3 API start and stop compatiblity
Date Tue, 13 Sep 2011 11:28:00 GMT
On Sep 10, 2011, at 2:50 AM, Richard Su wrote:

ACK. Agree that this 'incompatibility' should be reported to RHEV-M REST API.
Meanwhile we could use this as a workaround.

  -- Michal

> 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
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message