deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] RHEV-M: Choose the image realm when no realm is being specified upon instance creation (DTACLOUD-126)
Date Mon, 16 Jan 2012 11:40:06 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 .../lib/deltacloud/drivers/rhevm/rhevm_client.rb   |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
index d662818..ca09e92 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
@@ -121,12 +121,13 @@ module RHEVM
 
     def create_vm(template_id, opts={})
       opts ||= {}
-      raise RHEVMBackendException::new("Requested VM not found in datacenter #{self.current_datacenter.id}")
unless template(template_id)
+      templ = template(template_id)
+      raise RHEVMBackendException::new("Requested VM not found in datacenter #{self.current_datacenter.id}")
unless templ
       builder = Nokogiri::XML::Builder.new do
         vm {
           name opts[:name] || "i-#{Time.now.to_i}"
           template_(:id => template_id)
-          cluster_(:id => opts[:realm_id].empty? ? clusters.first.id : opts[:realm_id])
+          cluster_(:id => opts[:realm_id].nil? ? templ.cluster.id : opts[:realm_id])
           type_ opts[:hwp_id] || 'desktop'
           memory opts[:hwp_memory] ? (opts[:hwp_memory].to_i*1024*1024).to_s : (512*1024*1024).to_s
           cpu {
-- 
1.7.4.4


Mime
View raw message