deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/4] VSphere: Make the 'name' parameter optional
Date Wed, 02 Jan 2013 14:11:15 GMT
From: Michal Fojtik <mfojtik@redhat.com>

In case 'name' is not sent, use the default "inst#{Time.now.to_i}"
name.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index 5bc7088..2ddd43a 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -290,7 +290,7 @@ module Deltacloud::Drivers::Vsphere
           :config => RbVmomi::VIM.VirtualMachineConfigSpec(machine_config)
         )
         instance_profile = InstanceProfile::new('default', :hwp_memory => opts[:hwp_memory],
:hwp_cpu => opts[:hwp_cpu])
-        task = vm[:instance].CloneVM_Task(:folder => vm[:instance].parent, :name =>
opts[:name], :spec => spec)
+        task = vm[:instance].CloneVM_Task(:folder => vm[:instance].parent, :name =>
opts[:name] || "inst#{Time.now.to_i}", :spec => spec)
         new_instance = Instance::new(
           :id => opts[:name],
           :name => opts[:name],
-- 
1.8.0.2


Mime
View raw message