Ack'd

On Thu, Jul 21, 2011 at 01:02:16PM +0200, [email protected] wrote:
> From: Michal Fojtik <[email protected]>
> 
> 
> Signed-off-by: Michal fojtik <[email protected]>
> ---
>  server/lib/deltacloud/base_driver/features.rb      |    8 ++++++++
>  .../deltacloud/drivers/vsphere/vsphere_driver.rb   |   12 ++++++------
>  server/views/instances/new.html.haml               |    6 +++---
>  3 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/server/lib/deltacloud/base_driver/features.rb 
> b/server/lib/deltacloud/base_driver/features.rb
> index c3e296f..af1a9c5 100644
> --- a/server/lib/deltacloud/base_driver/features.rb
> +++ b/server/lib/deltacloud/base_driver/features.rb
> @@ -175,6 +175,14 @@ module Deltacloud
>        end
>      end
>  
> +    declare_feature :instances, :user_iso do
> +      description "Make user-defined ISO available inside instance"
> +      operation :create do
> +        param :user_iso, :string, :optional, [],
> +        "Base64 encoded gzipped ISO file will be accessible as CD-ROM drive 
> in instance"
> +      end
> +    end
> +
>      declare_feature :instances, :user_files do
>        description "Accept up to 5 files to be placed into the instance 
> before launch."
>        operation :create do
> diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb 
> b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> index 20cf483..cff74ca 100644
> --- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> +++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
> @@ -27,10 +27,10 @@ module Deltacloud::Drivers::VSphere
>      include Deltacloud::Drivers::VSphere::Helper
>      include Deltacloud::Drivers::VSphere::FileManager
>  
> -    # You can use 'user_data' feature to set 'user_data' parameter when 
> creating
> +    # You can use 'user_iso' feature to set 'user_iso' parameter when 
> creating
>      # a new instance where this parameter can hold gzipped CDROM iso which 
> will
>      # be mounted into created instance after boot
> -    feature :instances, :user_data
> +    feature :instances, :user_iso
>      feature :instances, :user_name
>  
>      # There is just one hardware profile where memory is measured using 
> maximum
> @@ -229,12 +229,12 @@ module Deltacloud::Drivers::VSphere
>          # encoded gzipped ISO image.
>          # This image will be uplaoded to the Datastore given in 'realm_id'
>          # parameter and them attached to instance.
> -        if opts[:user_data] and not opts[:user_data].empty?
> +        if opts[:user_iso] and not opts[:user_iso].empty?
>            device = vm[:instance].config.hardware.device.select { |hw| 
> hw.class == RbVmomi::VIM::VirtualCdrom }.first
>            if device
> -            VSphere::FileManager::store_iso!(datastore, opts[:user_data], 
> "#{opts[:name]}.iso")
> +            VSphere::FileManager::store_iso!(datastore, opts[:user_iso], 
> "#{opts[:name]}.iso")
>              machine_config[:extraConfig] << {
> -              :key => 'user_data_file', :value => "#{opts[:name]}.iso"
> +              :key => 'user_iso_file', :value => "#{opts[:name]}.iso"
>              }
>              device.backing = 
> RbVmomi::VIM.VirtualCdromIsoBackingInfo(:fileName => "[#{opts[:realm_id] || 
> vm[:datastore]}] "+
>                                                                       
> "/#{VSphere::FileManager::DIRECTORY_PATH}/#{opts[:name]}.iso")
> @@ -299,7 +299,7 @@ module Deltacloud::Drivers::VSphere
>      # well.
>      def destroy_instance(credentials, instance_id)
>        vm = find_vm(credentials, instance_id)
> -      user_file = vm[:instance].config[:extraConfig].select { |k| k.key == 
> 'user_data_file' }.first
> +      user_file = vm[:instance].config[:extraConfig].select { |k| k.key == 
> 'user_iso_file' }.first
>        
> VSphere::FileManager::delete_iso!(vm[:instance].send(:datastore).first, 
> user_file.value) if user_file
>        vm[:instance].Destroy_Task.wait_for_completion
>      end
> diff --git a/server/views/instances/new.html.haml 
> b/server/views/instances/new.html.haml
> index 6f8a086..a153535 100644
> --- a/server/views/instances/new.html.haml
> +++ b/server/views/instances/new.html.haml
> @@ -27,11 +27,11 @@
>          %option
>          - @load_balancers.each do |load_balancer|
>            %option{:value => load_balancer.id} #{load_balancer.id}
> -  -if driver_has_feature?(:user_data)
> +  -if driver_has_feature?(:user_iso)
>      %p
>        %label
> -        User data (Base64):
> -      %textarea{:name => :user_data, :cols => 60, :rows => 10, :placeholder 
> => "Copy&Paste a Base64 string here..."}
> +        User ISO (Base64):
> +      %textarea{:name => :user_iso, :cols => 60, :rows => 10, :placeholder 
> => "Copy&Paste a Base64 string here..."}
>    -if driver_has_feature?(:authentication_key)
>      %p
>        %label
> -- 
> 1.7.4.1
> 

Reply via email to