You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/07/16 13:58:39 UTC

[PATCH core] VSphere: Set a random name for the Instance when opts[:name] is not set or empty (DTACLOUD-166)

From: Michal Fojtik <mf...@redhat.com>


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

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index 2e868ca..7fd7ad9 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -295,6 +295,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])
+        opts[:name] = "i-#{Time.now.to_i}" if opts[:name].nil? or (!opts[:name].nil? && opts[:name].empty?)
         task = vm[:instance].CloneVM_Task(:folder => vm[:instance].parent, :name => opts[:name], :spec => spec)
         new_instance = Instance::new(
           :id => opts[:name],
-- 
1.7.10.2


Re: [PATCH core] VSphere: Set a random name for the Instance when opts[:name] is not set or empty (DTACLOUD-166)

Posted by Ronelle Landy <rl...@redhat.com>.
ACK - tested - default name is created if no name is input

----- Original Message -----
> From: mfojtik@redhat.com
> To: dev@deltacloud.apache.org
> Sent: Monday, July 16, 2012 7:58:39 AM
> Subject: [PATCH core] VSphere: Set a random name for the Instance when opts[:name] is not set or empty (DTACLOUD-166)
> 
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> index 2e868ca..7fd7ad9 100644
> --- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> +++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> @@ -295,6 +295,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])
> +        opts[:name] = "i-#{Time.now.to_i}" if opts[:name].nil? or
> (!opts[:name].nil? && opts[:name].empty?)
>          task = vm[:instance].CloneVM_Task(:folder =>
>          vm[:instance].parent, :name => opts[:name], :spec => spec)
>          new_instance = Instance::new(
>            :id => opts[:name],
> --
> 1.7.10.2
> 
>